semiotic 3.7.3 → 3.7.5
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 +13 -7
- package/README.md +36 -20
- package/ai/schema.json +221 -1
- package/ai/system-prompt.md +2 -1
- package/dist/components/Annotation.d.ts +4 -0
- package/dist/components/DataSummaryContext.d.ts +1 -0
- package/dist/components/LinkedCharts.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +16 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +101 -0
- package/dist/components/ai/dataQualityBridge.d.ts +201 -0
- package/dist/components/ai/describeChart.d.ts +2 -0
- package/dist/components/ai/generativeChart.d.ts +145 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +15 -2
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +7 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +21 -0
- package/dist/components/charts/realtime/aggregate.d.ts +51 -0
- package/dist/components/charts/realtime/eventTime.d.ts +26 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
- package/dist/components/charts/shared/colorUtils.d.ts +1 -12
- package/dist/components/charts/shared/minMax.d.ts +3 -0
- package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
- package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/validateChartData.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +9 -0
- package/dist/components/data/fromArrow.d.ts +54 -0
- package/dist/components/data/fromMermaid.d.ts +47 -0
- package/dist/components/data/fromObservablePlot.d.ts +69 -0
- package/dist/components/data/portability/index.d.ts +14 -0
- package/dist/components/data/portability/spec.d.ts +129 -0
- package/dist/components/data/portability/vegaLite.d.ts +62 -0
- package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
- package/dist/components/realtime/RunningStats.d.ts +66 -0
- package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
- package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
- package/dist/components/recipes/customTooltip.d.ts +31 -0
- package/dist/components/recipes/gofish.d.ts +207 -0
- package/dist/components/recipes/gofishBoba.d.ts +23 -0
- package/dist/components/recipes/gofishIR.d.ts +169 -0
- package/dist/components/recipes/gofishIRExamples.d.ts +89 -0
- package/dist/components/recipes/gofishInterpreter.d.ts +52 -0
- package/dist/components/recipes/gofishLambdas.d.ts +145 -0
- package/dist/components/recipes/lineageDag.d.ts +129 -0
- package/dist/components/recipes/mermaidDag.d.ts +44 -0
- package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
- package/dist/components/recipes/recipeChrome.d.ts +100 -0
- package/dist/components/recipes/recipeLegend.d.ts +57 -0
- package/dist/components/recipes/recipeUtils.d.ts +105 -0
- package/dist/components/semiotic-ai.d.ts +6 -0
- package/dist/components/semiotic-data.d.ts +2 -0
- package/dist/components/semiotic-experimental.d.ts +20 -0
- package/dist/components/semiotic-network.d.ts +3 -1
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-realtime.d.ts +9 -1
- package/dist/components/semiotic-recipes.d.ts +20 -1
- package/dist/components/semiotic-themes.d.ts +2 -0
- package/dist/components/semiotic-xy.d.ts +2 -0
- package/dist/components/semiotic.d.ts +6 -2
- package/dist/components/store/ObservationStore.d.ts +21 -2
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/ThemeStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/createStore.d.ts +1 -1
- package/dist/components/store/designTokens.d.ts +15 -0
- package/dist/components/store/useSelection.d.ts +22 -0
- package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +32 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +12 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +18 -0
- package/dist/components/stream/PipelineStore.d.ts +27 -0
- package/dist/components/stream/SceneGraph.d.ts +5 -1
- package/dist/components/stream/customLayout.d.ts +20 -0
- package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
- package/dist/components/stream/customLayoutSelection.d.ts +52 -0
- package/dist/components/stream/networkCustomLayout.d.ts +101 -1
- package/dist/components/stream/networkTypes.d.ts +38 -1
- package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +19 -3
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/stalenessBands.d.ts +28 -0
- package/dist/components/stream/symbolPath.d.ts +24 -0
- package/dist/components/stream/types.d.ts +72 -3
- package/dist/components/stream/useStalenessCheck.d.ts +6 -1
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +5 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +2 -0
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +1 -0
- package/dist/semiotic-ai.d.ts +6 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +20 -0
- package/dist/semiotic-experimental.min.js +1 -0
- package/dist/semiotic-experimental.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +3 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-realtime.d.ts +9 -1
- package/dist/semiotic-recipes.d.ts +20 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +2 -0
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +1 -0
- package/dist/semiotic-themes.d.ts +2 -0
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.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.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +2 -0
- package/dist/semiotic.d.ts +6 -2
- 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-semiotic-xy-Dufu3D0-.js +2 -0
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +11 -3
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as l,useCallback as a,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as f,useId as g,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as w,scaleLog as k,scaleTime as A,scaleSequential as O}from"d3-scale";import{quadtree as S}from"d3-quadtree";import{symbol as C,symbolCircle as M,symbolWye as j,symbolCross as _,symbolStar as P,symbolDiamond as L,symbolTriangle as N,symbolSquare as F,curveNatural as B,curveBasis as T,curveStepAfter as H,curveStepBefore as W,curveStep as D,curveCatmullRom as I,curveCardinal as z,curveMonotoneY as E,curveMonotoneX as R,line as $,area as Y,curveLinear as G}from"d3-shape";import{bin as X}from"d3-array";import{packEnclose as V}from"d3-hierarchy";import q from"regression";function U(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function K(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function Q({width:t,height:n,totalWidth:o,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:g,snapDuring:p,streaming:x}){const w=i(null),k=i(null),A=i(d);A.current=d;const O=i(u);O.current=u;const S=r(()=>g?[...g].sort((e,t)=>e-t):void 0,[g]),C=i(S);C.current=S;const M=i(!1),j=i(null);return s(()=>{if(!w.current)return;const e=y(w.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(M.current)return;const r=O.current;if(!r)return;if(!i.selection)return j.current=null,void A.current(null);let s,l;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],l=[r.y.invert(o),r.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[U(e[0],t),K(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),l=r.x(s[1]);if(M.current=!0,"x"===c)e.call(o.move,[n,l]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[l,t[1][1]]])}M.current=!1}const a={x:s,y:l};j.current=a,A.current(a)}),e.call(o),k.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),k.current=null}},[t,n,c,f,h,p]),s(()=>{if(!(x&&u&&k.current&&j.current))return;if(!w.current)return;if("y"===c)return;const e=j.current,t=u.x.domain()[0],n=y(w.current).select(".brush-g");if(t>=e.x[1])return M.current=!0,n.call(k.current.move,null),M.current=!1,j.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===f){const e=C.current;e&&e.length>0?o=K(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return M.current=!0,n.call(k.current.move,null),M.current=!1,j.current=null,void A.current(null);i=!0}const r=u.x(o),s=u.x(e.x[1]);if(M.current=!0,"x"===c)n.call(k.current.move,[r,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(k.current.move,[[r,t],[s,o]])}if(M.current=!1,i){const t={x:[o,e.x[1]],y:e.y};j.current=t,A.current(t)}},[u,x,c,f,h]),e("svg",{ref:w,width:o,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const Z=Object.freeze([]);function J(e){if(!e)return Z;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class ee{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=J(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=J(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function te(t){let n=null;const o=()=>(n||(n=u(null)),n),s=ne(t);return[function({children:n,initialState:s}){const l=i(s),a=r(()=>ne(t,l.current),[]),c=o();return e(c.Provider,{value:a,children:n})},(e,t)=>{var n;const r=o(),u=null!==(n=l(r))&&void 0!==n?n:s,d=i(e);d.current=e;const h=i({hasValue:!1,value:void 0}),f=a(()=>{const e=d.current(u.getState()),n=h.current;return n.hasValue&&t&&t(n.value,e)?n.value:(h.current={hasValue:!0,value:e},e)},[u,t]),g=a(()=>d.current(u.getState()),[u]);return c(u.subscribe,f,g)}]}function ne(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function oe(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function ie(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:re})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const re=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],se={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},le={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ae={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:re,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function ce(e,t){if("light"===t)return se;if("dark"===t)return le;if("high-contrast"===t)return ae;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?le:se;return ie(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return ie(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ue,de]=te(e=>({theme:se,setTheme(t){e(e=>({theme:ce(e.theme,t)}))}}));class he{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+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 e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}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}}class fe{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function ge(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),l=n(s);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=r.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},r.set(a,c)),c.total+=l,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+l)}}return r}function pe(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const l=Array(s.length),a=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];l[e]=[t.px,t.py],a[e]=t.rawY,c[e]=t.d}return{type:"line",path:l,rawValues:a,style:i,datum:c,group:r}}function ye(e,t,n,o,i,r,s,l){const a=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=l?l(r):i;a.push({px:c,topY:t.y(s),botY:t.y(u)})}a.sort((e,t)=>e.px-t.px);const c=Array(a.length),u=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function me(e,t,n,o){var i,r,s;const l=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;l.set(o,-e/2)}else if("wiggle"===o){e.length>0&&l.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,s)||0;a+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=l.get(r))&&void 0!==i?i:0;l.set(s,d-(c>0?a/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=l.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(s=l.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)l.set(t,0);return l}function ve(e,t,n,o,i,r,s){const l=n(e),a=o(e);if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c={type:"point",x:t.x(l),y:t.y(a),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function be(e,t,n,o,i,r,s,l){const a=n(e),c=o(e);if(!Number.isFinite(a)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(a),y:t.y(c),size:i,symbolType:r,style:s,datum:e};return void 0!==l&&(u.pointId=l),u}function xe(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function we(e,t,n,o,i,r,s){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(l.showValues=!0,l.value=s.value,s.valueFormat&&(l.valueFormat=s.valueFormat)),l}function ke(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Ae(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Oe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Se(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function Ce(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Me(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function je(e){const t=e.map(Ce),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Me(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Me(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return Me(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}const _e=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pe=je(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Le=je(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ne=je(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Fe=je(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Be=je(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Te=je(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),He=je(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),We=je(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),De=je(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ie=je(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ze=je(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Ee=je(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Re={blues:Pe,reds:Le,greens:Ne,viridis:He,oranges:Fe,purples:Be,greys:Te,plasma:We,inferno:De,magma:Ie,cividis:ze,turbo:Ee};function $e(e){return e&&Re[e]||Pe}je(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),je(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),je(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),je(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),je(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),je(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),je(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Ye=Object.assign({category10:_e,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},Re),Ge=_e,Xe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ve=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 qe(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Ve.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Ge[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)}(o))%Ge.length]}function Ue(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=Ye[n]||Ye.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Ge;return x().domain(o).range(e).unknown("#999")}}function Ke(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}function Qe(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function Ze(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function Je(e,t,n){return e+(t-e)*n}function et(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function tt(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function nt(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),l=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(l))continue;const a=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(l);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([a,c]),r.push([a,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:tt(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function ot(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function it(e,t,n){const o=[];for(const i of n){const n=nt(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function rt(e,t,n,o){const i=[];for(const r of o){const o=nt(e,t,n,r);o&&i.push(o)}return i}function st(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function lt(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const l=null!==(i=o.r)&&void 0!==i?i:3,a=e.getPointId?e.getPointId(s)+"":void 0,c=ve(s,e.scales,e.getX,r,l,o,a);c&&n.push(c)}}}const at={topOpacity:.8,bottomOpacity:.05};function ct(e){var t,n;if(e)return!0===e?at:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:at.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:at.bottomOpacity}}const ut={circle:M,square:F,triangle:N,diamond:L,star:P,cross:_,wye:j},dt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function ht(e,t,n){var o,i;if(n)return n;const r=null!=e?e:"circle";if("chevron"===r)return function(e){const t=1.5*ft(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);const s=null!==(o=ut[r])&&void 0!==o?o:M;return null!==(i=C(s,Math.max(1,t))())&&void 0!==i?i:""}function ft(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const gt=new Map;function pt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(pt))}function yt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function mt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function vt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=mt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=Ae(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:mt(e.y1Accessor,"y1"),getBottom:mt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class bt{constructor(e){if(this.xExtent=new fe,this.yExtent=new fe,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new he(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Ae(e.timeAccessor||e.xAccessor,"time"),this.getY=Ae(e.valueAccessor||e.yAccessor,"value")):(this.getX=Ae(e.xAccessor,"x"),this.getY=Ae(e.yAccessor,"y")),this.getGroup=Se(e.groupAccessor),this.getCategory=Se(e.categoryAccessor),this.getSize=e.sizeAccessor?Ae(e.sizeAccessor,"size"):void 0,this.getColor=Se(e.colorAccessor),this.getSymbol=Se(e.symbolAccessor),this.getY0=e.y0Accessor?Ae(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=vt(e),this.getPointId=Se(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?Ae(e.openAccessor,"open"):void 0,this.getHigh=Ae(e.highAccessor,"high"),this.getLow=Ae(e.lowAccessor,"low"),this.getClose=n?Ae(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new he(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Ae(this.config.timeAccessor||this.config.xAccessor,"time"):Ae(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&!p.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,O=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const S=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!S&&y.size>0)if(p.normalize)O=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(l=p.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)O=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let l=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),l+=s;const a=(r.get(e)||0)+s;r.set(e,a),a>i&&(i=a)}n.set(e.key,t),s.set(e.key,l)}const l=null!==(a=p.stackOrder)&&void 0!==a?a:"key",f=(e,t)=>t>e?-1:e>t?1:0;let g;if("insideOut"===l){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=s.get(t))&&void 0!==u?u:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):t.map(e=>e.key).sort(f);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=me(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const l=s-i,a=C?0:l>0?l*p.extentPadding:1;O=[i-a,s+a]}else O=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:O}}}else if("bar"===p.chartType&&p.binSize&&!S&&y.size>0){const[,e]=function(e,t,n,o,i){const r=ge(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);O=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!S&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;O=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!S&&O[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(O[0]>n&&(O[0]=n),n>O[1]&&(O[1]=n)),Number.isFinite(o)&&(O[0]>o&&(O[0]=o),o>O[1]&&(O[1]=o))}const e=O[1]-O[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(f=p.yExtent)||void 0===f?void 0:f[0],o=null===(g=p.yExtent)||void 0===g?void 0:g[1];O=[null!=n?O[0]:O[0]-t,null!=o?O[1]:O[1]+t],"log"!==p.yScaleType||O[0]>0||0>=b[0]||C||(O[0]=null!=n?O[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!S){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(O=[null!=e?e:O[0],null!=t?t:O[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];O[0]!==1/0&&O[1]!==-1/0||(O=[0,1]);const M="streaming"===p.runtimeMode,j=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(M)if("x"==("up"===(_=p.arrowOfTime)||"down"===_?"y":"x")){const t="right"===p.arrowOfTime?[j,e.width-j]:[e.width-j,j];this.scales={x:w().domain(x).range(t),y:w().domain(O).range([e.height-j,j])}}else{const t="down"===p.arrowOfTime?[j,e.height-j]:[e.height-j,j];this.scales={x:w().domain(O).range([j,e.width-j]),y:w().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):w().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[j,e.width-j]),y:t(p.yScaleType,O,[e.height-j,j])}}var _;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,bt.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=S().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),l=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):w().domain(t).range(n)},a=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:l(this.config.xScaleType,o,r[0]>r[1]?[e.width-a,a]:[a,e.width-a]),y:l(this.config.yScaleType,i,c?[a,e.height-a]:[e.height-a,a])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,l,a,c,u;const{config:d,scales:h}=this;if(!h)return[];if(d.customLayout){const u=null!==(n=d.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},f={data:t,scales:h,dimensions:{width:e.width,height:e.height,margin:u,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=d.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=d.themeCategorical)&&void 0!==i?i:Xe},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=d.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=d.layoutConfig)&&void 0!==r?r:{},selection:null!==(s=d.layoutSelection)&&void 0!==s?s:null};let g;try{g=d.customLayout(f)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(l=g.overlays)&&void 0!==l?l:null;const p=null!==(a=g.nodes)&&void 0!==a?a:[];if(this._customRestyle=g.restyle,this.hasCustomRestyle=!!g.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of p)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(p,null!==(c=d.layoutSelection)&&void 0!==c?c:null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:i}=e;pt(o)&&0===n.length&&yt(i,"overlay-only",`[semiotic] ${t} 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(e=>null==e.datum)&&yt(i,"null-datums",`[semiotic] ${t} 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.`)}({label:"customLayout",nodes:p,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),p}if(this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const f={scales:h,config:d,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(d.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=ot(e.ribbons);if(r.length>0&&i.push(...it(e,t,r)),n.length>0)for(const t of o)i.push(...rt(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=pe(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return lt(e,o,i),i}(f,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=ot(e.ribbons);if(r.length>0&&o.push(...it(e,t,r)),i.length>0)for(const t of n)o.push(...rt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=ye(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),l=ct(e.config.gradientFill);l&&(s.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return lt(e,n,o),o}(f,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=ot(e.ribbons);if(r.length>0&&o.push(...it(e,t,r)),i.length>0)for(const t of n)o.push(...rt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=ye(t.data,e.scales,e.getX,e.getY,r,n,t.key,s),l=ct(e.config.gradientFill);l&&(i.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=pe(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return lt(e,n,o),o}(f,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===l)a();else if("asc"===l||"desc"===l||"insideOut"===l){const t=new Map;for(const n of s){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],l=[];let a=0,c=0;for(const n of e)c>a?(r.push(n),a+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(l.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...l.reverse(),...r)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,s,l="zero"){var a,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let f;if(r){f=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(a=h.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=me(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],l=[],a=new Map;for(const n of d){let i=e.get(n)||0;const s=m.get(n);r&&(i/=f.get(n));const c=s+i,u=t.x(n);l.push([u,t.y(s)]),o.push([u,t.y(c)]),m.set(n,c),a.set(n,c)}y.set(n.key,a);const c={type:"area",topPath:o,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};lt(e,s,f,n)}return f}(f,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",c=e.getSymbol,u=e.config.symbolMap,d=new Map;let h=0;const f=e=>{const t=null==u?void 0:u[e];if(t)return t;let n=d.get(e);return n||(n=dt[h%dt.length],h++,d.set(e,n)),n};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(l&&e.getColor&&!t.fill){const o=e.getColor(n);o&&l.has(o)&&(t=Object.assign(Object.assign({},t),{fill:l.get(o)}))}const u=e.getPointId?e.getPointId(n)+"":void 0;if(c){const i=f(c(n)+""),s=be(n,e.scales,e.getX,e.getY,Math.PI*r*r,i,t,u);s&&o.push(s)}else{const i=ve(n,e.scales,e.getX,e.getY,r,t,u);i&&o.push(i)}}return o}(f,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),a=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=Ae(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,f]=e.scales.y.domain(),g=(d-u||1)/s,p=(f-h||1)/l,y=s*l;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const a=Math.min(Math.floor((i-u)/g),s-1),d=Math.min(Math.floor((r-h)/p),l-1);if(0>a||0>d)continue;const f=d*s+a;m[f]++;const y=c(o);v[f]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(a){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const w=x-b||1,k=n.width/s,A=n.height/l,O=e.config.showValues,S=e.config.heatmapValueFormat,C=[];for(let e=0;l>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(a){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/w;C.push(we(n*k,(l-1-e)*A,k,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*g,yCenter:h+(e+.5)*p,agg:a},O?{value:i,showValues:!0,valueFormat:S}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=Ae(e.config.valueAccessor,"value"),i=Oe(e.config.xAccessor,"x"),r=Oe(e.config.yAccessor,"y"),s=new Map,l=new Map,a=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);a[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),l.has(u)||l.set(u,l.size)}const u=s.size,d=l.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),f=Array.from(l.keys()),g=h.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){f.sort((e,t)=>e-t),l.clear();for(let e=0;f.length>e;e++)l.set(f[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(a[e]),r=l.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,f=b.get(h);let g;void 0!==f?g=f:(g=x++,b.set(h,g)),y[g]=h,m[g]=d,v[g]=n}let w=1/0,k=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(w>t&&(w=t),t>k&&(k=t))}if(!isFinite(w)||!isFinite(k))return[];const A=function(e){const t=e in Re?e:"blues";let n=gt.get(t);if(n)return n;n=Array(256);const o=$e(t);for(let e=0;256>e;e++)n[e]=o(e/255);return gt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(k-w||1),S=n.width/u,C=n.height/d,M=e.config.showValues,j=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;_.push(we(o*S,(d-1-(n-o)/u)*C,S,C,A[Math.min((t-w)*O+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:j}:void 0))}return _}(f,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=ge(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?r=e.barCategoryCache.order:(r=[...l,...s],e.barCategoryCache={key:a,order:r})}const s=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,a),i=Math.min(t.end,c);if(n>=i)continue;const h=l.x(n),p=l.x(i),y=Math.abs(p-h),m=y>f+1?f:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const a=l.y(n),c=l.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(xe(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:h},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=l.y(0),n=l.y(t.total);s.push(xe(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(f,t);return this._barCategoryCache=null!==(u=f.barCategoryCache)&&void 0!==u?u:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,f=c.stroke,g=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(f,t);case"waterfall":return function(e,t,n){var o,i,r,s,l,a,c;const u=[],d=e.scales,h=e.config.waterfallStyle,f=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===f.length)return u;const g=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(a=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),r=e.getY(o),s=x+r;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=d.x(i),c=0!==l?d.x(i+l):a+n.width/10,w=Math.min(a,c)+y/2,k=Math.max(a,c)-y/2-w;if(0>=k){x=s;continue}const A=d.y(x),O=d.y(s),S=Math.min(A,O),C=Math.abs(A-O),M={fill:0>r?p:g,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(xe(w,S,k,C,M,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(f,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},l=s.rangeColor||"#6366f1",a=i?l:s.upColor||"#28a745",c=i?l:s.downColor||"#dc3545",u=i?l:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}f=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else f=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const l=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[l,h].some(e=>null==e||Number.isNaN(e)))continue;const g=h>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(f,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Qe(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const l=s.get(t[n]);null!=l?(o[n]=Qe(e,l,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let l=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=Qe(e,o,r),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=Qe(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const l=Qe(e,t,r);if("heatcell"===n.type)n.style={opacity:l};else if("candlestick"===n.type)n._decayOpacity=l;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*l})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const l=Ze(e,r,s);l>i&&(i=l)}i>0&&(n._pulseIntensity=i,n._pulseColor=l);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Ze(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=l,n._pulseGlowRadius=a)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=et(e,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=et(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,w,k,A,O,S,C,M,j,_,P,L,N,F,B,T,H,W,D,I,z,E,R,$,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=et(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const L=o.get(P);if("point"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(g=L.w)&&void 0!==g?g:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,V=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,V=!0)}else r._targetOpacity=null!==(k=null===(w=r.style)||void 0===w?void 0:w.opacity)&&void 0!==k?k:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){q.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(O=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==O?O:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(M=L.lowY)&&void 0!==M?M:r.lowY,V=!0)}else r._targetOpacity=null!==(_=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!q.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(N=t.r)&&void 0!==N?N:3,style:{opacity:null!==(F=t.opacity)&&void 0!==F?F:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==(T=t.h)&&void 0!==T?T:0,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(W=t.w)&&void 0!==W?W:0,h:null!==(D=t.h)&&void 0!==D?D:0,fill:"#999",datum:null,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(z=t.openY)&&void 0!==z?z:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(E=t.closeY)&&void 0!==E?E:o,highY:null!==(R=t.highY)&&void 0!==R?R:o,lowY:null!==($=t.lowY)&&void 0!==$?$:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,l,a,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Je(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Je(n.x,e._targetX,d),e.y=Je(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Je(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Je(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Je(n.x,e._targetX,d),e.y=Je(n.y,e._targetY,d),void 0!==n.w&&(e.w=Je(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Je(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Je(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Je(n.x,e._targetX,d),e.y=Je(n.y,e._targetY,d),void 0!==n.w&&(e.w=Je(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Je(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Je(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Je(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Je(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Je(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Je(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Je(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Je(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Je(t[o][0],n[o][0],d),e.path[o][1]=Je(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Je(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Je(t[n][0],o[n][0],d),e.topPath[n][1]=Je(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Je(n[t][0],i[t][0],d),e.bottomPath[t][1]=Je(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(this._groupDataCache&&this._groupDataCache.version===this._ingestVersion&&this._groupDataCache.group===this.getGroup&&this._groupDataCache.data===e)return this._groupDataCache.result;let t;if(this.getGroup){const n=new Map;for(const t of e){const e=this.getGroup(t);n.has(e)||n.set(e,[]),n.get(e).push(t)}t=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else t=[{key:"_default",data:e}];return this._groupDataCache={version:this._ingestVersion,group:this.getGroup,data:e,result:t},t}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Xe,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||Xe;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>bt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},s=i(r,t);r.style=s?Object.assign(Object.assign({},e),s):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!ke(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!ke(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Ae(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Ae(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Ae(this.config.xAccessor,"x"),this.getY=Ae(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=vt(this.config)),s=!0,l=!0)}if("groupAccessor"in e&&!ke(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Se(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!ke(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Se(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!ke(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Ae(this.config.sizeAccessor,"size"):void 0,s=!0),"symbolAccessor"in e&&!ke(e.symbolAccessor,r.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Se(this.config.symbolAccessor):void 0,s=!0),"colorAccessor"in e&&!ke(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Se(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!ke(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Ae(this.config.y0Accessor,"y0"):void 0,s=!0,l=!0),("boundsAccessor"in e&&!ke(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=vt(this.config),s=!0,l=!0),"pointIdAccessor"in e&&!ke(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Se(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!ke(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!ke(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!ke(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!ke(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Ae(this.config.openAccessor,"open"):void 0,this.getHigh=Ae(this.config.highAccessor,"high"),this.getLow=Ae(this.config.lowAccessor,"low"),this.getClose=t?Ae(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,l=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function xt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}bt.GROUP_COLOR_MAP_CAP=1e3,bt.QUADTREE_THRESHOLD=500;const wt={isActive:!1,predicate:()=>!0},kt=o.createContext(null);function At({value:t,children:n}){return e(kt.Provider,{value:t,children:n})}function Ot(){var e;return null!==(e=o.useContext(kt))&&void 0!==e?e:wt}function St(t,n){return null!=t?e(At,{value:n,children:t}):t}function Ct(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>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 Mt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function jt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function _t(e,t){const n=jt(e);if(!n)return!1;const o=jt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}const Pt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Lt=new WeakMap;let Nt=0,Ft=!1,Bt=null,Tt=null,Ht=null;function Wt(e,t){var n,o;if(!t)return t;const i=Pt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ft)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ft=!0;const e=()=>{Nt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Bt=new MutationObserver(e),Bt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Tt=window.matchMedia("(prefers-color-scheme: dark)"),Ht=e,"function"==typeof Tt.addEventListener?Tt.addEventListener("change",Ht):"function"==typeof Tt.addListener&&Tt.addListener(Ht)}catch(e){}}();let s=Lt.get(r);s&&s.version===Nt||(s={version:Nt,map:new Map},Lt.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}function Dt(e){switch(e){case"monotoneX":return R;case"monotoneY":return E;case"cardinal":return z;case"catmullRom":return I;case"step":return D;case"stepBefore":return W;case"stepAfter":return H;case"basis":return T;case"natural":return B;default:return null}}function It(e,t,n){return null==t?n:"string"!=typeof t?t:Wt(e,t)||n}function zt(e,t,n,o,i,r,s){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 l=e.createLinearGradient(o,i,r,s);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),u=Math.max(0,Math.min(1,a)),d=e.createLinearGradient(o,i,r,s),[h,f,g]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function Et(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}const Rt=new WeakMap;function $t(e,t){const n=Dt(t);if(!n)return e;const o=Rt.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,s,l,a){if(!i)return i=[l,a],void o.push([l,a]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*l,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return $().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return Rt.set(e,i),i}function Yt(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,l=e=>e.r){const a=Math.max(o,i+5,12),c=t-a,u=t+a,d=n-a,h=n+a;let f=null,g=1/0;return e.visit((e,i,a,p,y)=>{if(i>u||c>p||a>h||d>y)return!0;if(!e.length){let i=e;do{const e=i.data,a=r(e)-t,c=s(e)-n,u=Math.sqrt(a*a+c*c);Mt(l(e),o)>=u&&g>u&&(f=e,g=u),i=i.next}while(i)}return!1}),f?{node:f,distance:g}:null}(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=Xt(r,t,n,o);break;case"symbol":e=Vt(r,t,n,o);break;case"line":e=qt(r,t,n,o);break;case"rect":if(null==r.datum)break;e=Kt(r,t,n);break;case"heatcell":e=Qt(r,t,n);break;case"area":if(!1===r.interactive)break;e=Jt(r,t,n);break;case"candlestick":e=Zt(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Gt(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=en(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,l]=e[i],[a,c]=e[r];return a===s?l:l+Math.max(0,Math.min(1,(t-s)/(a-s)))*(c-l)}function Xt(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Mt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Vt(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Mt(ft(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function qt(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const s=en(e.path,t);if(0>s)return null;const[l,a]=e.path[s];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[l,a]=e.path[s+1],c=Ut(t,n,i,r,l,a);o>c&&(o=c)}c=o}else{const e=t-l,o=n-a;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:l,y:a,distance:c}}function Ut(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Kt(e,t,n){const o=Ct(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Qt(e,t,n){const o=Ct(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Zt(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function Jt(e,t,n){if(0===e.topPath.length)return null;const o=en(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,l=n-r,a=Math.sqrt(s*s+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:a}}function en(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function tn(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function nn(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const on={fresh:1,aging:.7,stale:.45,expired:.25},rn={alpha:1,band:"fresh",isStale:!1};function sn(e,t){var n,o;if(!e||0>=t)return rn;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){var o,i,r;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const s=null!==(o=n.fresh)&&void 0!==o?o:1,l=null!==(i=n.aging)&&void 0!==i?i:1.5,a=null!==(r=n.stale)&&void 0!==r?r:3;return t*s>e?"fresh":t*l>e?"aging":t*a>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},on),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:rn}function ln({isStale:t,position:n}){return e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{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"})}const an={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function cn(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,an[n])(o(e,t),i),r}function un({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function dn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const hn=(n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=s,{swatchSize:x,labelGap:w,rowHeight:k}=h;return p.forEach((n,d)=>{const h=cn(n,d,f,g,x),A=dn(n,r,s),O=s&&s.size>0&&s.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===l&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+w+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(un,{swatchSize:x}),e("text",{y:x/2,x:x+w,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=k}),y};function fn({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:l,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(l[0]+n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(l[1]-n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])})]})}function gn(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical",legendLayout:g}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:l,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),w="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:hn(t,o,i,r,s,l,a,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var g;let p=0;const y=[];n.forEach((n,o)=>{var g;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,l,a,c,u,d,h,f)=>{const{type:g="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:w,align:k}=h,A=!(!o&&!i),O="isolate"===d||void 0===d&&null!=s,S=y.map(e=>v+b+7*e.label.length),C=[];let M=0,j=0;S.forEach((e,t)=>{const n=0===j?e:j+x+e;f&&f>0&&j>0&&n>f?(C.push({start:M,end:t,width:j}),M=t,j=e):j=n}),y.length>0&&C.push({start:M,end:y.length,width:j}),C.forEach((n,d)=>{let h="center"===k?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===k?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=y[f],k=cn(n,f,g,p,v),C=dn(n,r,s),M=s&&s.size>0&&s.has(n.label);m.push(t("g",{transform:`translate(${h},${d*w})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===l&&f===a?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&O?M||!1:void 0,"aria-current":A&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,f),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,M&&e(un,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=S[f]+x}});const _=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:_,totalRows:P,totalHeight:P*w}})(n,r,s,l,a,c,u,o,d,h,f,null!==(g=f.maxWidth)&&void 0!==g?g:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(g=f.maxWidth)&&void 0!==g?g:i;let v=p>m?0:"center"===f.align?Math.max(0,(m-p)/2):"end"===f.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),k=!(!r&&!s);return t("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),w]})}function pn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function yn(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const p="top"===l||"bottom"===l,y=!!c,m=Math.max(1,p?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-m-10),b=s.top):"top"===l?(v=s.left,b=y?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(fn,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):pn(o)?e(gn,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function mn(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function vn(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function bn(e){return"string"==typeof e?{type:e}:e}function xn({orient:n,config:o,values:i,scale:s,size:l,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=s.domain(),r=l-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:l,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,g=Math.min(.5*r,20),p=(r-g)/2+4;if(u){const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+g/2),x2:y,y2:v+m*(p+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-g:v+p,width:Math.abs(i-o),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-g:v+p,x2:r,y2:"top"===n?v-p:v+p+g,stroke:c.fill,strokeWidth:2})]})}{const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+g/2),y1:u,x2:v+m*(p+g/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+g),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-g:v+p,y:Math.min(o,i),width:g,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-g:v+p,y1:r,x2:"left"===n?v-p:v+p+g,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=X().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=vn(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(l,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+l),width:i,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),l=s((e.x0+e.x1)/2);o.push(u?`${l},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${l}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const l=i.length/h*(r/2),a=s((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function wn(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function kn(e,t,n,o){return"curly"===e?o?`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`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function An(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:l,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!l)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let g="start";"topBottom"===h?"right"===f?g="end":"middle"===f&&(g="middle"):g=0>o?"end":"start";const p=16,y=l?d?[l]:wn(l,u):[],m=s?d?[s]:wn(s,u):[],v="leftRight"===h?"end"===g?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";n.useHTML||n.html?(x.push(e("foreignObject",{className:"annotation-note-html",x:"end"===g?v-u:"middle"===g?v-u/2:v,y:-16,width:u,height:Math.max(p,(y.length+m.length)*p+(l&&s?2:0))+p,style:{overflow:"visible"},children:t("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:w,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===g?"right":"middle"===g?"center":"left",whiteSpace:d?"nowrap":"normal",wordBreak:"break-word"},children:[l&&e("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:l}),s&&e("div",{className:"annotation-note-label",children:s})]})},"annotation-note-html")),b=y.length*p):(y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:w,textAnchor:g,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:w,textAnchor:g,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label")));let k=null;if((l||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===f?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function On(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e("path",{d:kn((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:l})}function Sn(t,n,o,i,r,s){var l;const a=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+s*h,u=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else a.push(e("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;a.push(e("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e("g",{className:"annotation-connector",children:a})}function Cn(e){var n,o;const{x:i=0,y:r=0,dx:s,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:g,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=e,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,A=new Set(Array.isArray(y)?y:[]);let O=s||0,S=l||0;null!=a&&(O=a-w),null!=c&&(S=c-k);const C="string"==typeof f?f:"label";if("bracket"===C&&h&&0===O&&0===S)if(void 0!==h.width){O=h.width/2;const e=h.depth||30;S=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;O=e+(0>e?-5:5),S=h.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&Sn(O,S,d,g,C,h),!A.has("subject")&&On(C,h,g,w,k),!A.has("note")&&An(u,O,S,g)]}))}function Mn(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e(Cn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Cn,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function jn(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function _n(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Pn(e){return null==e?null:e+""}function Ln(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Nn(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Ln(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?Ln(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Pn(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Pn(e.pointId)===r);if(s)return Ln(t,n,{x:s.x,y:s.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Pn(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!l)return null;const a=jn(l,n),c=_n(l,n);return null==a||null==c?null:Ln(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let s=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,l=t.y)}if(null!=s&&null!=l||(s=jn(e,n),l=_n(e,n)),null!=s&&null!=l)return Ln(t,n,{x:s,y:l});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Fn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Bn={secondary:0,primary:3};function Tn(e){return!0===(null==e?void 0:e._annotationDeferred)}function Hn(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function Wn(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function Dn(e){return Math.max(.72,.95-.06*e)}const In={linear:G,monotoneX:R,monotoneY:E,step:D,stepAfter:H,stepBefore:W,basis:T,cardinal:z,catmullRom:I};const zn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function En(e){return!!e&&"object"==typeof e&&zn.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function Rn(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function $n(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 Yn(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const Gn=32,Xn=6,Vn=4,qn=8,Un=72;const Kn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Qn(e){return En(e)}function Zn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function Jn(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function eo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function to(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 no(e,t,n,o,i,r,s,l){const a=eo(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,l);for(const e of n)c+=12*to(a,e);for(const e of o)c+=4*to(a,e);return c}function oo(e){var t;const{annotations:n,context:o,defaultOffset:i=Gn,notePadding:r=Xn,markPadding:s=Vn,edgePadding:l=qn,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Un,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:g,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=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}})}(o,s);let w=!1;const k=n.map((e,t)=>{if(!Qn(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o: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 s=e.coordinates,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&l){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=l([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?Nn(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=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=[...Zn("string"==typeof e.title?e.title:void 0,t),...Zn("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("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 b.push(eo(Jn(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),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}]}(i)){const t=no(Jn(n.x,n.y,e.dx,e.dy,s),e,b,x,m,v,r,l);f>t&&(h=e,f=t)}if(!h)return e;const g=eo(Jn(n.x,n.y,h.dx,h.dy,s),r);b.push(g);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=w?k:n.slice();let O=A;if(f){let e=!1;const t=A.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:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});O=e?t:A}{let e=!1;const t=O.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=Kn[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});O=e?t:O}const S=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0: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}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:$n(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=$n(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,En(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||s>=a.length)return{visible:n.slice(),deferred:[],budget:s};const c=a.filter(e=>Rn(e.annotation)),u=a.filter(e=>!Rn(e.annotation)).sort((e,t)=>Yn(t.annotation)-Yn(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],g=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):g.push(e);return{visible:f,deferred:g,budget:s}}(Object.assign({annotations:O,width:m,height:v},o));for(const e of i)S.add(e)}if(g&&("object"==typeof g&&"number"==typeof g.minWidth?g.minWidth:480)>=m)for(const e of O)Qn(e)&&"secondary"===e.emphasis&&S.add(e);if(S.size>0)for(const e of O)!0===(null==e?void 0:e.defensive)&&S.delete(e);let C;return C=0===S.size?O:h?O.map(e=>S.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):O.filter(e=>!S.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>Qn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(C,p):C}let io={positions:new Map};const ro=new Set;function so(){for(const e of ro)e()}function lo(e,t){const n=io.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(io.positions);o.delete(e),io={positions:o},so()}function ao(e,t){const n=io.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(io.positions);o.delete(e),io={positions:o},so()}function co(){return io}function uo(e){return ro.add(e),()=>ro.delete(e)}const ho={positions:new Map};function fo(){return()=>{}}function go(){return ho}function po(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function yo(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function mo(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function vo(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function bo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function xo(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function wo(n){const{width:o,height:i,totalWidth:s,totalHeight:l,margin:a,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:f,yFormat:g,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||f||ko,r=Math.max(2,Math.floor(o/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:po(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),a=l.map(e=>e.valueOf()),u=l.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,a)})),h=u.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Ao(u,Math.max(55,h+8))},[c,d,f,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||g||ko,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return Ao((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:po(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,g,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),w=null==d?void 0:d.find(e=>"left"===e.orient),k=b&&(!x||!1!==x.baseline),A=b&&(!w||!1!==w.baseline),O=(null==x?void 0:x.jaggedBase)||!1,S=(null==w?void 0:w.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${a.left},${a.top})`,children:[v&&(()=>{var n,r;const s=bo(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),l=bo(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:l},"ygrid-"+n))]})})(),k&&!O&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:xo("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:xo("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function ko(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ao(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Oo(l){var a,u;const{width:d,height:h,totalWidth:f,totalHeight:g,margin:p,scales:y,showAxes:m,axes:v,xLabel:b,yLabel:x,yLabelRight:w,xFormat:k,yFormat:A,axisExtent:O,showGrid:S,title:C,legend:M,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:P,legendIsolatedCategories:L,legendPosition:N="right",legendLayout:F,foregroundGraphics:B,marginalGraphics:T,xValues:H,yValues:W,annotations:D,autoPlaceAnnotations:I,svgAnnotationRules:z,xAccessor:E,yAccessor:R,annotationData:$,pointNodes:X,curve:U,underlayRendered:K,canvasObscuresUnderlay:Q=!0,linkedCrosshairName:Z,linkedCrosshairSourceId:J,children:ee}=l,te=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||ko,i=Math.max(2,Math.floor(d/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:po(y.x,"exact"===O?Math.max(2,r):Math.min(r,i),O),l=s.map(e=>e.valueOf()),a=s.map((e,t)=>({value:e,pixel:y.x(e),label:o(e,t,l)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),u=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=Ao(a,u);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==O&&!(null==n?void 0:n.tickValues)){const e=y.x.domain()[1],t=y.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,l);u>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[m,y,v,k,d,O]),ne=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||A||ko,i=Math.max(2,Math.floor(h/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=Ao((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:po(y.y,"exact"===O?Math.max(2,r):Math.min(r,i),O)).map(e=>({value:e,pixel:y.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==O&&!(null==n?void 0:n.tickValues)){const e=y.y.domain()[1],t=y.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[m,y,v,A,h,O]),oe=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||A||ko,i=Math.max(2,Math.floor(h/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Ao((null!==(t=n.tickValues)&&void 0!==t?t:po(y.y,"exact"===O?Math.max(2,r):Math.min(r,i),O)).map(e=>({value:e,pixel:y.y(e),label:o(e)})),22)},[m,y,v,A,h,O]),ie=i(new Map),re=i(null!==(a=null==D?void 0:D.length)&&void 0!==a?a:0),se=null!==(u=null==D?void 0:D.length)&&void 0!==u?u:0;re.current!==se&&(re.current=se,ie.current=new Map);const le=r(()=>{if(!D||0===D.length)return null;const n=function(n,i,r){var s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,w,k,A,O,S,C,M,j,_,P,L,N,F,B,T,H,W,D,I,z,E,R,$,X,U,K,Q,Z,J,ee,te,ne,oe,ie,re,se;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Nn(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!Fn(o,c,r))return null;const u="callout"===n.type?"callout-circle":n.type,d="callout-circle"===u?{radius:null!==(s=n.radius)&&void 0!==s?s:12,radiusPadding:n.radiusPadding}:"callout-rect"===u?{width:n.width,height:n.height}:void 0;return e(Mn,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(l=n.dx)&&void 0!==l?l:30,dy:null!==(a=n.dy)&&void 0!==a?a:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:u},d?{subject:d}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=jn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const s=n.color||"#f97316",l=n.labelPosition||"top";let a;a="bottom"===l?(r.height||0)-4:"center"===l?(r.height||0)/2:12;const c=o>.6*(r.width||0),u=c?o-4:o+4,d=c?"end":"start";return t("g",{opacity:n.opacity,children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:u,y:a,textAnchor:d,fill:s,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=_n(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const s=n.color||"#f97316",l=n.labelPosition||"right";let a,c;return"left"===l?(a=4,c="start"):"center"===l?(a=(r.width||0)/2,c="middle"):(a=(r.width||0)-4,c="end"),t("g",{opacity:n.opacity,children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:o-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:jn(Object.assign(Object.assign({},e),{type:"point"}),r),y:_n(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=V(o),l=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+l,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-l-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:jn(Object.assign(Object.assign({},e),{type:"point"}),r),y:_n(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=n.padding||10,l=o.map(e=>e.x),a=o.map(e=>e.y),[c,u]=mn(l),[d,h]=mn(a),f=c-s,g=u+s,p=d-s;return t("g",{children:[e("rect",{x:f,y:p,width:g-f,height:h+s-p,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(f+g)/2,y:p-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=jn(t,r),l=_n(t,r);if(null==i||null==l)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:i,cy:l,r:a},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=jn(n,r),o=_n(n,r);return e(Mn,{noteData:{x:null!=t?t:0,y:null!=o?o:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const o=r.data||[];if(2>o.length)return null;const s=r.xAccessor||"x",l=r.yAccessor||"y",a="ordinal"===r.frameType,y="horizontal"===r.projection,m=a?s:null,v=a?l:null;let b;const x=[],w=new Map;if(a&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[s],e[l]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=r.scales)||void 0===d?void 0:d.time,A=null!==(f=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(g=r.scales)||void 0===g?void 0:g.value;if(!k||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,C=A;let M;if(a)if(y){const e=O(C);M=(t,n)=>[S(n),e(t)]}else{const e=O(S);M=(t,n)=>[e(t),C(n)]}else M=(e,t)=>[S(e),C(t)];const j=n.method||"linear";let _;_="loess"===j?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))l.push([t,h/u]);else{const e=(u*g-d*h)/p;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(p=n.bandwidth)&&void 0!==p?p:.3):("polynomial"===j?q.polynomial(b,{order:n.order||2}):q.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",N=_[_.length-1],[F,B]=M(N[0],N[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:F+4,y:B-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,s=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,l=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{opacity:n.opacity,children:[e("rect",{x:0,y:Math.min(s,l),width:r.width||0,height:Math.abs(l-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.max(Math.min(s,l),0)+13,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const s=r.xAccessor||"x",l=null!==(k=null===(w=r.scales)||void 0===w?void 0:w.x)&&void 0!==k?k:null===(A=r.scales)||void 0===A?void 0:A.time,a=null!==(S=null===(O=r.scales)||void 0===O?void 0:O.y)&&void 0!==S?S:null===(C=r.scales)||void 0===C?void 0:C.value;if(!l||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const f=In[r.curve||"linear"]||G,g=Y().x(e=>l(e[s])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!g)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:g,fill:p,fillOpacity:null!==(M=n.fillOpacity)&&void 0!==M?M:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:l(h[h.length-1][s])+4,y:a(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const s=r.yAccessor||"y",l=null!==(_=null===(j=r.scales)||void 0===j?void 0:j.x)&&void 0!==_?_:null===(P=r.scales)||void 0===P?void 0:P.time,a=null!==(N=null===(L=r.scales)||void 0===L?void 0:L.y)&&void 0!==N?N:null===(F=r.scales)||void 0===F?void 0:F.value;if(!l||!a)return null;const c=o.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(B=n.threshold)&&void 0!==B?B:2,g=u-f*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(T=n.fillOpacity)&&void 0!==T?T:.1,v=n.anomalyColor||"#ef4444",b=null!==(H=n.anomalyRadius)&&void 0!==H?H:6,x=a(u+f*h),w=a(g),k=o.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,w),width:r.width||0,height:Math.abs(w-x),fill:y,fillOpacity:m}),k.map((t,n)=>{const o=jn(t,r),i=_n(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const s=r.xAccessor||"x",l=r.yAccessor||"y",a=null!==(D=null===(W=r.scales)||void 0===W?void 0:W.x)&&void 0!==D?D:null===(I=r.scales)||void 0===I?void 0:I.time,c=null!==(E=null===(z=r.scales)||void 0===z?void 0:z.y)&&void 0!==E?E:null===(R=r.scales)||void 0===R?void 0:R.value;if(!a||!c)return null;const u=o.map(e=>[e[s],e[l]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;d=e=>l+s*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(f/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==($=n.confidence)&&void 0!==$?$:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(X=n.steps)&&void 0!==X?X:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=d(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),C=`${a(x)},${c(d(x))}`,M=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(U=n.fillOpacity)&&void 0!==U?U:.15,stroke:"none"}),e("polyline",{points:`${C} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(K=n.strokeWidth)&&void 0!==K?K:2,strokeDasharray:null!==(Q=n.strokeDasharray)&&void 0!==Q?Q:"6,3"}),n.label&&A.length>0&&e("text",{x:a(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:M,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=Nn(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!Fn(t,o,r))return null;const s=null!==(Z=n.dx)&&void 0!==Z?Z:0,l=null!==(J=n.dy)&&void 0!==J?J:0,a=null!==(ee=n.width)&&void 0!==ee?ee:32,c=null!==(te=n.height)&&void 0!==te?te:32,u=null!==(ne=n.content)&&void 0!==ne?ne:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-a/2,y:o+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const s=Nn(n,i,r);if(!s)return null;const{x:l,y:a}=s,c=l+(n.dx||0),u=a+(n.dy||0),d=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:u,fill:d,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:l,y1:a,x2:c,y2:u,stroke:d,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,l=null===(oe=r.scales)||void 0===oe?void 0:oe.o,a=null===(ie=r.scales)||void 0===ie?void 0:ie.x,c=null===(re=r.scales)||void 0===re?void 0:re.y,u=s(l)?l:s(a)?a:s(c)?c:null;if(!u)return null;const d=u(o+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(se=n.opacity)&&void 0!==se?se:.15,p=n.label;return t("g",(r.projection?"vertical"===r.projection:u===a)?{children:[e("rect",{x:d,y:0,width:h,height:r.height||0,fill:f,fillOpacity:g}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:r.width||0,height:h,fill:f,fillOpacity:g}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+i)}default:return null}},i={scales:y?{x:y.x,y:y.y,time:y.x,value:y.y}:null,timeAxis:"x",xAccessor:E,yAccessor:R,width:d,height:h,data:$,frameType:"xy",pointNodes:X,curve:U,stickyPositionCache:ie.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:Wn(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Tn(e.annotation)),r=t.some(e=>null!=Hn(e.annotation)),s=t.some(e=>"layer"===Hn(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=Bn[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=Tn(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;l=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Dn(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Hn(n.annotation);return a&&(l=e("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),s&&(l=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e("style",{children:".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}}"},"annotation-disclosure-style")),s&&a.unshift(e("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")),a}(r)}(I?oo(Object.assign({annotations:D,context:i},"object"==typeof I?I:{})):D,n,z,i)},[D,I,z,d,h,E,R,$,y,X,U]),ae=function(e){var t;const n=c(e?uo:fo,e?co:go,e?co:go);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(Z);return s(()=>{if(!(null==ae?void 0:ae.locked)||!Z)return;const e=e=>{"Escape"===e.key&&ao(Z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ae?void 0:ae.locked,Z]),m||C||M||B||T||le&&le.length>0||S||ee||ae?t("svg",{role:"img",width:f,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof C?C:"XY Chart"}),e("desc",{children:"string"==typeof C?C+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[S&&y&&(!K||Q)&&(()=>{var n,o;const i=bo(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=bo(null===(o=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[te.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:h,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),ne.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:d,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),m&&y&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),o=null==v?void 0:v.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,s=(null==n?void 0:n.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,a=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,u="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&te.length>1&&(()=>{const e=d/Math.max(te.length-1,1);return te.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),m={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,S=null==n?void 0:n.tickAnchor,C=vo(te),M=vo(ne);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!K||Q)&&r&&!l&&e("line",{x1:0,y1:h,x2:d,y2:h,stroke:u,strokeWidth:1}),(!K||Q)&&l&&e("path",{d:xo("bottom",d,h),fill:"none",stroke:u,strokeWidth:1}),te.map((n,o)=>{const i=!!a&&("function"==typeof a?a(n.value,o):_t(n.value,o>0?te[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${h})`,children:[e("line",{y2:5,stroke:u,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":yo(O,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:m),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},m),children:n.label})})]},"xtick-"+o)}),b&&e("text",{x:d/2,y:h+40,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:b})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!K||Q)&&i&&!s&&e("line",{x1:0,y1:0,x2:0,y2:h,stroke:u,strokeWidth:1}),(!K||Q)&&s&&e("path",{d:xo("left",d,h),fill:"none",stroke:u,strokeWidth:1}),ne.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):_t(n.value,o>0?ne[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:u,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:mo(S,n.pixel===M.min,n.pixel===M.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:m),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},m),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||x;return t?e("text",{x:15-p.left,y:h/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-p.left}, ${h/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===oe.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||w,s=n.tickAnchor,l=vo(oe);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:d,y1:0,x2:d,y2:h,stroke:u,strokeWidth:1}),oe.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):_t(n.value,o>0?oe[o-1].value:void 0));return t("g",{transform:`translate(${d},${n.pixel})`,children:[e("line",{x2:5,stroke:u,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:mo(s,n.pixel===l.min,n.pixel===l.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?k:m),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},m),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:d+p.right-15,y:h/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${d+p.right-15}, ${h/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),le,T&&y&&H&&W&&t(n,{children:[T.top&&e("g",{transform:"translate(0, 0)",children:e(xn,{orient:"top",config:bn(T.top),values:H,scale:y.x,size:p.top,length:d})}),T.bottom&&e("g",{transform:`translate(0, ${h})`,children:e(xn,{orient:"bottom",config:bn(T.bottom),values:H,scale:y.x,size:p.bottom,length:d})}),T.left&&e("g",{transform:"translate(0, 0)",children:e(xn,{orient:"left",config:bn(T.left),values:W,scale:y.y,size:p.left,length:h})}),T.right&&e("g",{transform:`translate(${d}, 0)`,children:e(xn,{orient:"right",config:bn(T.right),values:W,scale:y.y,size:p.right,length:h})})]}),B,ae&&ae.sourceId!==J&&(null==y?void 0:y.x)&&(()=>{const t=y.x(ae.xValue);if(null==t||0>t||t>d)return null;const n=ae.locked;return e("line",{x1:t,y1:0,x2:t,y2:h,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),ee]}),C&&e("text",{x:f/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof C?C:null}),yn({legend:M,totalWidth:f,totalHeight:g,margin:p,legendPosition:N,title:C,legendLayout:F,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:P,legendIsolatedCategories:L})]}):null}function So(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Co(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Mo="undefined"==typeof window||"undefined"==typeof document,jo="undefined"!=typeof window?h:s,_o=()=>()=>{},Po=()=>!1,Lo=()=>!0;function No(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Fo(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Bo(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const To=o.createContext(null),Ho={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Wo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Do=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Io(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const zo="semiotic-accessible-data-table",Eo=zo+" semiotic-accessible-data-table-hidden",Ro=zo+" semiotic-accessible-data-table-visible",$o={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"},Yo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Go={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)"},Xo={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Vo={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))"},qo={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Uo={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ko={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 Qo({scene:n,chartType:i,tableId:r,chartTitle:s}){var l;const[a,c]=o.useState(!1),[u,d]=o.useState(5),h=o.useContext(To),f=null!==(l=null==h?void 0:h.visible)&&void 0!==l&&l,g=a||f,p=o.useRef(null),y=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{g||d(5)},[g]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(a||f||c(!0))},[a,f]),v=o.useCallback(e=>{var t;f||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[f]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Ho}):null;if(!g)return e("div",{id:r,className:Eo,tabIndex:-1,onFocus:m,style:Ho,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Io(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:Io(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=Io(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Io(x.datum)});break;case"arc":v.push({label:"Arc",values:Io(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Io(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(g=x.datum)||void 0===g?void 0:g.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(n),x=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 o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(b),w=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Do(e.min)} to ${Do(e.max)}, mean ${Do(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(b.length,x),k=Math.min(u,b.length),A=b.slice(0,k),O=b.length-k,S=new Set;for(const e of A)for(const t of Object.keys(e.values))S.add(t);const C=Array.from(S);return t("div",{ref:p,id:r,className:Ro,tabIndex:-1,onBlur:v,style:$o,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{f&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Go,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Yo,children:w}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Xo,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Uo,children:O>0?`First ${k} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:Vo,children:"type"}),C.map(t=>e("th",{style:Vo,children:t},t))]})}),e("tbody",{children:A.map((n,o)=>t("tr",{children:[e("td",{style:qo,children:n.label}),C.map(t=>{return e("td",{style:qo,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Do(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),O>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>d(e=>e+25),style:Ko,children:["Show ",Math.min(25,O)," more"," ",1===O?"row":"rows"," (",O," remaining)"]})]})}function Zo({summary:t}){return t?e("div",{role:"note",style:Ho,children:t}):null}function Jo({tableId:t}){return e("a",{href:"#"+t,style:Ho,onClick:e=>{e.preventDefault();const n=document.getElementById(t);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,Ho)},children:"Skip to data table"})}function ei({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Ho,children:n})}const ti="var(--semiotic-focus, #005fcc)";function ni({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:ti,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:ti,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:ti,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function oi(e){return Array.isArray(e)?e[0]:e}function ii(e,t,n,o){return Object.assign({data:oi(e),x:t,y:n,__semioticHoverData:!0},o)}const ri={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 si(e,t){return"function"==typeof t?t(e):e[t]}function li(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 ai(n={}){const{fields:o,title:i,format:r,style:s={},className:l=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=si(n,i);a=li(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=si(n,o);c.push({label:t,value:li(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=li(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=li(n[e[0]],r))}}const u=Object.assign(Object.assign({},ri),s);return t("div",{className:("semiotic-tooltip "+l).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function ci(){return n=>{var o,i,r,s,l,a,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:ri,children:e("div",{children:li(t)})})}const d=null!==(a=null!==(s=n.xValue)&&void 0!==s?s:null===(l=n.data)||void 0===l?void 0:l.time)&&void 0!==a?a:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:ri,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:li(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:li(n.value)})]},o))]})}}function ui(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let i=oi(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t);("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:ri,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?ai(t):ai())}}function di({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:l,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,a,i,r]);let g;g=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(l),y=p?null:ri;return u?e("div",{ref:d,className:p?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:l}):null}function hi(e,t,n){const o=i(null),[r,l]=d(null);return s(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const fi="undefined"==typeof window?s:h;function gi(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pi(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,c]=hi(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,f=c[1]-u.top-u.bottom,g=gi(e.foregroundGraphics,c,u),p=gi(e.backgroundGraphics,c,u),y=de(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),w=i(()=>{}),k=a(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),O=i(()=>{}),S=i(null),C=i(0),M=a(()=>{C.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),j=a(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(M))},[M]),_=a(()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),O.current()},[]);s(()=>()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return fi(()=>{P&&(Nt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:u,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:j,onPointerLeave:_}}function yi(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function mi(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function vi(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const bi=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const a=l._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=l.style.stroke||"#007bff",u=Wt(e,c)||c,d=l.style.strokeWidth||2,h=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=d,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const m=null!==(i=l.style.opacity)&&void 0!==i?i:1;vi(e,l.path,u,d,m,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=Dt(l.curve),p=h&&h.length>0&&f&&f.length===l.path.length,y=l._decayOpacities;if(y&&y.length===l.path.length&&!p){e.strokeStyle=u;const v=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(p){let x=null,w=null,k=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function C(){O&&(e.stroke(),O=!1)}for(let M=0;l.path.length>M;M++){const[j,_]=l.path[M],P=f[M],L=mi(P,h,u);if(null!==x&&null!==A&&null!==k){if(L===A)e.lineTo(j,_);else{const N=[];for(const F of h){const B=F.value;(k>B||B>P)&&(B>k||P>B)||k===B||P===B||N.push({t:(B-k)/(P-k)})}N.sort((e,t)=>e.t-t.t);for(const T of N){const H=x+(j-x)*T.t,W=w+(_-w)*T.t,D=mi(k+(P-k)*Math.min(T.t+1e-4,1),h,u);e.lineTo(H,W),C(),S(D,H,W)}e.lineTo(j,_)}x=j,w=_,k=P,A=L}else S(L,j,_),x=j,w=_,k=P,A=L}C()}else{e.beginPath();const I=l.strokeGradient&&l.path.length>=2?Et(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=I||u,g)$().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[z,E]=l.path[0];e.moveTo(z,E);for(let R=1;l.path.length>R;R++)e.lineTo(l.path[R][0],l.path[R][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=It(e,l.style.fill,l.style.fill),g&&!p)$().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[G,X]=l.path[0];e.moveTo(G,X);for(let V=1;l.path.length>V;V++)e.lineTo(l.path[V][0],l.path[V][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function xi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wi(e,t,n=.3){xi(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ki(e,t,n=.6){var o,i,r,s,l;if(!xi(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ai(e,t,n,o=.35){xi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Oi(e,t){const n=Dt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=Y().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Si=(e,t,n,o)=>{var i,r,s;const l=t.filter(e=>"area"===e.type);for(const t of l){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const a=It(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Wt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Oi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=zt(e,t.fillGradient,"string"==typeof a?a:"#4e79a7",0,n,0,o);e.fillStyle=i||a,e.globalAlpha=u}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*u,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Oi(e,t),Ai(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?Et(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Wt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Dt(t.curve);if(e.beginPath(),o)$().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==l&&1>l&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Ci=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{const t=e.globalAlpha;for(const n of s){e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI);const o=null!==(r=null!==(i=n.style.opacity)&&void 0!==i?i:n.style.fillOpacity)&&void 0!==r?r:1;e.globalAlpha=t*o,e.fillStyle=It(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=It(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ki(e,n)}}finally{e.restore()}}},Mi=new Map;function ji(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=Mi.get(n);return o||(o=new Path2D(ht(e.symbolType,e.size)),Mi.size>256&&Mi.clear(),Mi.set(n,o)),o}catch(e){return null}}const _i=(e,t)=>{var n,o,i,r;const s=e.globalAlpha;for(const l of t){if("symbol"!==l.type)continue;const t=l;if(0>=t.size)continue;const a=ji(t);if(!a)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const c=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*(null!==(o=t._decayOpacity)&&void 0!==o?o:1);t.style.fill&&(e.globalAlpha=s*c*(null!==(i=t.style.fillOpacity)&&void 0!==i?i:1),e.fillStyle=It(e,t.style.fill,"#4e79a7"),e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=s*c,e.strokeStyle=It(e,t.style.stroke,t.style.stroke),e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,e.stroke(a)),e.restore()}e.globalAlpha=s};function Pi(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:l,br:a,bl:c}=function(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,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-l,o),l>0&&e.arcTo(n+i,o,n+i,o+l,l),e.lineTo(n+i,o+r-a),a>0&&e.arcTo(n+i,o+r,n+i-a,o+r,a),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Li(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const Ni=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Fi(e,t);else if(t.cornerRadii&&So(t.cornerRadii)){const n=It(e,t.style.fill,Wt(e,"var(--semiotic-primary, #007bff)")),o=Li(t),i=t.fillGradient&&"string"==typeof n?zt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Pi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Wt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=It(e,t.style.fill,Wt(e,"var(--semiotic-primary, #007bff)")),o=Li(t),i=t.fillGradient&&"string"==typeof n?zt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,l),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s,l+c);break;case"left":e.moveTo(s+a,l),e.lineTo(s+r,l),e.arcTo(s,l,s,l+r,r),e.lineTo(s,l+c-r),e.arcTo(s,l+c,s+r,l+c,r),e.lineTo(s+a,l+c);break;case"bottom":e.moveTo(s,l),e.lineTo(s+a,l),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s+r,l+c),e.arcTo(s,l+c,s,l+c-r,r);break;default:e.moveTo(s,l+c),e.lineTo(s,l+r),e.arcTo(s,l,s+r,l,r),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Wt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=It(e,t.style.fill,Wt(e,"var(--semiotic-primary, #007bff)")),o=Li(t),i=t.fillGradient&&"string"==typeof n?zt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Wt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}wi(e,t),e.globalAlpha=1}};function Fi(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Bi(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Ti(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Hi=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Wt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),wi(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Ti(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Bi(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Wi=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const l=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==l&&(e.globalAlpha=l);const a=Wt(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=a,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=Wt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function Di(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}const Ii=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zi(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${Ii[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Ii[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Ei={line:[Si,bi,Ci],area:[Si,Ci],stackedarea:[Si,Ci],scatter:[Ci,_i],bubble:[Ci,_i],heatmap:[Hi],bar:[Ni],swarm:[Ci],waterfall:[(e,t,n,o)=>{var i;Ni(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,l=null==s?void 0:s._connectorStroke;if(l){e.save(),e.strokeStyle=Wt(e,l)||l,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,l=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==l?void 0:l.baseline))continue;const a=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Wi],mixed:[Si,bi,Ci],custom:[Si,Ni,Hi,bi,Ci,_i,Wi]},Ri={top:20,right:20,bottom:30,left:40},$i={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function Yi(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Gi={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Xi({hover:n}){var o,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",l=null!==(o=n.data)&&void 0!==o?o:{},a=null!==(i=l.y)&&void 0!==i?i:l.value,c=null!==(r=l.x)&&void 0!==r?r:l.time;return t("div",{className:"semiotic-tooltip",style:Gi,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(a)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}Xi.ownsChrome=!0;const Vi=f(function(n,l){var u,h,f,y,m,v,b,x,w,k,A,O,S;const{chartType:C,runtimeMode:M,data:j,chunkThreshold:_,chunkSize:P,xAccessor:L,yAccessor:N,colorAccessor:F,sizeAccessor:B,symbolAccessor:T,symbolMap:H,groupAccessor:W,lineDataAccessor:D,curve:I,normalize:z,baseline:E,stackOrder:R,binSize:$,valueAccessor:Y,arrowOfTime:G="right",windowMode:X="sliding",windowSize:V=200,timeAccessor:q,xExtent:U,yExtent:K,extentPadding:Z=.1,scalePadding:te,sizeRange:ne,size:ie=[500,300],responsiveWidth:re,responsiveHeight:se,margin:le,className:ae,background:ce,lineStyle:ue,pointStyle:de,areaStyle:he,barStyle:fe,waterfallStyle:ge,swarmStyle:pe,barColors:ye,colorScheme:me,boundsAccessor:ve,boundsStyle:be,y0Accessor:xe,band:we,gradientFill:ke,lineGradient:Ae,areaGroups:Oe,openAccessor:Se,highAccessor:Ce,lowAccessor:Me,closeAccessor:je,candlestickStyle:_e,showAxes:Pe=!0,axes:Le,xLabel:Ne,yLabel:Fe,yLabelRight:Be,xFormat:Te,yFormat:He,axisExtent:We,tickFormatTime:De,tickFormatValue:Ie,hoverAnnotation:ze,tooltipContent:Ee,customHoverBehavior:Re,customClickBehavior:$e,enableHover:Ye,hoverRadius:Ge=30,tooltipMode:Xe,annotations:Ve,autoPlaceAnnotations:qe,svgAnnotationRules:Ue,showGrid:Ke,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,legendLayout:ot,legendCategoryAccessor:it,onCategoriesChange:rt,backgroundGraphics:lt,foregroundGraphics:at,canvasPreRenderers:ct,svgPreRenderers:ut,title:dt,categoryAccessor:ft,brush:gt,onBrush:pt,decay:yt,pulse:mt,transition:vt,animate:wt,staleness:kt,heatmapAggregation:At,heatmapXBins:Ot,heatmapYBins:Ct,showValues:Mt,heatmapValueFormat:jt,marginalGraphics:_t,pointIdAccessor:Pt,xScaleType:Lt,yScaleType:Nt,accessibleTable:Ft=!0,description:Bt,summary:Tt,linkedCrosshairName:Ht,linkedCrosshairSourceId:Dt,customLayout:It,layoutConfig:zt,layoutSelection:Et}=n,Rt=g().replace(/:/g,""),Xt=i(!1),Vt=i({w:-1,h:-1}),qt=pi({sizeProp:ie,responsiveWidth:re,responsiveHeight:se,userMargin:le,marginDefault:Ri,animate:wt,transitionProp:vt,themeDirtyRef:Xt}),Ut=function(){const[e,t]=d(!1);return jo(()=>{t(!0)},[]),e}(),Kt=function(){const e=c(_o,Po,Lo);return i(e).current}(),{reducedMotionRef:Qt,responsiveRef:Zt,size:Jt,currentTheme:on,transition:rn,introEnabled:an,tableId:cn,rafRef:un,renderFnRef:dn,scheduleRender:hn}=qt;let fn=qt.margin;if(_t){const e=60,t=Object.assign({},qt.margin);_t.top&&e>t.top&&(t.top=e),_t.bottom&&e>t.bottom&&(t.bottom=e),_t.left&&e>t.left&&(t.left=e),_t.right&&e>t.right&&(t.right=e),fn=t}const gn="function"==typeof at?at({size:Jt,margin:fn}):at,pn="function"==typeof lt?lt({size:Jt,margin:fn}):lt,yn=Jt[0]-fn.left-fn.right,mn=Jt[1]-fn.top-fn.bottom,vn=r(()=>J(j),[j]),bn=null!=ze?ze:Ye,xn=i(null),wn=i(null),[kn,An]=d(0),On=i(0),[Sn,Cn]=d(null),Mn=i(null),jn=i(null),[_n,Pn]=d(null),Ln=i($i.primary),Nn=i([]),Fn=i(it),Bn=i(rt);Fn.current=it,Bn.current=rt;const[Tn,Hn]=d(!1),[Wn,Dn]=d([]),[In,zn]=d([]),En="streaming"===M||["bar","swarm","waterfall"].includes(C),Rn=r(()=>{var e,t,n;return{chartType:C,runtimeMode:En?"streaming":"bounded",windowSize:V,windowMode:X,arrowOfTime:En?G:"right",extentPadding:Z,scalePadding:te,axisExtent:We,xAccessor:L,yAccessor:N,timeAccessor:En?q:void 0,valueAccessor:Y,colorAccessor:F,sizeAccessor:B,symbolAccessor:T,symbolMap:H,groupAccessor:W||(D?"_lineGroup":void 0),categoryAccessor:ft,lineDataAccessor:D,xScaleType:Lt,yScaleType:Nt,xExtent:U,yExtent:K,sizeRange:ne,binSize:$,normalize:z,baseline:E,stackOrder:R,boundsAccessor:ve,boundsStyle:be,y0Accessor:xe,band:we,gradientFill:!0===ke?{topOpacity:.8,bottomOpacity:.05}:!1===ke?void 0:ke,areaGroups:Oe?new Set(Oe):void 0,lineGradient:Ae,openAccessor:Se,highAccessor:Ce,lowAccessor:Me,closeAccessor:je,candlestickStyle:_e,lineStyle:ue,pointStyle:de,areaStyle:he,swarmStyle:pe,waterfallStyle:ge,colorScheme:me,barColors:ye,barStyle:fe,annotations:Ve,decay:yt,pulse:mt,transition:rn,introAnimation:an,staleness:kt,heatmapAggregation:At,heatmapXBins:Ot,heatmapYBins:Ct,showValues:Mt,heatmapValueFormat:jt,pointIdAccessor:Pt,curve:I,themeCategorical:null===(e=null==on?void 0:on.colors)||void 0===e?void 0:e.categorical,themeSemantic:oe(on),themeSequential:null===(t=null==on?void 0:on.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==on?void 0:on.colors)||void 0===n?void 0:n.diverging,customLayout:It,layoutConfig:zt,layoutMargin:fn}},[C,V,X,G,Z,te,We,L,N,q,Y,Lt,Nt,F,B,T,H,W,ft,D,U,K,ne,$,z,E,R,ve,be,xe,we,ke,Ae,Oe,Se,Ce,Me,je,_e,ue,de,he,pe,ge,fe,me,ye,Ve,yt,mt,null==rn?void 0:rn.duration,null==rn?void 0:rn.easing,an,kt,At,Ot,Ct,Mt,jt,En,Pt,I,on,It,zt,fn]),$n=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Fo(e,t);if(!Bo(e)||!Bo(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Fo(n,i))return!1}else{if(!Bo(n)||!Bo(i))return!1;if(!No(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Rn),Yn=i(null);Yn.current||(Yn.current=new bt($n));const Gn=a(()=>{var e,t;const n=Fn.current,o=Bn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Yn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,Nn.current)||(Nn.current=i,o(i))},[]);s(()=>{var e;null===(e=Yn.current)||void 0===e||e.updateConfig($n),Xt.current=!0,hn()},[$n,hn]);const Xn=i(null);s(()=>{const e=Yn.current;if(!e)return;const t=null!=Et?Et:null;Xn.current!==t&&(Xn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):Xt.current=!0,hn())},[Et,hn]);const Vn=i(null);Vn.current||(Vn.current=new ee(e=>{const t=Yn.current;t&&t.ingest(e)&&(Xt.current=!0,hn())},{chunkThreshold:_,chunkSize:P})),s(()=>{var e;null===(e=Vn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:_,chunkSize:P})},[_,P]);const qn=a(e=>{var t;null===(t=Vn.current)||void 0===t||t.push(e)},[]),Un=a(e=>{var t;null===(t=Vn.current)||void 0===t||t.pushMany(e)},[]),Kn=a(()=>{var e,t;null===(e=Vn.current)||void 0===e||e.clear(),null===(t=Yn.current)||void 0===t||t.clear(),Xt.current=!0,hn()},[hn]);p(l,()=>({push:qn,pushMany:Un,remove:e=>{var t,n,o;null===(t=Vn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Yn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(Mn.current&&i.some(e=>{var t;return e===(null===(t=Mn.current)||void 0===t?void 0:t.data)})&&(Mn.current=null,Pn(null)),Xt.current=!0,hn()),i},update:(e,t)=>{var n,o,i;null===(n=Vn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Yn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Xt.current=!0,hn()),r},clear:Kn,getData:()=>{var e,t,n;return null===(e=Vn.current)||void 0===e||e.flush(),null!==(n=null===(t=Yn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Yn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Yn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[qn,Un,Kn,hn]),s(()=>{var e,t;if(j){if(D&&vn.length>0&&"object"==typeof vn[0]&&null!==vn[0]){const t="string"==typeof D?D:"coordinates";if(Array.isArray(vn[0][t])){const n=[];for(const e of vn){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Vn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Vn.current)||void 0===t||t.setBoundedData(vn)}},[j,vn,D]);const{hoverHandlerRef:Qn,hoverLeaveRef:Zn,onPointerMove:Jn,onPointerLeave:eo}=qt;Qn.current=e=>{var t,n,o,i;if(!bn)return;const r=xn.current;if(!r)return;const s=r.getBoundingClientRect(),l=e.clientX-s.left-fn.left,a=e.clientY-s.top-fn.top;if(0>l||l>yn||0>a||a>mn)return void(Mn.current&&(Mn.current=null,jn.current=null,Pn(null),Re&&(Re(null),Xt.current=!0),hn()));const c=Yn.current;if(!c||0===c.scene.length)return;const u=Yt(c.scene,l,a,Ge,c.quadtree,c.maxPointRadius),d="multi"===Xe,h=()=>{Mn.current&&(Mn.current=null,jn.current=null,Pn(null),Re&&Re(null),hn())};if(!u&&!d)return void h();const f=d||!u?l:u.x,g=d||!u?a:u.y,p=(null==u?void 0:u.datum)?st(u.datum,c.resolvedRibbons):{},y=null===(n=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,m="function"==typeof y?y(f):void 0;let v=ii(p,f,g,null!=m?{xValue:m,xPx:f}:void 0);if(d&&c.scene.length>0&&c.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=Gt($t(e.path,e.curve),t,n);if(null===r)continue;const s=en(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=$t(e.topPath,e.curve),s=$t(e.bottomPath,e.curve),l=Gt(r,t,n);if(null===l)continue;const a=Gt(s,t,n),c=en(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:l,y0:null!=a?a:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(c.scene,f,Math.max(Ge,yn));if(e.length>0){const t=c.scales.y.invert,n=Ln.current,o=y?y(f):f;if(u)v.xValue=o,v.xPx=f;else{const e={xValue:o};"string"==typeof L&&(e[L]=o),v=ii(e,f,g,{xValue:o,xPx:f})}v.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===C&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:st(e.datum,c.resolvedRibbons)}})}}u||(null===(o=v.allSeries)||void 0===o?void 0:o.length)?(Mn.current=v,jn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,Pn(v),Re&&(Re(v),Xt.current=!0),hn()):h()},Zn.current=()=>{Mn.current&&(Mn.current=null,jn.current=null,Pn(null),Re&&(Re(null),Xt.current=!0),hn())};const to=i(()=>{});to.current=e=>{var t,n;if(!$e)return;const o=xn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-fn.left,s=e.clientY-i.top-fn.top;if(0>r||r>yn||0>s||s>mn)return void $e(null);const l=Yn.current;if(!l||0===l.scene.length)return void $e(null);const a=Yt(l.scene,r,s,Ge,l.quadtree,l.maxPointRadius);if(!a)return void $e(null);const c=a.datum||{},u=null===(n=null===(t=l.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(a.x):void 0;$e(ii(c,a.x,a.y,null!=d?{xValue:d,xPx:a.x}:void 0))};const no=a(e=>to.current(e),[]),oo=i(-1),io=i(null),ro=i(null),so=a(e=>{const t=Yn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(ro.current&&ro.current.version===n)o=ro.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=r.size)break;i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),ro.current={version:n,graph:o}}const i=oo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),oo.current=0;const n=o.flat[0];io.current={shape:n.shape,w:n.w,h:n.h};const i=nn(Object.assign(Object.assign({},n),{datum:st(n.datum,t.resolvedRibbons)}));return Mn.current=i,Pn(i),Re&&Re(i),void hn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?tn(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?tn(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return oo.current=-1,io.current=null,Mn.current=null,jn.current=null,Pn(null),Re&&Re(null),void hn();oo.current=s;const l=o.flat[s];io.current={shape:l.shape,w:l.w,h:l.h};const a=nn(Object.assign(Object.assign({},l),{datum:st(l.datum,t.resolvedRibbons)}));Mn.current=a,Pn(a),Re&&Re(a),hn()},[Re,hn]),lo=a(e=>{oo.current=-1,io.current=null,Jn(e)},[Jn]);dn.current=()=>{un.current=0;const e=xn.current,t=wn.current;if(!e||!t)return;const n=Yn.current;if(!n)return;const o="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(Qt.current?o+1e6:o),r=!Qt.current&&i,s=Vt.current.w!==yn||Vt.current.h!==mn,l=Xt.current||i||s;let a=!1;!l||r&&!s||(n.computeScene({width:yn,height:mn}),Vt.current={w:yn,h:mn},a=!0,Gn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return $i;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),l=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||l||n||r?{axisStroke:a||$i.axisStroke,tickText:s||$i.tickText,crosshair:s?Yi(s,"66"):$i.crosshair,hoverFill:c?Yi(c,"4D"):$i.hoverFill,hoverStroke:s?Yi(s,"99"):$i.hoverStroke,pointRing:c||$i.pointRing,primary:r||$i.primary}:$i}(e);Ln.current=u.primary;const d=sn(kt,n.lastIngestTime>0?o-n.lastIngestTime:0),h=kt&&d.isStale;if(l){const t=yi(e,Jt,fn,c);if(t){if(t.clearRect(-fn.left,-fn.top,Jt[0],Jt[1]),kt&&1>d.alpha&&(t.globalAlpha=d.alpha),"transparent"!==ce&&!lt){const n=getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),o=ce||(n&&"transparent"!==n?n:null),i=o?Wt(t,o):null;i&&(t.fillStyle=i,t.fillRect(-fn.left,-fn.top,Jt[0],Jt[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,yn,mn),t.clip()),ct&&n.scales)for(const e of ct)t.save(),e(t,n.scene,n.scales,{width:yn,height:mn}),t.restore();const o=It?Ei.custom:Ei[C];if(o&&n.scales)for(const e of o)e(t,n.scene,n.scales,{width:yn,height:mn});t.restore(),kt&&1>d.alpha&&(t.globalAlpha=1)}}{const e=yi(t,Jt,fn,c);if(e&&(e.clearRect(-fn.left,-fn.top,Jt[0],Jt[1]),bn&&Mn.current&&n.scales&&function(e,t,n,o,i,r,s){var l;if(!1===i.crosshair)return;const a=t.allSeries,c=a&&a.length>0,u=null!==(l=t.xPx)&&void 0!==l?l:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,Mn.current,yn,mn,"object"==typeof bn?bn:{},jn.current,u),jn.current&&Array.isArray(ze))){const t=ze.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,n.scene,jn.current,t,u)}}l&&e&&e.setAttribute("aria-label",Wo(n.scene,C+" chart"));const f=Xt.current;if(Xt.current=f&&r&&!a,f&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Sn||e(Sn.x.domain()[0])!==e(n.scales.x.domain()[0])||e(Sn.x.domain()[1])!==e(n.scales.x.domain()[1])||e(Sn.y.domain()[0])!==e(n.scales.y.domain()[0])||e(Sn.y.domain()[1])!==e(n.scales.y.domain()[1])||Sn.x.range()[0]!==n.scales.x.range()[0]||Sn.x.range()[1]!==n.scales.x.range()[1]||Sn.y.range()[0]!==n.scales.y.range()[0]||Sn.y.range()[1]!==n.scales.y.range()[1])&&Cn(n.scales),_t){const e=n.getData(),t="function"==typeof L?L:e=>e[L||"x"],o="function"==typeof N?N:e=>e[N||"y"];Dn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),zn(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Ve&&Ve.length>0||It)&&(a||r))||!a&&33>o-On.current||(An(e=>e+1),On.current=o),(null==kt?void 0:kt.showBadge)&&Hn(!!h),(r||null!=n.activeTransition||n.hasActivePulses)&&(un.current=requestAnimationFrame(()=>dn.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:a}=e;jo(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const c=i(a);c.current=a,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:Ut,wasHydratingFromSSR:Kt,storeRef:Yn,dirtyRef:Xt,renderFnRef:dn,cleanup:()=>{var e;return null===(e=Vn.current)||void 0===e?void 0:e.clear()}}),s(()=>{Xt.current=!0,hn()},[C,yn,mn,Pe,ce,ue,ct,hn]),function(e,t,n,o,r,l){const a=i("fresh");s(()=>{if(!e)return;const i=setInterval(()=>{const i=t.current;if(!i||0===i.lastIngestTime)return;const s="undefined"!=typeof performance?performance.now():Date.now(),c=sn(e,s-i.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&l(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(kt,Yn,Xt,hn,Tn,Hn);const ao=r(()=>{if(Te||De)return;const e=Yn.current;return(null==e?void 0:e.xIsDate)&&Sn?zi(Sn.x.domain()):void 0},[Te,De,Sn]),co=Te||De||ao,uo=bn&&_n?Ee?Ee(_n):e(Xi,{hover:_n}):null,ho=uo?e(di,{x:_n.x,y:_n.y,containerWidth:yn,containerHeight:mn,margin:fn,className:"stream-frame-tooltip",children:uo}):null,fo=io.current,go=e(ni,{active:oo.current>=0,hoverPoint:_n,margin:fn,size:Jt,shape:null==fo?void 0:fo.shape,width:null==fo?void 0:fo.w,height:null==fo?void 0:fo.h}),po=Di(L,q,"__semiotic_resolvedX","__semiotic_resolvedTime"),yo=Di(N,Y,"__semiotic_resolvedY","__semiotic_resolvedValue"),mo=po.key,vo=yo.key,bo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(po,yo,Ve&&Ve.length>0||!1);if(Mo||!Ut&&Kt){const n=Yn.current;n&&j&&(n.ingest({inserts:vn,bounded:!0}),n.computeScene({width:yn,height:mn}));const i=null!==(u=null==n?void 0:n.scene)&&void 0!==u?u:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s=co||(()=>{if((null==n?void 0:n.xIsDate)&&r)return zi(r.x.domain())})();return t("div",{ref:Zt,className:"stream-xy-frame"+(ae?" "+ae:""),role:"img","aria-label":Bt||("string"==typeof dt?dt:"XY chart"),style:{position:"relative",width:re?"100%":Jt[0],height:se?"100%":Jt[1]},children:[e(Zo,{summary:Tt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Jt[0],height:Jt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${fn.left},${fn.top})`,children:pn}),t("g",{transform:`translate(${fn.left},${fn.top})`,children:[ce&&e("rect",{x:0,y:0,width:yn,height:mn,fill:ce}),ut&&r&&ut.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:yn,height:mn})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,s,l,a,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:Co(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:Co(c.style.fill),fillOpacity:null!==(a=null!==(l=c.style.fillOpacity)&&void 0!==l?l:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Co(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"symbol":return function(t,n){const o=ht(t.symbolType,t.size,t.path);return e("path",{d:o,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?Co(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"symbol-"+n)}(n,o);case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Co(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,l]=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]}(i.fill),a=.299*r+.587*s+.114*l>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),l=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:l,stroke:l,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,Rt)).filter(Boolean)]})]}),e(Oo,{width:yn,height:mn,totalWidth:Jt[0],totalHeight:Jt[1],margin:fn,scales:r,showAxes:Pe,axes:Le,xLabel:Ne,yLabel:Fe,yLabelRight:Be,xFormat:s,yFormat:He||Ie,axisExtent:We,showGrid:Ke,title:dt,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,legendLayout:ot,foregroundGraphics:xt(gn,St(null===(f=Yn.current)||void 0===f?void 0:f.customLayoutOverlays,null!=Et?Et:null)),marginalGraphics:_t,xValues:[],yValues:[],annotations:Ve,autoPlaceAnnotations:qe,svgAnnotationRules:Ue,annotationFrame:0,xAccessor:mo,yAccessor:vo,annotationData:bo(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof I?I:void 0,linkedCrosshairName:Ht,linkedCrosshairSourceId:Dt})]})}return t("div",{ref:Zt,className:"stream-xy-frame"+(ae?" "+ae:""),role:"group","aria-label":Bt||("string"==typeof dt?dt:"XY chart"),tabIndex:0,style:{position:"relative",width:re?"100%":Jt[0],height:se?"100%":Jt[1],overflow:"visible"},onKeyDown:so,children:[Ft&&e(Jo,{tableId:cn}),Ft&&e(Qo,{scene:null!==(m=null===(y=Yn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],chartType:C+" chart",tableId:cn,chartTitle:"string"==typeof dt?dt:void 0}),e(Zo,{summary:Tt}),e(ei,{hoverPoint:_n}),t("div",{role:"img","aria-label":Bt||("string"==typeof dt?dt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:bn?lo:void 0,onMouseLeave:bn?eo:void 0,onClick:$e?no:void 0,children:[pn&&e("svg",{style:{position:"absolute",left:0,top:0,width:Jt[0],height:Jt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${fn.left},${fn.top})`,children:pn})}),e(wo,{width:yn,height:mn,totalWidth:Jt[0],totalHeight:Jt[1],margin:fn,scales:Sn,showAxes:Pe,axes:Le,showGrid:Ke,xFormat:co,yFormat:He||Ie,axisExtent:We}),e("canvas",{ref:xn,"aria-label":Wo(null!==(b=null===(v=Yn.current)||void 0===v?void 0:v.scene)&&void 0!==b?b:[],C+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:wn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Oo,{width:yn,height:mn,totalWidth:Jt[0],totalHeight:Jt[1],margin:fn,scales:Sn,showAxes:Pe,axes:Le,xLabel:Ne,yLabel:Fe,yLabelRight:Be,xFormat:co,yFormat:He||Ie,axisExtent:We,showGrid:Ke,title:dt,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,legendLayout:ot,foregroundGraphics:xt(gn,St(null===(x=Yn.current)||void 0===x?void 0:x.customLayoutOverlays,null!=Et?Et:null)),marginalGraphics:_t,xValues:Wn,yValues:In,annotations:Ve,autoPlaceAnnotations:qe,svgAnnotationRules:Ue,annotationFrame:kn,xAccessor:mo,yAccessor:vo,annotationData:bo(null===(w=Yn.current)||void 0===w?void 0:w.getData()),pointNodes:null===(k=Yn.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof I?I:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==ce&&!lt,linkedCrosshairName:Ht,linkedCrosshairSourceId:Dt}),(gt||pt)&&e(Q,{width:yn,height:mn,totalWidth:Jt[0],totalHeight:Jt[1],margin:fn,dimension:null!==(A=null==gt?void 0:gt.dimension)&&void 0!==A?A:"xy",scales:Sn,onBrush:null!=pt?pt:()=>{},binSize:$,snap:null==gt?void 0:gt.snap,binBoundaries:null!==(O=null==gt?void 0:gt.binBoundaries)&&void 0!==O?O:"bar"===C?null===(S=Yn.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==gt?void 0:gt.snapDuring,streaming:"streaming"===M}),(null==kt?void 0:kt.showBadge)&&e(ln,{isStale:Tn,position:kt.badgePosition}),go,ho]})]})});Vi.displayName="StreamXYFrame";const qi=u(null);function Ui({colors:t,categories:n,colorScheme:o="category10",children:i}){const s=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:Ye[o]||Ge,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(qi.Provider,{value:s,children:i})}function Ki(){return l(qi)}function Qi(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Zi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ji(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}Ui.displayName="CategoryColorProvider";const[er,tr]=te(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&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,o]of n){const n=t.fields[e];if(!n||!Ji(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),s=Zi(r,t),l=new Map(s.clauses);return l.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},s),{clauses:l})),{selections:r}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),r=Zi(i,t);return i.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[nr,or]=te(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 ir(e){const t=g(),n=e.clientId||t,{name:o}=e,i=tr(e=>e.selections.get(o)),s=tr(e=>e.setClause),l=tr(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Qi(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},i=!0;i&&s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},i=!0;i&&s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}function rr(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=ir({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}ar(t)&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}function sr(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function lr(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=ir({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&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])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&sr(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===u&&sr(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),ar(t)&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}function ar(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}const cr=u(!1),ur=u(null),dr="undefined"==typeof window?s:h;function hr(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function fr(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 gr({selections:e}){const t=tr(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function pr({categoryColors:t,interaction:n,selectionName:o,field:l}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],f=rr({name:o,fields:[l]}),g=ir({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(g.selectPoints);b.current=g.selectPoints;const x=i(g.clear);x.current=g.clear,s(()=>{"isolate"===n&&(p.size>0?b.current({[l]:Array.from(p)}):x.current())},[n,p,l]);const w=a(e=>{"highlight"===n&&(e?(v(e.label),f.onHover({[l]:e.label})):(v(null),f.onHover(null)))},[n,l,f]),k=a(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[O]]=hi([0,0],!0,!1),S=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),O),[c,O]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"},children:e(gn,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===n?w:void 0,customClickBehavior:"isolate"===n?k:void 0,highlightedCategory:m,isolatedCategories:p})})})}function yr({children:n,selections:o,showLegend:s,legendPosition:l="top",legendInteraction:a="none",legendSelectionName:c="legend",legendField:u="category"}){const h=Ki(),[f,g]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=hr(t);g(t=>{var o;return fr(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{g(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(f))for(const n of t)e.push(n);return hr(e)},[f]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=Ge[o%Ge.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===s||s,x=b&&Object.keys(v).length>0;return e(er,{children:t(nr,{children:[o&&e(gr,{selections:o}),e(ur.Provider,{value:y,children:e(Ui,{colors:v,children:t(cr.Provider,{value:x,children:[b&&"top"===l&&e(pr,{categoryColors:v,interaction:a,selectionName:c,field:u}),n,b&&"bottom"===l&&e(pr,{categoryColors:v,interaction:a,selectionName:c,field:u})]})})})]})})}function mr(e){return e?"string"==typeof e?{name:e}:e:null}function vr(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function br(){return de(e=>e.theme)}o.createContext(void 0);const xr="#007bff";function wr(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function kr(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?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function Ar(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Or(){var e;const t=br(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Sr(e,t,n){const o=Ki(),i=Or();return r(()=>{var r;if(!t)return;const s=null!=o?o:void 0,l=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(s&&Ar(s)){const e=Ue(n.map(e=>({_cat:e})),"_cat",l);return t=>s[t]||e(t)}return Ue(n.map(e=>({_cat:e})),"_cat",l)}if(s&&Ar(s)){const n=Ue(e,t,l);return e=>s[e]||n(e)}return Ue(e,t,l)}if(s&&Ar(s)){const e=Ue([{_:"a"}],"_",l);return t=>s[t]||e(t)}},[e,t,n,o,i])}function Cr({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:c,onClick:u,hoverHighlight:h,colorByField:f}){const p=g(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||f||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=ir({name:(null==e?void 0:e.name)||"__unused__"}),b=rr({name:(null==y?void 0:y.name)||"hover",fields:m}),x=or(e=>e.pushObservation),w=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,A]=d(null),O=f||n[0],S=r(()=>{if(!h||null==k||!O)return null;const e=k,t=O;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,O]),C=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=wr(e,t,y.xField);null!=n&&function(e,t,n){const o=io.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(io={positions:new Map(io.positions).set(e,{xValue:t,sourceId:n})},so())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&lo(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&O)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[O];A(null!=n?n+"":null)}else A(null);if(i||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const r=kr(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),x&&x(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),x&&x(e)}}},[t,b,y,p,i,l,c,x,h,O]),M=a(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=wr(e,t,y.xField);null!=n&&function(e,t,n){const o=io.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(io.positions);return t.delete(e),io={positions:t},so(),!1}io={positions:new Map(io.positions).set(e,{xValue:t,sourceId:n,locked:!0})},so()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=kr(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),x&&x(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),x&&x(e)}}},[u,i,x,l,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{ao(e,p),lo(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:w,hoverSelectionHook:S,customHoverBehavior:C,customClickBehavior:M,crosshairSourceId:p}}function Mr(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function jr({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(cr),h=null!==l(ur),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(ur),n=g(),o=hr(e),r=i([]);fr(r.current,o)||(r.current=o);const s=r.current;dr(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),dr(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const m=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Xe[r%Xe.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:qe,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),v=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return m&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,a,m,s]);return{legend:m,margin:v,legendPosition:s}}function _r(e,t,n){const[o,i]=d(null),[s,l]=d(new Set),c=r(()=>new Set,[]),u=a(t=>{"highlight"===e&&i(t?t.label:null)},[e]),h=a(t=>{"isolate"===e&&l(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),f=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:c,onLegendHover:u,onLegendClick:h,legendSelectionHook:f}}const Pr={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Lr(e,t,n){var o,i,r,s,l,a,c;const u=Pr[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Nr(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Nr(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Fr(e){return"string"==typeof e?e:"value"}function Br(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Tr(e,t){if(!t)return Br(e);try{const n=t(e);return null==n?Br(e):n}catch(t){return Br(e)}}function Hr(e,t){return"function"==typeof t?t(e):e[t]}function Wr(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function Dr(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?Tr(Hr(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:ri,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=Tr(Hr(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function Ir({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class zr extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Ir,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Er;const Rr="undefined"!=typeof process&&"production"!==(null===(Er=process.env)||void 0===Er?void 0:Er.NODE_ENV);function $r({componentName:t,width:n,height:o,children:i}){return e(zr,{fallback:i=>e(Ir,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Yr={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Gr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xr(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Yr),{width:n,height:o}),children:i||"No data available"}):null}function Vr(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Gr),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function qr(e,t,n,o){if(!Rr)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Ur(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Kr(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Ur(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Qr({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Kr(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Zr(e){const t=de(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Jr(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:l,selection:c,linkedHover:u,fallbackFields:h,unwrapData:f=!1,onObservation:g,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:A,emptyContent:O,width:S,height:C}=e,M=void 0===n,j=r(()=>J(t),[t]),[_,P]=d([]),L=a(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),N="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:F,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:H,crosshairSourceId:W}=Cr({selection:c,linkedHover:u,fallbackFields:h,unwrapData:f,onObservation:g,chartType:p,chartId:y,onClick:x,hoverHighlight:w,colorByField:N}),D=Mr(u,W),I=Sr(j,o,i),z=r(()=>{if(!o)return[];const e=new Set;for(const t of j){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[j,o]),E=r(()=>M&&_.length>0?_:z,[M,_,z]),R=_r(s,o,E),$=r(()=>B||(R.legendSelectionHook?R.legendSelectionHook:F),[B,R.legendSelectionHook,F]),Y=Zr(c),G=Or(),X=Ki(),V=r(()=>{if(I)return I;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:Xe,t="__streamCat",n=Ue(E.map(e=>({[t]:e})),t,e);return e=>(null==X?void 0:X[e])||n(e)||"#999"},[I,o,E,i,G,X]),{legend:q,margin:U,legendPosition:K}=jr({data:j,colorBy:o,colorScale:V,showLegend:m,legendPosition:l,userMargin:v,defaults:b,categories:E}),Q=r(()=>{const e={};return q&&(e.legend=q,e.legendPosition=K),s&&"none"!==s&&(e.legendHoverBehavior=R.onLegendHover,e.legendClickBehavior=R.onLegendClick,e.legendHighlightedCategory=R.highlightedCategory,e.legendIsolatedCategories=R.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[q,K,s,R.onLegendHover,R.onLegendClick,R.highlightedCategory,R.isolatedCategories,M,o,L]),Z=Array.isArray(n)?J(n):n,ee=Vr(k,S,C,A),te=ee?null:Xr(Z,S,C,O);return{data:j,colorScale:I,allCategories:E,legendState:R,effectiveSelectionHook:$,activeSelectionHook:F,customHoverBehavior:T,customClickBehavior:H,legend:q,margin:U,legendPosition:K,earlyReturn:ee||te||null,legendBehaviorProps:Q,crosshairProps:D,resolvedSelection:Y}}function es(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function ts(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:s,fillArea:l,areaOpacity:a=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f}=e,g=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===l||Array.isArray(l)&&null!=r&&l.includes(r);let d;return s?d=s(e,r):n?o&&(d=qe(e,n,o)):d=i||xr,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[t,n,o,i,s,l,a]),p=r(()=>es(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return r(()=>vr(p,null!=h?h:null,f),[p,h,f])}function ns(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function os(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const is="__forecastSegment";let rs=null;function ss(){return os(this,void 0,void 0,function*(){return rs||(rs=yield import("./xy-statisticalOverlays-3Ni9bRph.js")),rs})}const ls="__semiotic_resolvedX",as="__semiotic_resolvedY";function cs(e){const{data:t,xAccessor:n,yAccessor:o,forecast:l,anomaly:a,groupBy:c}=e,u="string"==typeof n?n:ls,h="string"==typeof o?o:as,f=r(()=>{if(!l&&!a)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[ls]=n(t)),i&&(r[as]=o(t)),r}):t},[t,l,a,n,o]),[g,p]=d(null),[y,m]=d([]),v=i(l),b=i(a);return s(()=>{if(!l&&!a)return void((v.current||b.current)&&(p(null),m([]),v.current=l,b.current=a));let e=!1;const t=l!==v.current||a!==b.current;if(v.current=l,b.current=a,t&&(p(null),m([])),l){const t=c&&"string"==typeof c&&"object"==typeof l?Object.assign(Object.assign({},l),{_groupBy:c}):l;(function(...e){return os(this,void 0,void 0,function*(){return(yield ss()).buildForecast(...e)})})(f,u,h,t,a).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else a&&function(...e){return os(this,void 0,void 0,function*(){return(yield ss()).buildAnomalyAnnotations(...e)})}(a).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[f,l,a,u,h,c]),{effectiveData:g?g.processedData:t,statisticalAnnotations:y,hasForecast:!!g,xAccessorKey:u,yAccessorKey:h}}const us=f(function(t,n){var o,l;const c=i(null);ns(n,{variant:"xy",frameRef:c});const u=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:f,className:g,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:w="coordinates",colorBy:k,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:C=3,fillArea:M=!1,areaOpacity:j=.3,lineWidth:_=2,lineGradient:P,tooltip:L,pointIdAccessor:N,annotations:F,directLabel:B,gapStrategy:T="break",anomaly:H,forecast:W,band:D,xExtent:I,yExtent:z,frameProps:E={},selection:R,linkedHover:$,onObservation:Y,onClick:G,hoverHighlight:X,hoverRadius:V,chartId:q,loading:U,loadingContent:K,emptyContent:Q,legendInteraction:Z,legendPosition:ee,xScaleType:te,yScaleType:ne,color:oe,stroke:ie,strokeWidth:re,opacity:se}=t,{width:le,height:ae,enableHover:ce,showGrid:ue,showLegend:de,title:he,description:fe,summary:ge,accessibleTable:pe,xLabel:ye,yLabel:me}=u,ve=r(()=>J(h),[h]);qr("LineChart",ve,"xAccessor",v),qr("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=cs({data:ve,xAccessor:v,yAccessor:b,forecast:W,anomaly:H,groupBy:x}),we="__compoundGroup",ke=!(!W||!x),Ae=ke?we:W?is:x,Oe=r(()=>{if(!ke)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[we]=`${e(t)}__${t[is]||"observed"}`,n})},[be,ke,x]),Se=ke?Oe:be,Ce=k||x,Me=r(()=>{if(!W)return;const e=W.upperBounds,t=W.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[W,be,b]),je=a(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),_e=void 0!==(null===(o=Se[0])||void 0===o?void 0:o[w]),Pe=r(()=>{if(_e)return Se;if(Ae){const e=Se.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[w]:[]};"string"==typeof Ae&&(o[Ae]=n),ke&&(o[is]=t[is],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][w].push(t),e},{});return Object.values(e)}return[{[w]:Se}]},[Se,Ae,w,_e]),{gapProcessedLineData:Le,hasGaps:Ne}=r(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of Pe){const o=(n[w]||[]).filter(t=>!je(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of Pe){const o=n[w]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const l of o)if(je(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[w]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Pe){const i=o[w]||[],r=[];for(const n of i)je(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[w]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,T,w,je,Ae,b]),Fe="object"==typeof B?B:{},Be=Fe.position||"end",Te=Fe.fontSize||11,He=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[w]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Be?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[B,Ce,Le,w,Be]),We=r(()=>{if(!B)return u.marginDefaults;const e=He.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Be?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[t]:Math.max(u.marginDefaults[t]||0,e)})},[B,He,Te,Be,u.marginDefaults]),De=Jr({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:Z,legendPosition:ee,selection:R,linkedHover:$,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:G,hoverHighlight:X,chartType:"LineChart",chartId:q,showLegend:(!B||void 0!==de)&&de,userMargin:f,marginDefaults:We,loading:U,loadingContent:K,emptyContent:Q,width:le,height:ae}),Ie=De.colorScale,ze=De.customHoverBehavior,Ee=De.customClickBehavior,Re=De.crosshairProps,$e=ts({lineWidth:_,colorBy:Ce,colorScale:Ie,color:oe,fillArea:M,areaOpacity:j,stroke:ie,strokeWidth:re,opacity:se,effectiveSelectionHook:De.effectiveSelectionHook,resolvedSelection:De.resolvedSelection}),[Ye,Ge]=d(null);s(()=>{if(!W)return void Ge(null);let e=!1;return function(...e){return os(this,void 0,void 0,function*(){return(yield ss()).createSegmentLineStyle(...e)})}($e,W).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[$e,W]);const Xe=Ye||$e,Ve=r(()=>{if(S)return e=>{const t={r:C,fillOpacity:1};return Ce?Ie&&(t.fill=qe(e.parentLine||e,Ce,Ie)):t.fill=oe||xr,t}},[S,C,Ce,Ie,oe]),Ue=Array.isArray(M)?"mixed":M?"area":"line",Ke=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[w]||[];if(0===n.length)continue;const r="end"===Be?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const l=s+"";""===l||i.has(l)||i.set(l,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Be?6:-6,dy:0,color:Ie?Ie(e):xr,fontSize:Te}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Te+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Te+2)}return r},[B,Ce,Ie,Le,w,v,b,Be,Te]),Qe=De.margin,Ze=x||k,Je=r(()=>Dr([{label:ye||Fr(v),accessor:v,role:"x",format:p},{label:me||Fr(b),accessor:b,role:"y",format:y},...Ze?[{label:Fr(Ze),accessor:Ze,role:"group"}]:[],...Wr(D,y)]),[v,b,ye,me,Ze,p,y,D]),et=Qr({componentName:"LineChart",data:_e?(null===(l=be[0])||void 0===l?void 0:l[w])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),tt=r(()=>_e||Ae||Ne?Le.flatMap(e=>{const t=e[w]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Se,[Le,w,_e,Ae,Se,Ne]),nt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ue},Array.isArray(M)&&{areaGroups:M}),P&&{lineGradient:P}),null!=V&&{hoverRadius:V}),null!=h&&{data:tt}),{xAccessor:v,yAccessor:b,xScaleType:te,yScaleType:ne}),I&&{xExtent:I}),!z||null==z[0]&&null==z[1]?Me?{yExtent:Me}:{}:{yExtent:z}),{groupAccessor:"break"===T&&Ne?"_gapSegment":Ae||void 0}),D&&{band:D}),{curve:O,lineStyle:Xe}),S&&{pointStyle:Ve}),{size:[le,ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Qe,showAxes:u.showAxes,xLabel:ye,yLabel:me,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{enableHover:ce,showGrid:ue}),De.legendBehaviorProps),he&&{title:he}),fe&&{description:fe}),ge&&{summary:ge}),void 0!==pe&&{accessibleTable:pe}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?ci():ui(L)||Je}),"multi"===L&&{tooltipMode:"multi"}),($||Y||G||X)&&{customHoverBehavior:ze}),(Y||G||$)&&{customClickBehavior:Ee}),N&&{pointIdAccessor:N}),((null==F?void 0:F.length)||xe.length||Ke.length)&&{annotations:[...F||[],...xe,...Ke]}),Re),E);return De.earlyReturn?De.earlyReturn:et?e(Ir,{componentName:"LineChart",message:et,width:le,height:ae}):e($r,{componentName:"LineChart",width:le,height:ae,children:e(Vi,Object.assign({ref:c},nt))})});function ds(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:l,autoPlaceAnnotations:a}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=s&&(c.animate=s),void 0!==l&&(c.axisExtent=l),void 0!==a&&(c.autoPlaceAnnotations=a),c}function hs(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=r),(l?n||o||t:n||o)&&(a.customClickBehavior=s),a}function fs(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:ui(t)||n}}function gs(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:s,colorBy:l,colorScale:a,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:w,xLabel:k,yLabel:A,xFormat:O,yFormat:S,groupField:C}=e,M=void 0!==(null===(t=n[0])||void 0===t?void 0:t[s]),j=r(()=>{if(null==o)return[];if(!M&&!i)return n;let e;if(M)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[s]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][s].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,s,M]),_=r(()=>e=>{const t={};if(l){if(a){const n=qe(e,l,a);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||xr;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[l,a,c,p,y,m]),P=r(()=>es(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:j,lineStyle:r(()=>vr(P,null!=f?f:null,g),[P,f,g]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return l?a&&(t.fill=qe(e.parentLine||e,l,a)):t.fill=c||xr,t}},[v,b,l,a,c]),defaultTooltipContent:r(()=>Dr([{label:k||Fr(x),accessor:x,role:"x",format:O},{label:A||Fr(w),accessor:w,role:"y",format:S},...C?[{label:Fr(C),accessor:C,role:"group"}]:[],...Wr(e.band,S)]),[x,w,k,A,C,O,S,e.band])}}function ps(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}us.displayName="LineChart";const ys=f(function(t,n){const o=i(null);ns(n,{variant:"xy",frameRef:o});const s=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:w="monotoneX",areaOpacity:k=.7,lineGradient:A,showLine:O=!0,lineWidth:S=2,showPoints:C=!1,pointRadius:M=3,tooltip:j,annotations:_,forecast:P,anomaly:L,band:N,xExtent:F,yExtent:B,frameProps:T={},selection:H,linkedHover:W,onObservation:D,onClick:I,hoverHighlight:z,chartId:E,loading:R,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:X,color:V,stroke:q,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:se,xLabel:le,yLabel:ae}=s,ce=r(()=>J(l),[l]),ue=b||g,de=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ps(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);qr("AreaChart",ce,"xAccessor",h),qr("AreaChart",ce,"yAccessor",f);const he=Jr({data:ce,rawData:l,colorBy:ue,colorScheme:x,legendInteraction:G,legendPosition:X,selection:H,linkedHover:W,fallbackFields:ue?["string"==typeof ue?ue:""]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:z,chartType:"AreaChart",chartId:E,showLegend:ne,userMargin:a,marginDefaults:s.marginDefaults,loading:R,loadingContent:$,emptyContent:Y,width:Q,height:Z}),{effectiveData:fe,statisticalAnnotations:ge}=cs({data:ce,xAccessor:h,yAccessor:f,forecast:P,anomaly:L,groupBy:g}),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ve}=gs({safeData:fe,data:l,areaBy:g,lineDataAccessor:v,colorBy:ue,colorScale:he.colorScale,color:V,stroke:q,strokeWidth:U,opacity:K,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,areaOpacity:k,showLine:O,lineWidth:S,showPoints:C,pointRadius:M,xAccessor:h,yAccessor:f,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,groupField:g||b,band:N}),be=Qr({componentName:"AreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:pe}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),N&&{band:N}),de&&{gradientFill:de}),A&&{lineGradient:A}),{curve:w,lineStyle:ye}),C&&me&&{pointStyle:me}),{size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he.margin,showAxes:s.showAxes,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,enableHover:ee}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:te}),he.legendBehaviorProps),ds({title:oe,description:ie,summary:re,accessibleTable:se,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===j?{tooltipContent:ci(),tooltipMode:"multi"}:fs({tooltip:j,defaultTooltipContent:ve})),hs({linkedHover:W,onObservation:D,onClick:I,hoverHighlight:z,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),F&&{xExtent:F}),B&&{yExtent:B}),he.crosshairProps),T);return he.earlyReturn?he.earlyReturn:be?e(Ir,{componentName:"AreaChart",message:be,width:Q,height:Z}):e($r,{componentName:"AreaChart",width:Q,height:Z,children:e(Vi,Object.assign({ref:o},xe))})});function ms(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}ys.displayName="AreaChart";const vs=f(function(n,o){const s=i(null),l=Lr(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:f,yFormat:g,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:w="var(--semiotic-danger, #dc2626)",seriesBColor:k="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:O=1.5,showPoints:S=!1,pointRadius:C=3,curve:M="linear",areaOpacity:j=.6,gradientFill:_,tooltip:P,annotations:L,xExtent:N,yExtent:F,frameProps:B={},selection:T,linkedHover:H,onObservation:W,onClick:D,hoverHighlight:I,chartId:z,loading:E,loadingContent:R,emptyContent:$,legendInteraction:Y,legendPosition:G,pointIdAccessor:X,windowSize:V}=n,{width:q,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:ie,yLabel:re}=l,se=r(()=>"function"==typeof y?e=>ms(y(e)):e=>ms(e[y]),[y]),le=r(()=>"function"==typeof m?e=>ms(m(e)):e=>ms(e[m]),[m]),ae=r(()=>"function"==typeof v?e=>ms(v(e)):e=>ms(e[v]),[v]),[ce,ue]=d([]),de=i([]),he=null==c,fe=r(()=>J(he?ce:c),[he,ce,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let s=0,l=null,a=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],g=t(r),p=n(r),y=o(r);if(!Number.isFinite(g)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=l){if(a&&a.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-a.a-(y-a.b);if(0!==n){const o=Math.max(0,Math.min(1,(a.b-a.a)/n));e=a.x+o*(g-a.x),t=a.a+o*(p-a.a)}else e=a.x,t=a.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t}),s++,l=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],l)}else for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else{l=m;for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else c.push({x:g,y:p,datum:r})}for(const e of c)f(e,null!=l?l:"A");return r}(fe,se,le,ae),[fe,se,le,ae]),pe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),s=n(e),l=o(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(l)&&r.push({__x:i,__y:l,__diffSegment:"line-B"})}return r}(fe,se,le,ae):[],[A,fe,se,le,ae]),ye=r(()=>[...ge,...pe],[ge,pe]),me=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=V&&e.length>V?e.slice(e.length-V):e;de.current=t,ue(t)},t=X?"function"==typeof X?X:e=>e[X]:null;return{push:t=>e([...de.current,t]),pushMany:t=>e([...de.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of de.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],s=de.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>he?de.current:fe,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[he,fe,X,V]);const ve=Jr({data:fe,rawData:c,colorBy:"__diffWinner",colorScheme:[w,k],legendInteraction:Y,legendPosition:G,selection:T,linkedHover:H,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:W,onClick:D,hoverHighlight:I,chartType:"DifferenceChart",chartId:z,showLegend:Z,userMargin:u,marginDefaults:l.marginDefaults,loading:E,loadingContent:R,emptyContent:$,width:q,height:U}),be=r(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:w},{label:x,color:k}]}]}},[Z,b,x,w,k]),xe=a(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?w:k,stroke:"none",fillOpacity:j}},[w,k,j]),we=a(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?w:k,strokeWidth:O,fill:"none"}),[w,k,O]),ke=a(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?w:k,r:C}),[w,k,C]),Ae=a(n=>{var o;const i=n.data,r=n.allSeries,s=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let l=null==i?void 0:i.__valA,a=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(l=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=s&&(null==l||null==a)){const e=fe.find(e=>se(e)===s);e&&(null==l&&(l=le(e)),null==a&&(a=ae(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=f&&null!=s?f(s):null!=s?s+"":"";return t("div",{className:"semiotic-tooltip",style:ri,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(l)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(a)]})]}),null!=l&&null!=a&&Number.isFinite(l)&&Number.isFinite(a)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(l-a)]})]})},[fe,se,le,ae,f,w,k,b,x]),Oe="multi"===P,Se=r(()=>!1===P?()=>null:Oe?Ae:ui(P)||Ae,[P,Oe,Ae]);if(ve.earlyReturn)return ve.earlyReturn;const Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:ye,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:me,curve:M,areaStyle:xe,lineStyle:we},S&&{pointStyle:ke}),{size:[q,U],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:l.showAxes,xLabel:ie,yLabel:re,xFormat:f,yFormat:g,enableHover:K,showGrid:Q}),_&&{gradientFill:!0===_?{topOpacity:.85,bottomOpacity:.15}:_}),be&&{legend:be,legendPosition:ve.legendPosition}),ds({title:ee,description:te,summary:ne,accessibleTable:oe,className:h,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:Se}),Oe&&{tooltipMode:"multi"}),hs({linkedHover:H,onObservation:W,onClick:D,hoverHighlight:I,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),N&&{xExtent:N}),F&&{yExtent:F}),ve.crosshairProps),B);return e($r,{componentName:"DifferenceChart",width:q,height:U,children:e(Vi,Object.assign({ref:s},Ce))})});"function"==typeof vs&&(vs.displayName="DifferenceChart");const bs=f(function(t,n){const o=i(null),s=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:w=2,showPoints:k=!1,pointRadius:A=3,normalize:O=!1,baseline:S="zero",stackOrder:C,tooltip:M,annotations:j,xExtent:_,yExtent:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:D,loadingContent:I,emptyContent:z,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:G,opacity:X}=t,{width:V,height:q,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>J(l),[l]),se=y||g;ns(n,{variant:"xy",frameRef:o});const le=Jr({data:re,rawData:l,colorBy:se,colorScheme:m,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"StackedAreaChart",chartId:W,showLegend:Q,userMargin:a,marginDefaults:s.marginDefaults,loading:D,loadingContent:I,emptyContent:z,width:V,height:q}),{flattenedData:ae,lineStyle:ce,pointStyle:ue,defaultTooltipContent:de}=gs({safeData:re,data:l,areaBy:g,lineDataAccessor:p,colorBy:se,colorScale:le.colorScale,color:$,stroke:Y,strokeWidth:G,opacity:X,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:w,showPoints:k,pointRadius:A,xAccessor:h,yAccessor:f,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,groupField:g||y}),he=Qr({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:ae}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0,curve:v,normalize:O,baseline:O?"zero":S,stackOrder:C,lineStyle:ce}),k&&ue&&{pointStyle:ue}),{size:[V,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),le.legendBehaviorProps),ds({title:Z,description:ee,summary:te,accessibleTable:ne,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===M?{tooltipContent:ci(),tooltipMode:"multi"}:fs({tooltip:M,defaultTooltipContent:de})),hs({linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),j&&j.length>0&&{annotations:j}),_&&{xExtent:_}),P&&{yExtent:P}),le.crosshairProps),L);return le.earlyReturn?le.earlyReturn:he?e(Ir,{componentName:"StackedAreaChart",message:he,width:V,height:q}):e($r,{componentName:"StackedAreaChart",width:V,height:q,children:e(Vi,Object.assign({ref:o},fe))})});function xs(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:s,fillOpacity:l=1,fallbackFill:a,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=l),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=qe(o,t,n)}}else u.fill=a?a(e):o||xr;return void 0===u.r&&(u.r=s?s(e):i),u},[t,n,o,i,s,l,a,c,p]),m=r(()=>es(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>vr(m,null!=f?f:null,g),[m,f,g])}function ws(e){const{accessor:t,data:n,isPushMode:o}=e,s=i(null),[l,c]=d(0),u=a(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,n=!0),i>s.current[1]&&(s.current[1]=i,n=!0)):(s.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=a(()=>{o&&(s.current=null,c(e=>e+1))},[o]),f=r(()=>{var e;if(o)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,l=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>l&&(l=n))}return Number.isFinite(r)&&Number.isFinite(l)?[r,l]:void 0},[n,t,o,l]);return{domain:f,trackPushed:u,reset:h}}function ks(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}bs.displayName="StackedAreaChart";const As=f(function(t,n){const s=i(null),l=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:w=[3,15],symbolBy:k,symbolMap:A,pointRadius:O=5,pointOpacity:S=.8,tooltip:C,marginalGraphics:M,pointIdAccessor:j,annotations:_,regression:P,forecast:L,anomaly:N,xExtent:F,yExtent:B,frameProps:T={},selection:H,linkedHover:W,linkedBrush:D,onObservation:I,onClick:z,hoverHighlight:E,chartId:R,loading:$,loadingContent:Y,emptyContent:G,legendInteraction:X,legendPosition:V,color:q,stroke:U,strokeWidth:K,opacity:Q}=t,{width:Z,height:ee,enableHover:te,showGrid:ne,showLegend:oe,title:ie,description:re,summary:se,accessibleTable:le,xLabel:ae,yLabel:ce}=l,ue=r(()=>J(c),[c]),de=void 0===c,{domain:he,trackPushed:fe,reset:ge}=ws({accessor:x,data:ue,isPushMode:de}),pe=a(e=>{var t;fe([e]),null===(t=s.current)||void 0===t||t.push(e)},[fe]),ye=a(e=>{var t;fe(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[fe]);ns(n,{variant:"xy",frameRef:s,overrides:{push:pe,pushMany:ye,clear:()=>{var e;ge(),null===(e=s.current)||void 0===e||e.clear()}},deps:[pe,ye,ge]});const me=Jr({data:ue,rawData:c,colorBy:v,colorScheme:b,legendInteraction:X,legendPosition:V,selection:H,linkedHover:W,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:I,onClick:z,hoverHighlight:E,chartType:"Scatterplot",chartId:R,showLegend:oe,userMargin:u,marginDefaults:l.marginDefaults,loading:$,loadingContent:Y,emptyContent:G,width:Z,height:ee}),ve=mr(D),be=lr({name:(null==ve?void 0:ve.name)||"__unused_brush__",xField:(null==ve?void 0:ve.xField)||("string"==typeof g?g:void 0),yField:(null==ve?void 0:ve.yField)||("string"==typeof p?p:void 0)}),xe=ve?"xyBrush"===be.brushInteraction.brush?"xy":"xBrush"===be.brushInteraction.brush?"x":"y":void 0,we=o.useRef(be.brushInteraction);we.current=be.brushInteraction;const ke=a(e=>{const t=we.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);qr("Scatterplot",ue,"xAccessor",g),qr("Scatterplot",ue,"yAccessor",p);const Ae=r(()=>x?null!=he?he:[0,1]:void 0,[x,he]),Oe=r(()=>x?e=>Ke(e,x,w,Ae):void 0,[x,w,Ae]),Se=xs({colorBy:v,colorScale:me.colorScale,color:q,pointRadius:O,fillOpacity:S,radiusFn:Oe,stroke:U,strokeWidth:K,opacity:Q,effectiveSelectionHook:me.effectiveSelectionHook,resolvedSelection:me.resolvedSelection}),Ce=r(()=>Dr([{label:ae||Fr(g),accessor:g,role:"x",format:h},{label:ce||Fr(p),accessor:p,role:"y",format:f},...v?[{label:Fr(v),accessor:v,role:"color"}]:[],...x?[{label:Fr(x),accessor:x,role:"size"}]:[]]),[g,p,ae,ce,v,x,h,f]),{effectiveData:Me,statisticalAnnotations:je}=cs({data:ue,xAccessor:g,yAccessor:p,forecast:L,anomaly:N}),_e=r(()=>{const e=ks(P);return e||0!==je.length?[...e?[e]:[],..._||[],...je]:_},[P,_,je]);if(me.earlyReturn)return me.earlyReturn;const Pe=Qr({componentName:"Scatterplot",data:c,accessors:{xAccessor:g,yAccessor:p}});if(Pe)return e(Ir,{componentName:"Scatterplot",message:Pe,width:Z,height:ee});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:Me}),{xAccessor:g,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0}),k&&{symbolAccessor:k}),A&&{symbolMap:A}),{sizeRange:w,pointStyle:Se,colorScheme:b,size:[Z,ee],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,showAxes:l.showAxes,xLabel:ae,yLabel:ce,xFormat:h,yFormat:f,enableHover:te,showGrid:ne}),me.legendBehaviorProps),ds({title:ie,description:re,summary:se,accessibleTable:le,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fs({tooltip:C,defaultTooltipContent:Ce})),hs({linkedHover:W,onObservation:I,onClick:z,hoverHighlight:E,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior})),M&&{marginalGraphics:M}),j&&{pointIdAccessor:j}),_e&&_e.length>0&&{annotations:_e}),F&&{xExtent:F}),B&&{yExtent:B}),ve&&{brush:{dimension:xe},onBrush:ke}),me.crosshairProps),T);return e($r,{componentName:"Scatterplot",width:Z,height:ee,children:e(Vi,Object.assign({ref:s},Le))})});function Os(e,t){return He(1===t?.5:e/(t-1))}As.displayName="Scatterplot";const Ss=f(function(t,o){var s,l;const a=i(null);ns(o,{variant:"xy",frameRef:a});const c=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:f,yFormat:g,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:w,annotations:k,regression:A,forecast:O,anomaly:S,xExtent:C,yExtent:M,frameProps:j={},selection:_,linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,chartId:B,loading:T,loadingContent:H,emptyContent:W,legendInteraction:D,stroke:I,strokeWidth:z,opacity:E}=t,{width:R,height:$,enableHover:Y,showGrid:G,title:X,description:V,summary:q,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),l=t(s);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);qr("ConnectedScatterplot",J,"xAccessor",p),qr("ConnectedScatterplot",J,"yAccessor",y);const te=Jr({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:D,selection:_,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:N,hoverHighlight:F,chartType:"ConnectedScatterplot",chartId:B,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:T,loadingContent:H,emptyContent:W,width:R,height:$}),ne=null!==(l=null===(s=te.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==l?l:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const l=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=s[t],o=s[t+1],d=Os(t,u),h=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(r=o.datum)&&void 0!==r?r:o),f=l?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,s;const l=t.filter(e=>"point"===e.type);if(2>l.length)return null;const a=l.length,c=100>a,u=[];for(let t=0;a-1>t;t++){const n=l[t],o=l[t+1],i=Os(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,f=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:f},"seg-"+t))}return e(n,{children:u})},[b]),se=r(()=>[re],[re]),le=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?Os(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),ae=xs({colorScale:void 0,baseStyleExtras:le,stroke:I,strokeWidth:z,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>Dr([{label:K||Fr(p),accessor:p,role:"x",format:f},{label:Q||Fr(y),accessor:y,role:"y",format:g},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,f,g]),de=Qr({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:fe}=cs({data:J,xAccessor:p,yAccessor:y,forecast:O,anomaly:S});if(te.earlyReturn)return te.earlyReturn;const ge=ks(A),pe=ge||fe.length>0?[...ge?[ge]:[],...k||[],...fe]:k,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:ae,size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:f,yFormat:g,enableHover:Y,showGrid:G}),ds({title:X,description:V,summary:q,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fs({tooltip:x,defaultTooltipContent:ue})),hs({linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),w&&{pointIdAccessor:w}),{canvasPreRenderers:ie,svgPreRenderers:se}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),M&&{yExtent:M}),te.crosshairProps),j);return de?e(Ir,{componentName:"ConnectedScatterplot",message:de,width:R,height:$}):e($r,{componentName:"ConnectedScatterplot",width:R,height:$,children:e(Vi,Object.assign({ref:a},ye))})});Ss.displayName="ConnectedScatterplot";const Cs=f(function(t,n){const o=i(null),s=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:g="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:w="white",tooltip:k,marginalGraphics:A,pointIdAccessor:O,annotations:S,regression:C,xExtent:M,yExtent:j,frameProps:_={},selection:P,linkedHover:L,linkedBrush:N,onObservation:F,onClick:B,hoverHighlight:T,chartId:H,loading:W,loadingContent:D,emptyContent:I,legendInteraction:z,legendPosition:E,color:R,stroke:$,strokeWidth:Y,opacity:G}=t,{width:X,height:V,enableHover:q,showGrid:U,showLegend:K,title:Q,description:Z,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=s,ie=r(()=>J(l),[l]),re=void 0===l,se=Jr({data:ie,rawData:l,colorBy:m,colorScheme:v,legendInteraction:z,legendPosition:E,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:T,chartType:"BubbleChart",chartId:H,showLegend:K,userMargin:c,marginDefaults:s.marginDefaults,loading:W,loadingContent:D,emptyContent:I,width:X,height:V}),{domain:le,trackPushed:ae,reset:ce}=ws({accessor:p,data:ie,isPushMode:re}),ue=a(e=>{var t;ae([e]),null===(t=o.current)||void 0===t||t.push(e)},[ae]),de=a(e=>{var t;ae(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[ae]);ns(n,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{var e;ce(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ue,de,ce]});const he=mr(N);lr({name:(null==he?void 0:he.name)||"__unused_brush__",xField:(null==he?void 0:he.xField)||("string"==typeof f?f:void 0),yField:(null==he?void 0:he.yField)||("string"==typeof g?g:void 0)});const fe=r(()=>({stroke:w,strokeWidth:x}),[w,x]),ge=r(()=>null!=le?le:[0,1],[le]),pe=a(e=>Ke(e,p,y,ge),[p,y,ge]),ye=xs({colorBy:m,colorScale:se.colorScale,color:R,fillOpacity:b,radiusFn:pe,baseStyleExtras:fe,stroke:$,strokeWidth:Y,opacity:G,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),me=r(()=>Dr([{label:ne||Fr(f),accessor:f,role:"x",format:d},{label:oe||Fr(g),accessor:g,role:"y",format:h},{label:Fr(p),accessor:p,role:"size"},...m?[{label:Fr(m),accessor:m,role:"color"}]:[]]),[f,g,ne,oe,p,m,d,h]);if(se.earlyReturn)return se.earlyReturn;const ve=Qr({componentName:"BubbleChart",data:l,accessors:{xAccessor:f,yAccessor:g},requiredProps:{sizeBy:p}});if(ve)return e(Ir,{componentName:"BubbleChart",message:ve,width:X,height:V});const be=ks(C),xe=be?[be,...S||[]]:S,we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=l&&{data:ie}),{xAccessor:f,yAccessor:g,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:ye,colorScheme:v,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ne,yLabel:oe,xFormat:d,yFormat:h,enableHover:q,showGrid:U}),se.legendBehaviorProps),ds({title:Q,description:Z,summary:ee,accessibleTable:te,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fs({tooltip:k,defaultTooltipContent:me})),hs({linkedHover:L,onObservation:F,onClick:B,hoverHighlight:T,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),xe&&xe.length>0&&{annotations:xe}),M&&{xExtent:M}),j&&{yExtent:j}),se.crosshairProps),_);return e($r,{componentName:"BubbleChart",width:X,height:V,children:e(Vi,Object.assign({ref:o},we))})});Cs.displayName="BubbleChart";const Ms=f(function(t,n){var o;const s=i(null);ns(n,{variant:"xy",frameRef:s});const l=Lr(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:k,yExtent:A,frameProps:S={},selection:C,linkedHover:M,onObservation:j,onClick:_,hoverHighlight:P,chartId:L,loading:N,loadingContent:F,emptyContent:B,showLegend:T,legendPosition:H,legendInteraction:W}=t,{width:D,height:I,enableHover:z,title:E,description:R,summary:$,accessibleTable:Y,xLabel:G,yLabel:X}=l,V=Vr(N,D,I,F),q=V?null:Xr(a,D,I,B),U=r(()=>J(a),[a]),K=function(){var e;const t=br();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Q=null!==(o=null!=y?y:K)&&void 0!==o?o:"blues",Z=null!=T&&T,ee=null!=H?H:"right",{margin:te}=jr({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:ee,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:ne,customClickBehavior:oe,crosshairSourceId:ie}=Cr({selection:C,linkedHover:M,fallbackFields:[],onObservation:j,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Zr(C);const re=Mr(M,ie);_r(W,void 0,[]);const se=r(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),le=r(()=>mn(U.map(se)),[U,se]),ae=r(()=>{if("custom"===Q&&m)return m;const e=$e(Q);return O(e).domain(le)},[Q,m,le]),ce=r(()=>Dr([{label:G||Fr(d),accessor:d,role:"x",format:g},{label:X||Fr(h),accessor:h,role:"y",format:p},{label:Fr(f),accessor:f,role:"value",format:b}]),[d,h,G,X,f,g,p,b]),ue=Qr({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:f}}),de=r(()=>{if(Z)return{gradient:{colorFn:e=>ae(e),domain:le,label:"string"==typeof f?f:"value",format:b}}},[Z,ae,le,f,b]),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:f,colorScheme:"custom"!==Q?Q:void 0,showValues:v,heatmapValueFormat:b,size:[D,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,showAxes:l.showAxes,xLabel:G,yLabel:X,xFormat:g,yFormat:p,enableHover:z}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),de&&{legend:de,legendPosition:ee}),ds({title:E,description:R,summary:$,accessibleTable:Y,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fs({tooltip:x,defaultTooltipContent:ce})),hs({linkedHover:M,onObservation:j,onClick:_,hoverHighlight:P,customHoverBehavior:ne,customClickBehavior:oe})),w&&w.length>0&&{annotations:w}),k&&{xExtent:k}),A&&{yExtent:A}),re),S);return V||q||(ue?e(Ir,{componentName:"Heatmap",message:ue,width:D,height:I}):e($r,{componentName:"Heatmap",width:D,height:I,children:e(Vi,Object.assign({ref:s},he))}))});Ms.displayName="Heatmap";const js="__splomIdx",_s={top:4,bottom:4,left:4,right:4};function Ps({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),l=n-_s.left-_s.right,a=n-_s.top-_s.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[l,a]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[l,a]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(l),i.y.invert(a)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[l,a,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${_s.left},${_s.top})`})})}function Ls({data:n,xField:o,yField:r,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:f,unselectedOpacity:g,mode:p,onPointHover:y}){const m=i(null),v=ir({name:h,clientId:`splom-${o}-${r}`}),b=lr({name:h,xField:o,yField:r}),x=ir({name:f,clientId:"splom-hover-source"}),w=x.selectPoints,k=a(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=a(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[js];void 0!==n&&(w({[js]:[n]}),null==y||y(t,e.x+_s.left,e.y+_s.top))},[w,y]),O=a(e=>{const t={opacity:c,r:l};return t.fill=u?qe(e,u,d):xr,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*l,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=g),t},[u,d,c,l,p,v.isActive,v.predicate,x.isActive,x.predicate,g]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Vi,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:O,margin:_s,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ps,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:k})]})}function Ns({data:n,field:o,label:i,cellSize:s,bins:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const f=ir({name:u,clientId:"splom-diag-"+o}),g=ir({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?g:f,y=p.isActive,m=p.predicate,v=r(()=>{const e="string"==typeof a?a:null,t=[],i=new Set;for(const r of n){const n=r[o];if(null==n||isNaN(n)||t.push(Number(n)),e){const t=r[e];null!=t&&i.add(t+"")}}if(0===t.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[r,c]=mn(t),u=(c-r)/l||1,d=Array.from(i),h=new Map(d.map((e,t)=>[e,t])),f=Array(l).fill(0),g=Array(l).fill(0),p=Array.from({length:l},()=>Array(d.length).fill(0)),v=Array.from({length:l},()=>Array(d.length).fill(0));for(const t of n){const n=t[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-r)/u),l-1);if(f[i]++,y&&!m(t)||g[i]++,e){const n=h.get(t[e]+"");void 0!==n&&(p[i][n]++,y&&!m(t)||v[i][n]++)}}const b=vn(f,1),x=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:d[o]};return n+=i,r})}),w=v.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:d[o]};return n+=i,r})});return{bars:f.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/b*(s-24),count:e})),selectedBars:g.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/b*(s-24),count:e})),categoryBars:x,selectedCategoryBars:w,max:b,categories:d}},[n,o,l,s,y,m,a]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):xr,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:xr,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):xr,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:xr,opacity:.7},"sel-"+n)))]})}function Fs({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Bs(n){const{data:i,fields:s,fieldLabels:l={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:f=4,pointRadius:g=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:w=!1,tooltip:k,showLegend:A,idAccessor:O,className:S,onObservation:C,chartId:M}=n,j="splom",_="splom-hover",P=b?"hover":v?"brush":"hover",L=tr(e=>e.clearSelection),[N,F]=d(null),B=a(()=>{L(_),F(null)},[L,_]),T=r(()=>(i||[]).map((e,t)=>void 0!==e[js]?e:Object.assign(Object.assign({},e),{[js]:t})),[i]),H=Sr(T,c,u),W=void 0!==A?A:!!c,D=r(()=>{if(!W||!c)return null;const e="string"==typeof c?c:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:H?H(e+""):xr})):null},[W,c,T,H]),I=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:f+"px",width:"fit-content"}),[s,h,f,40]);return t("div",{className:S,style:{position:"relative"},children:[D&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:D.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:I,onMouseLeave:"hover"===P?B:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:l[n]||n}),s.map((t,o)=>i===o?"label"===y?e(Fs,{label:l[n]||n,cellSize:h},"diag-"+n):e(Ns,{data:T,field:n,label:l[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:H,brushSelectionName:j,hoverSelectionName:_,unselectedOpacity:x,mode:P},"diag-"+n):e(Ls,{data:T,xField:t,yField:n,fieldLabels:l,cellSize:h,pointRadius:g,pointOpacity:p,colorBy:c,colorScale:H,brushSelectionName:j,hoverSelectionName:_,unselectedOpacity:x,showGrid:w,tooltip:k,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(F({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:M})):(F(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:M}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:l[t]||t},"col-label-"+t))]}),N&&"hover"===P&&(()=>{const n=N.datum,o=l[N.xField]||N.xField,i=l[N.yField]||N.yField,r=c?"function"==typeof c?c(n):n[c]:null,s=O?"function"==typeof O?O(n):n[O]:"Row "+n[js];return t("div",{style:{position:"absolute",left:40+N.colIndex*(h+f)+N.px,top:N.rowIndex*(h+f)+N.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[N.xField]?Number(n[N.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[N.yField]?Number(n[N.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function Ts(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(yr,{selections:i,children:e(Bs,Object.assign({},t))})}function Hs({width:t,height:n,margin:o,scales:r,brushDirection:l,extent:a,onBrush:c}){const u=i(null),d=i(null),h=i(!1),f=t+o.left+o.right,g=n+o.top+o.bottom;return s(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===l?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===l?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,l,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===l?r.x:r.y;if(h.current=!0,a){const n=[t(a[0]),t(a[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[a,r,l]),e("svg",{ref:u,width:f,height:g,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Ws(n){var o,l;const{data:c,width:u=600,height:h=400,margin:f,className:g,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:w,xAccessor:k="x",yAccessor:A="y",lineBy:O,lineDataAccessor:S="coordinates",colorBy:C,colorScheme:M,curve:j="linear",lineWidth:_=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:N=!1,pointRadius:F=3,enableHover:B=!0,showGrid:T=!1,showLegend:H,legendPosition:W,tooltip:D,minimap:I={},renderBefore:z=!1,onBrush:E,brushExtent:R,yExtent:$,frameProps:Y={},loading:G,loadingContent:X,emptyContent:V}=n,q=Vr(G,u,h,X),U=q?null:Xr(c,u,h,V),K=r(()=>J(c),[c]),[Q,Z]=d(null),ee=null!=R?R:Q,te=a(e=>{R||Z(e),null==E||E(e)},[R,E]),ne=i(null),[oe,ie]=d(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=ne.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?ie(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const re=void 0!==(null===(o=K[0])||void 0===o?void 0:o[S]),se=r(()=>{if(re)return K;if(O){const e=K.reduce((e,t)=>{const n="function"==typeof O?O(t):t[O];if(!e[n]){const t={[S]:[]};"string"==typeof O&&(t[O]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:K}]},[K,O,S,re]),le=r(()=>re||O?se.flatMap(e=>{const t=e[S]||[];return O&&"string"==typeof O?t.map(t=>Object.assign(Object.assign({},t),{[O]:e[O]})):t}):K,[se,S,re,O,K]),ae=Sr(K,C,M),ce=ts({lineWidth:_,colorBy:C,colorScale:ae,fillArea:P,areaOpacity:L}),ue=r(()=>{if(I.lineStyle)return I.lineStyle},[I.lineStyle]),de=ts({lineWidth:1,colorBy:C,colorScale:ae}),he=null!=ue?ue:de,fe=r(()=>{if(N)return e=>{const t={r:F,fillOpacity:1};return t.fill=C?qe(e.parentLine||e,C,ae):xr,t}},[N,F,C,ae]),{legend:ge,margin:pe,legendPosition:ye}=jr({data:se,colorBy:C,colorScale:ae,showLegend:H,legendPosition:W,userMargin:f}),me=I.height||60,ve=r(()=>{var e,t,n,o,i,r,s,l;return{top:null!==(t=null===(e=I.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=I.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=I.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:pe.left,right:null!==(l=null===(s=I.margin)||void 0===s?void 0:s.right)&&void 0!==l?l:pe.right}},[I.margin,pe]),be=I.brushDirection||"x",xe=r(()=>Dr([{label:v||Fr(k),accessor:k,role:"x",format:x},{label:b||Fr(A),accessor:A,role:"y",format:w}]),[k,A,v,b,x,w]),we=Qr({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:A}});if(we)return e(Ir,{componentName:"MinimapChart",message:we,width:u,height:h});const ke=P?"area":"line",Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ke,data:le,xAccessor:k,yAccessor:A,groupAccessor:O||void 0,curve:j,lineStyle:ce},N&&{pointStyle:fe}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:w,enableHover:B,showGrid:T}),ge&&{legend:ge,legendPosition:ye}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===D?()=>null:ui(D)||xe}),ee&&{xExtent:ee}),$&&{yExtent:$}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),Y),Oe=Object.assign({chartType:ke,data:le,xAccessor:k,yAccessor:A,groupAccessor:O||void 0,curve:j,lineStyle:he,size:[u,me+ve.top+ve.bottom],margin:ve,showAxes:null!==(l=I.showAxes)&&void 0!==l&&l,background:I.background,enableHover:!1},$&&{yExtent:$}),Se=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Vi,Object.assign({ref:ne},Oe)),e(Hs,{width:u-ve.left-ve.right,height:me,margin:ve,scales:oe,brushDirection:be,extent:ee,onBrush:te})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e(Vi,Object.assign({},Ae))},"main");return q||U||e($r,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(g?" "+g:""),children:[z?Se:Ce,z?Ce:Se]})})}Ts.displayName="ScatterplotMatrix",Ws.displayName="MinimapChart";const Ds={label:"Low / High",color:"#E9C46A",opacity:.08},Is={label:"High / High",color:"#2A9D8F",opacity:.08},zs={label:"Low / Low",color:"#E76F51",opacity:.08},Es={label:"High / Low",color:"#86BBD8",opacity:.08};function Rs(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const $s=f(function(o,s){const l=i(null);ns(s,{variant:"xy",frameRef:l});const a=Lr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:w=12,colorBy:k,colorScheme:A,sizeBy:O,sizeRange:S=[3,15],pointRadius:C=5,pointOpacity:M=.8,tooltip:j,pointIdAccessor:_,annotations:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:D,loadingContent:I,emptyContent:z,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:G,opacity:X}=o,{width:V,height:q,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=a,re=r(()=>({topLeft:Rs(Ds,null==v?void 0:v.topLeft),topRight:Rs(Is,null==v?void 0:v.topRight),bottomLeft:Rs(zs,null==v?void 0:v.bottomLeft),bottomRight:Rs(Es,null==v?void 0:v.bottomRight)}),[v]),se=r(()=>J(c),[c]),le=Jr({data:se,rawData:c,colorBy:k,colorScheme:A,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:"string"==typeof k?[k]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"QuadrantChart",chartId:W,showLegend:Q,userMargin:u,marginDefaults:a.marginDefaults,loading:D,loadingContent:I,emptyContent:z,width:V,height:q});qr("QuadrantChart",se,"xAccessor",g),qr("QuadrantChart",se,"yAccessor",p);const ae=r(()=>{if(!se.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of se){const l=e(s),a=t(s);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>r&&(r=a))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const s=.1*(o-n)||1,l=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-l,r+l]}},[se,g,p,y,m]),ce=r(()=>{if(!O||0===se.length)return;const e=se.map(e=>"function"==typeof O?O(e):e[O]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?mn(e):void 0},[se,O]),ue=r(()=>"function"==typeof g?g:e=>+e[g],[g]),de=r(()=>"function"==typeof p?p:e=>+e[p],[p]),he=r(()=>e=>{const t=ue(e),n=de(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?$||xr:i&&o?re.topRight.color:i&&!o?re.topLeft.color:!i&&o?re.bottomRight.color:re.bottomLeft.color},[ue,de,y,m,re,$]),fe=r(()=>O?e=>Ke(e,O,S,ce):void 0,[O,S,ce]),ge=xs({colorBy:k,colorScale:le.colorScale,color:$,pointRadius:C,fillOpacity:M,radiusFn:fe,fallbackFill:he,stroke:Y,strokeWidth:G,opacity:X,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection}),pe=r(()=>{if(!se.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof O&&e.add(O);const t=se[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[se,g,p,k,O]),ye=r(()=>Dr([...pe?[{label:pe,accessor:pe,role:"title"}]:[],{label:oe||Fr(g),accessor:g,role:"x",format:h},{label:ie||Fr(p),accessor:p,role:"y",format:f},...k?[{label:Fr(k),accessor:k,role:"color"}]:[],...O?[{label:Fr(O),accessor:O,role:"size"}]:[]]),[pe,g,p,oe,ie,k,O,h,f]),me=Qr({componentName:"QuadrantChart",data:c,accessors:{xAccessor:g,yAccessor:p}}),ve=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,l=i.height,a=null!=y?o.x(y):s/2,c=null!=m?o.y(m):l/2;if(null!=y&&!isFinite(a))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(s,a)),d=Math.max(0,Math.min(l,c)),h=[{config:re.topLeft,x:0,y:0,w:u,h:d},{config:re.topRight,x:u,y:0,w:s-u,h:d},{config:re.bottomLeft,x:0,y:d,w:u,h:l-d},{config:re.bottomRight,x:u,y:d,w:s-u,h:l-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,l),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[y,m,re,b]),be=r(()=>x?[...ve,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=y?n.x(y):i/2,l=null!=m?n.y(m):r/2;(null==y||isFinite(s))&&(null==m||isFinite(l))&&(e.font=`600 ${w}px sans-serif`,e.globalAlpha=.5,e.fillStyle=re.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(re.topLeft.label,8,8),e.fillStyle=re.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(re.topRight.label,i-8,8),e.fillStyle=re.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(re.bottomLeft.label,8,r-8),e.fillStyle=re.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(re.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ve,[ve,x,w,re,y,m]),xe=r(()=>{const e=L.canvasPreRenderers||[];return[...be,...e]},[be,L.canvasPreRenderers]),we=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const l=s.width,a=s.height,c=null!=y?r.x(y):l/2,u=null!=m?r.y(m):a/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(l,c)),h=Math.max(0,Math.min(a,u));return t(n,{children:[[{config:re.topLeft,x:0,y:0,w:d,h:h},{config:re.topRight,x:d,y:0,w:l-d,h:h},{config:re.bottomLeft,x:0,y:h,w:d,h:a-h},{config:re.bottomRight,x:d,y:h,w:l-d,h:a-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:a,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:l,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+w,fill:re.topLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:re.topLeft.label}),e("text",{x:l-8,y:8+w,fill:re.topRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:re.topRight.label}),e("text",{x:8,y:a-8,fill:re.bottomLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:re.bottomLeft.label}),e("text",{x:l-8,y:a-8,fill:re.bottomRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:re.bottomRight.label})]})]})}]},[y,m,re,b,x,w]);if(le.earlyReturn)return le.earlyReturn;const ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:se}),{xAccessor:g,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:O||void 0,sizeRange:S,pointStyle:ge,colorScheme:A,size:[V,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ie,xFormat:h,yFormat:f,enableHover:U,showGrid:K}),ae&&{xExtent:ae.xExtent,yExtent:ae.yExtent}),le.legendBehaviorProps),Z&&{title:Z}),ee&&{description:ee}),te&&{summary:te}),void 0!==ne&&{accessibleTable:ne}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?ye:ui(j)||ye}),(F||B||T||H)&&{customHoverBehavior:le.customHoverBehavior}),(B||T||F)&&{customClickBehavior:le.customClickBehavior}),_&&{pointIdAccessor:_}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:xe}),le.crosshairProps),L),xe.length>0&&{canvasPreRenderers:xe}),{svgPreRenderers:we});return me?e(Ir,{componentName:"QuadrantChart",message:me,width:V,height:q}):e($r,{componentName:"QuadrantChart",width:V,height:q,children:e(Vi,Object.assign({ref:l},ke))})});$s.displayName="QuadrantChart";const Ys="__ma_unitized",Gs="__ma_series";function Xs(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Vs(e,t){return t[0]+e*(t[1]-t[0])}const qs=f(function(t,n){var s;const l=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!l.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},o),{[Ys]:Xs(r,i),[Gs]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!l.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&o.push(Object.assign(Object.assign({},e),{[Ys]:Xs(s,r),[Gs]:i.label||"Series "+(t+1)}))}l.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const d=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:f,className:g,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:w=2,tooltip:k,annotations:A,frameProps:O={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:P,loading:L,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:T,stroke:H,strokeWidth:W,opacity:D}=t,{width:I,height:z,enableHover:E,showGrid:R,showLegend:$=!0,title:Y,description:G,summary:X,accessibleTable:V,xLabel:q}=d,U=r(()=>J(h),[h]),K=r(()=>J(v),[v]),Q=K,Z=2===K.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||Z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${K.length}. Rendering as a standard multi-line chart.`);const ee=Vr(L,I,z,N),te=ee?null:Xr(h,I,z,F),ne=Or(),oe=r(()=>{let e;if(Array.isArray(b))e=b;else if(ne&&ne.length>0)e=ne;else{const t=Ye[b];e=Array.isArray(t)?t:Ge}return Q.map((t,n)=>t.color||e[n%e.length])},[Q,b,ne]),ie=r(()=>K.map((e,t)=>e.label||"Series "+(t+1)),[K]),{unitizedData:re,extents:se}=r(()=>{if(0===U.length){const e=K.map(e=>e.extent||null).filter(Boolean);return e.length===K.length&&(c.current=e),{unitizedData:[],extents:e.length===K.length?e:[]}}const e=K.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(U,e.yAccessor));if(c.current=e,!Z){const t=[];for(const e of U)for(let n=0;K.length>n;n++){const o=K[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Ys]:i,[Gs]:ie[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of U)for(let o=0;2>o;o++){const i=K[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Ys]:Xs(r,e[o]),[Gs]:ie[o]}))}return{unitizedData:t,extents:e}},[U,K,Z,ie]),le=r(()=>{if(Z&&se.length>=2)return[{orient:"left",label:ie[0],tickFormat:K[0].format||(e=>{const t=Vs(e,se[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ie[1],tickFormat:K[1].format||(e=>{const t=Vs(e,se[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Z,se,K,ie]),ae=Jr({data:r(()=>re.length>0?re:ie.map(e=>({[Gs]:e})),[re,ie]),rawData:h,colorBy:Gs,colorScheme:oe,legendInteraction:B,legendPosition:T,selection:S,linkedHover:C,fallbackFields:[Gs],unwrapData:!1,onObservation:M,onClick:j,hoverHighlight:_,chartType:"MultiAxisLineChart",chartId:P,showLegend:$,userMargin:f,marginDefaults:Z?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:N,emptyContent:F,width:I,height:z}),ce=r(()=>{const e=new Map;return ie.forEach((t,n)=>e.set(t,oe[n])),e},[ie,oe]),ue=ts({lineWidth:w,resolveStroke:a(e=>ce.get(e[Gs])||oe[0],[ce,oe]),stroke:H,strokeWidth:W,opacity:D,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),de=r(()=>{if(!1===k)return()=>null;return ui(k)||(e=>{var t;const n=e.data||e,i=n[Gs],r=ie.indexOf(i),s=n[Ys],l=Z&&r>=0&&se[r]?Vs(s,se[r]):s,a=r>=0&&(null===(t=K[r])||void 0===t?void 0:t.format)?K[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:oe[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${a(l)}`))})},[k,ie,oe,se,Z,K,m]);if(ae.earlyReturn)return ae.earlyReturn;const he=Qr({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),fe=Z?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:re}),{xAccessor:m,yAccessor:Ys,groupAccessor:Gs,lineStyle:ue,colorScheme:oe,size:[I,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:d.showAxes}),le&&{axes:le}),{xLabel:q}),Z?{}:{yLabel:ie[0]}),{xFormat:y}),Z&&fe&&{yExtent:fe}),{enableHover:E}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:R,curve:x}),ae.legendBehaviorProps),Y&&{title:Y}),G&&{description:G}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:de}),A&&{annotations:A}),(C||M||j||_)&&{customHoverBehavior:ae.customHoverBehavior}),(M||j||C)&&{customClickBehavior:ae.customClickBehavior}),ae.crosshairProps),O);return ee||te||(he?e(Ir,{componentName:"MultiAxisLineChart",message:he,width:I,height:z}):e($r,{componentName:"MultiAxisLineChart",width:I,height:z,children:e(Vi,Object.assign({ref:l},ge))}))});function Us(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}qs.displayName="MultiAxisLineChart";const Ks=f(function(t,n){const o=i(null);ns(n,{variant:"xy",frameRef:o});const s=Lr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:f="high",lowAccessor:g="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:C,chartId:M,loading:j,loadingContent:_,emptyContent:P}=t,{width:L,height:N,enableHover:F,showGrid:B,title:T,description:H,summary:W,accessibleTable:D,xLabel:I,yLabel:z}=s,E=Vr(j,L,N,_),R=E?null:Xr(l,L,N,P),$=r(()=>J(l),[l]),Y=null==p||null==y;qr("CandlestickChart",$,"xAccessor",h),qr("CandlestickChart",$,"highAccessor",f),qr("CandlestickChart",$,"lowAccessor",g),Y||(qr("CandlestickChart",$,"openAccessor",p),qr("CandlestickChart",$,"closeAccessor",y));const{customHoverBehavior:G,customClickBehavior:X,crosshairSourceId:V}=Cr({selection:A,linkedHover:O,onObservation:S,onClick:C,chartType:"CandlestickChart",chartId:M}),q=Mr(O,V),U=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?n:Object.assign(Object.assign({},n),Us(a))},[a,s.marginDefaults,t.mode]),K=r(()=>{const e=[{label:I||Fr(h),accessor:h,role:"x",format:u}];return Y?(e.push({label:"High",accessor:f,role:"y",format:d}),e.push({label:"Low",accessor:g,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:f,format:d}),e.push({label:"Low",accessor:g,format:d}),e.push({label:"Close",accessor:y,format:d})),Dr(e)},[h,I,u,d,f,g,p,y,Y]),Q=Qr({componentName:"CandlestickChart",data:l,accessors:Object.assign({xAccessor:h,highAccessor:f,lowAccessor:g},!Y&&{openAccessor:p,closeAccessor:y})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),ee=L>200?.1:.02,te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=l&&{data:$}),{xAccessor:h,yAccessor:f,highAccessor:f,lowAccessor:g}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Z,extentPadding:ee,size:[L,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:s.showAxes,xLabel:I,yLabel:z,xFormat:u,yFormat:d,enableHover:F,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ds({title:T,description:H,summary:W,accessibleTable:D,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fs({tooltip:v,defaultTooltipContent:K})),hs({linkedHover:O,onObservation:S,onClick:C,customHoverBehavior:G,customClickBehavior:X})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),w&&{yExtent:w}),q),k);return E||R||(Q?e(Ir,{componentName:"CandlestickChart",message:Q,width:L,height:N}):e($r,{componentName:"CandlestickChart",width:L,height:N,children:e(Vi,Object.assign({ref:o},te))}))});Ks.displayName="CandlestickChart";const Qs=f(function(t,n){const{data:o,layout:s,layoutConfig:l,xExtent:a,yExtent:c,showAxes:u=!1,margin:d,className:h,annotations:f,onObservation:g,onClick:p,selection:y,linkedHover:m,chartId:v,loading:b,loadingContent:x,emptyContent:w,colorScheme:k,frameProps:A={}}=t,{frameRef:O,resolved:S,safeData:C,setup:M,earlyReturn:j}=function(e){var t;const n=function(e){const t=i(null);return ns(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Lr(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>Us(e.margin),[e.margin])}}(e),{resolved:o,normalizedMargin:s}=n,l=Jr({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:l.data,setup:l,earlyReturn:l.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorScheme:k,selection:y,linkedHover:m,onObservation:g,onClick:p,chartId:v,loading:b,loadingContent:x,emptyContent:w,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel}),_=M.effectiveSelectionHook,P=r(()=>(null==_?void 0:_.isActive)?{isActive:!0,predicate:_.predicate}:null,[null==_?void 0:_.isActive,null==_?void 0:_.predicate]);if(j)return j;const{width:L,height:N,enableHover:F,showGrid:B,title:T,description:H,summary:W,accessibleTable:D,xLabel:I,yLabel:z}=S,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:C}),{customLayout:s,layoutConfig:l}),P&&{layoutSelection:P}),{xExtent:a,yExtent:c,colorScheme:k,size:[L,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:M.margin,showAxes:u,xLabel:I,yLabel:z,enableHover:F,showGrid:B}),M.legendBehaviorProps),ds({title:T,description:H,summary:W,accessibleTable:D,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),null!=t.tooltip&&{tooltipContent:t.tooltip}),hs({linkedHover:m,onObservation:g,onClick:p,hoverHighlight:!1,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior})),f&&f.length>0&&{annotations:f}),M.crosshairProps),A);return e($r,{componentName:"XYCustomChart",width:L,height:N,children:e(Vi,Object.assign({ref:O},E))})});Qs.displayName="XYCustomChart";export{ys as A,Cs as B,Ks as C,vs as D,Ms as H,us as L,Ws as M,$s as Q,As as S,Qs as X,vn as a,Ss as b,qs as c,Ts as d,bs as e,Vi as f,mn as g,Ot as u};
|