semiotic 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/schema.json +1 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +2 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +24 -0
- package/dist/components/charts/xy/AreaChart.d.ts +14 -0
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +4 -0
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +12 -0
- 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.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +1 -1
package/dist/xy.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),l=require("d3-array"),a=require("d3-hierarchy"),c=require("regression");function u(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const d=h(t),f=u(c);function g(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 p(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 y({width:i,height:r,totalWidth:s,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:h,binSize:d,snap:f,binBoundaries:y,snapDuring:m,streaming:v}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(h);k.current=h;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>y?[...y].sort((e,t)=>e-t):void 0,[y]),A=t.useRef(j);A.current=j;const O=t.useRef(!1),M=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",n=>{if(O.current)return;const o=w.current;if(!o)return;if(!n.selection)return M.current=null,void k.current(null);let s,l;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],l=[o.y.invert(r),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(i)],l=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,r]]=n.selection;s=[o.x.invert(e),o.x.invert(i)],l=[o.y.invert(r),o.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===n.type||"brush"===n.type&&m)){const i=A.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[g(e[0],t),p(e[1],t)]}(s,i):d&&d>0&&(s=[Math.floor(s[0]/d)*d,Math.ceil(s[1]/d)*d]);const r=o.x(s[0]),l=o.x(s[1]);if(O.current=!0,"x"===c)e.call(t.move,[r,l]);else if("xy"===c){const o=n.selection;e.call(t.move,[[r,o[0][1]],[l,o[1][1]]])}O.current=!1}const a={x:s,y:l};M.current=a,k.current(a)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,f,d,m]),t.useEffect(()=>{if(!(v&&u&&x.current&&M.current))return;if(!b.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===f){const e=A.current;e&&e.length>0?i=p(t,e):d&&d>0&&(i=Math.ceil(t/d)*d)}if(i>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);r=!0}const s=u.x(i),l=u.x(e.x[1]);if(O.current=!0,"x"===c)o.call(x.current.move,[s,l]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[s,t],[l,n]])}if(O.current=!1,r){const t={x:[i,e.x[1]],y:e.y};M.current=t,k.current(t)}},[u,v,c,f,d]),e.jsx("svg",{ref:b,width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const m=Object.freeze([]);function v(e){if(!e)return m;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 b{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=v(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=v(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 x(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=k(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>k(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(s.getState()),[s]),c=t.useCallback(()=>l.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,c)}]}function k(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function w(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 j(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:A})})),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 A=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],O={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:10}},M={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:10}},S={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:A,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 C(e,t){if("light"===t)return O;if("dark"===t)return M;if("high-contrast"===t)return S;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?M:O;return j(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 j(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[_,P]=x(e=>({theme:O,setTheme(t){e(e=>({theme:C(e.theme,t)}))}}));class L{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 B{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 T(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 R(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 F(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 H(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 h=null!==(i=l.get(r))&&void 0!==i?i:0;l.set(s,h-(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 I(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 N(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 z(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 W(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function D(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function E(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function Y(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function G(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function X(e){const t=e.map(Y),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return G(e,n,o)}if(e>=1){const[e,o,i]=t[n];return G(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,h]=t[i+1];return G(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(h-a)*r))}}const q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],V=X(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),U=X(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),K=X(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Q=X(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Z=X(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),J=X(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ee=X(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),te=X(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ne=X(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),oe=X(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ie=X(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),re=X(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);X(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),X(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),X(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),X(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),X(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const se={category10:q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:V,reds:U,greens:K,oranges:Q,purples:Z,viridis:ee,plasma:te},le=q,ae=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=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 ue(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")||ce.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):le[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%le.length]}function he(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+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const s=se[n]||se.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:le;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function de(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;return s===r?(l+a)/2:l+(i-r)/(s-r)*(a-l)}function fe(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 ge(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 pe(e,t,n){return e+(t-e)*n}function ye(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 me(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],i=[];for(const n of t){const t=e.getX(n),r=e.getY(n);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(n),l=e.scales.x(t);if(s&&0!==s)o.push([l,e.scales.y(r+s)]),i.push([l,e.scales.y(r-s)]);else{const t=e.scales.y(r);o.push([l,t]),i.push([l,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:i,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function ve(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=I(s,e.scales,e.getX,r,l,o,a);c&&n.push(c)}}}const be={blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:re},xe=new Map;class ke{constructor(e){if(this.xExtent=new B,this.yExtent=new B,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._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.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new L(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=D(e.timeAccessor||e.xAccessor,"time"),this.getY=D(e.valueAccessor||e.yAccessor,"value")):(this.getX=D(e.xAccessor,"x"),this.getY=D(e.yAccessor,"y")),this.getGroup=E(e.groupAccessor),this.getCategory=E(e.categoryAccessor),this.getSize=e.sizeAccessor?D(e.sizeAccessor,"size"):void 0,this.getColor=E(e.colorAccessor),this.getBounds=e.boundsAccessor?D(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?D(e.y0Accessor,"y0"):void 0,this.getPointId=E(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?D(e.openAccessor,"open"):void 0,this.getHigh=D(e.highAccessor,"high"),this.getLow=D(e.lowAccessor,"low"),this.getClose=n?D(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new L(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))}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?D(this.config.timeAccessor||this.config.xAccessor,"time"):D(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)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))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}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);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))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(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!0}computeScene(e){var t,n,o,r,s,l,a,c,u,h,d,f,g,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&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(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:b[0],null!==(o=y.xExtent[1])&&void 0!==o?o:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1];if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(a=y.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),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!==(c=y.stackOrder)&&void 0!==c?c:"key",a=(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:a(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u:0):(o.push(t),r+=null!==(h=s.get(t))&&void 0!==h?h: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:a(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:a(e,t)}):t.map(e=>e.key).sort(a);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=H(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},y.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!==(f=r.get(n))&&void 0!==f?f: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=l>0?l*y.extentPadding:1;w=[i-a,s+a]}else w=[0,i+(i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,n,o,i){const r=T(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]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.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]}(m,this.getY),n=t-e,o=n>0?n*y.extentPadding:1;w=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!j&&w[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>w[1]&&(w[1]=t+n),w[0]>t-n&&(w[0]=t-n))}const e=w[1]-w[0],t=e>0?e*y.extentPadding:1,n=null===(g=y.yExtent)||void 0===g?void 0:g[0],o=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=n?w[0]:w[0]-t,null!=o?w[1]:w[1]+t],"log"===y.yScaleType&&0>=w[0]&&x[0]>0&&(w[0]=null!=n?w[0]:x[0]/(1+y.extentPadding))}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const A="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(A)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).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 i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),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,ke.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=r.quadtree().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(),r=this.scales.y.domain(),s=this.scales.x.range(),l=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=l[1]>l[0];this.scales={x:a(this.config.xScaleType,o,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:a(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,l,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},h={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:a,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ae},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=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let d;try{d=c.customLayout(h)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null,null!==(l=d.nodes)&&void 0!==l?l:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const h={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,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(c.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.getBounds)for(const t of o){const n=me(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=R(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 ve(e,o,i),i}(h,t);case"area":return function(e,t){const n=e.groupData(t),o=[],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=F(t.data,e.scales,e.getX,e.getY,i,n,t.key,r);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ve(e,n,o),o}(h,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set,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=F(t.data,e.scales,e.getX,e.getY,r,n,t.key,s);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),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=R(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 ve(e,n,o),o}(h,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:h,stackedTops:d}=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 h=Array.from(u).sort((e,t)=>e-t),d=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)}d.set(t.key,e)}let f;if(r){f=new Map;for(const t of h){let n=0;for(const o of e)n+=(null===(a=d.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=H(h,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=d.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of h)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=d.get(n.key),o=[],l=[],a=new Map;for(const n of h){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=h;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=d.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)};ve(e,s,f,n)}return f}(h,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";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 c=e.getPointId?e.getPointId(n)+"":void 0,u=I(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(h,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=D(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,h]=e.scales.x.domain(),[d,f]=e.scales.y.domain(),g=(h-u||1)/s,p=(f-d||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),h=Math.min(Math.floor((r-d)/p),l-1);if(0>a||0>h)continue;const f=h*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 k=x-b||1,w=n.width/s,j=n.height/l,A=e.config.showValues,O=e.config.heatmapValueFormat,M=[];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)/k;M.push(z(n*w,(l-1-e)*j,w,j,`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]},A?{value:i,showValues:!0,valueFormat:O}:void 0))}}return M}(e,t,n);if(0===t.length)return[];const o=D(e.config.valueAccessor,"value"),i=$(e.config.xAccessor,"x"),r=$(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,h=l.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(l.keys()),g=d.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){d.sort((e,t)=>e-t),s.clear();for(let e=0;d.length>e;e++)s.set(d[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 h=o(n),d=r*u+i,f=b.get(d);let g;void 0!==f?g=f:(g=x++,b.set(d,g)),y[g]=d,m[g]=h,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const j=function(e){const t=e in be?e:"blues";let n=xe.get(t);if(n)return n;n=Array(256);const o=be[t]||V;for(let e=0;256>e;e++)n[e]=o(e/255);return xe.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),O=n.width/u,M=n.height/h,S=e.config.showValues,C=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(z(o*O,(h-1-(n-o)/u)*M,O,M,j[Math.min((t-k)*A+.5|0,255)],v[e],S?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(h,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=T(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,h=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,d=null==u?void 0:u.gap,f="number"!=typeof d||0>d?1:d,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 d=l.x(n),p=l.x(i),y=Math.abs(p-d),m=y>f+1?f:0,v=Math.min(d,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),d=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||h||"#4e79a7";s.push(N(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:d},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(N(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||h||"#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)}}(h,t);return this._barCategoryCache=null!==(a=h.barCategoryCache)&&void 0!==a?a: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,h=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",d=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=h;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:d,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(h,t);case"waterfall":return function(e,t,n){var o,i,r,s,l,a,c;const u=[],h=e.scales,d=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==d?void 0:d.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==d?void 0:d.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==d?void 0:d.gap)&&void 0!==c?c:1,m=null==d?void 0:d.stroke,v=null==d?void 0:d.strokeWidth,b=null==d?void 0:d.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=h.x(i),c=0!==l?h.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=s;continue}const j=h.y(x),A=h.y(s),O=Math.min(j,A),M=Math.abs(j-A),S={fill:0>r?p:g,stroke:m,strokeWidth:v};null!=b&&(S.opacity=b),u.push(N(k,O,w,M,S,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==d?void 0:d.connectorStroke,_connectorWidth:null==d?void 0:d.connectorWidth}))),x=s}return u}(h,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",h=s.wickWidth||(i?2:1),d=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(d.length>1){let t=1/0;for(let n=1;d.length>n;n++){const o=Math.abs(e.scales.x(d[n])-e.scales.x(d[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),d=i?s:e.getClose(n);if(!i&&[l,d].some(e=>null==e||Number.isNaN(e)))continue;const g=d>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(d),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:h,isUp:g,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(h,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?fe(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]=fe(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]=fe(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=fe(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=fe(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=ge(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=ge(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=ye(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=ye(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,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,$,E,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 q=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=ye(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]];q=!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]];q=!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}),q=!0;continue}const L=o.get(P);if("point"===r.type)if(L){V.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!==(h=L.r)&&void 0!==h?h:r.r,q=!0)}else r._targetOpacity=null!==(d=r.style.opacity)&&void 0!==d?d:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),q=!0;else if("rect"===r.type)if(L){V.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,q=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),q=!0;else if("heatcell"===r.type)if(L){V.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,q=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),q=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(A=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A: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!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(M=L.highY)&&void 0!==M?M:r.highY,r.lowY=null!==(S=L.lowY)&&void 0!==S?S:r.lowY,q=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),q=!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),q=!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),q=!0}for(const[e,t]of o)if(!V.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(B=t.r)&&void 0!==B?B:3,style:{opacity:null!==(T=t.opacity)&&void 0!==T?T: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!==(R=t.w)&&void 0!==R?R:0,h:null!==(F=t.h)&&void 0!==F?F: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!==(I=t.w)&&void 0!==I?I:0,h:null!==(N=t.h)&&void 0!==N?N:0,fill:"#999",datum:null,style:{opacity:null!==(z=t.opacity)&&void 0!==z?z:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(D=t.closeY)&&void 0!==D?D:o,highY:null!==($=t.highY)&&void 0!==$?$:o,lowY:null!==(E=t.lowY)&&void 0!==E?E: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)}q=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),q&&(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),h=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=pe(r,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==e._targetR&&void 0!==n.r&&(e.r=pe(n.r,e._targetR,h))}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=pe(i,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}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:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}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:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),void 0!==n.openY&&(e.openY=pe(n.openY,e._targetOpenY,h)),void 0!==n.closeY&&(e.closeY=pe(n.closeY,e._targetCloseY,h)),void 0!==n.highY&&(e.highY=pe(n.highY,e._targetHighY,h)),void 0!==n.lowY&&(e.lowY=pe(n.lowY,e._targetLowY,h))}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:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);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]=pe(t[o][0],n[o][0],h),e.path[o][1]=pe(t[o][1],n[o][1],h)}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:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);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]=pe(t[n][0],o[n][0],h),e.topPath[n][1]=pe(t[n][1],o[n][1],h);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=pe(n[t][0],i[t][0],h),e.bottomPath[t][1]=pe(n[t][1],i[t][1],h)}}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.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data: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||ae,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)||ae;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ke.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++,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++,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._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}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||"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||!W(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!W(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=D(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=D(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=D(this.config.xAccessor,"x"),this.getY=D(this.config.yAccessor,"y")),s=!0,l=!0)}if("groupAccessor"in e&&!W(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?E(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!W(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?E(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!W(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?D(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!W(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?E(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!W(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?D(this.config.y0Accessor,"y0"):void 0,s=!0,l=!0),"boundsAccessor"in e&&!W(e.boundsAccessor,r.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?D(this.config.boundsAccessor,"bounds"):void 0,s=!0,l=!0),"pointIdAccessor"in e&&!W(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?E(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!W(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!W(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!W(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!W(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?D(this.config.openAccessor,"open"):void 0,this.getHigh=D(this.config.highAccessor,"high"),this.getLow=D(this.config.lowAccessor,"low"),this.getClose=t?D(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 we(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:d.createElement(d.Fragment,null,...t)}function je(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 Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Me(e,t){const n=Oe(e);if(!n)return!1;const o=Oe(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}ke.GROUP_COLOR_MAP_CAP=1e3,ke.QUADTREE_THRESHOLD=500;const Se=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ce=new WeakMap;let _e=0,Pe=!1,Le=null,Be=null,Te=null;function Re(e,t){var n,o;if(!t)return t;const i=Se.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(Pe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pe=!0;const e=()=>{_e++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Le=new MutationObserver(e),Le.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Be=window.matchMedia("(prefers-color-scheme: dark)"),Te=e,"function"==typeof Be.addEventListener?Be.addEventListener("change",Te):"function"==typeof Be.addListener&&Be.addListener(Te)}catch(e){}}();let s=Ce.get(r);s&&s.version===_e||(s={version:_e,map:new Map},Ce.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 Fe(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function He(e,t,n){return null==t?n:"string"!=typeof t?t:Re(e,t)||n}function Ie(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)),h=e.createLinearGradient(o,i,r,s),[d,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 h.addColorStop(0,`rgba(${d},${f},${g},${c})`),h.addColorStop(1,`rgba(${d},${f},${g},${u})`),h}function Ne(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 ze=new WeakMap;function We(e,t){const n=Fe(t);if(!n)return e;const o=ze.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 h=i/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*r+h*h*h*l,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return ze.set(e,i),i}function De(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,l=t+r,a=n-r,c=n+r;let u=null,h=1/0;return e.visit((e,i,r,d,f)=>{if(i>l||s>d||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,l=Math.sqrt(r*r+s*s);Ae(e.r,o)>=l&&h>l&&(u=e,h=l),i=i.next}while(i)}return!1}),u?{node:u,distance:h}: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=Ee(r,t,n,o);break;case"line":e=Ye(r,t,n,o);break;case"rect":if(null==r.datum)break;e=Xe(r,t,n);break;case"heatcell":e=qe(r,t,n);break;case"area":if(!1===r.interactive)break;e=Ue(r,t,n);break;case"candlestick":e=Ve(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function $e(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Ke(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 Ee(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Ae(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ye(e,t,n,o=30){var i,r,s,l;if(0===e.path.length)return null;const a=Ke(e.path,t);if(0>a)return null;const[c,u]=e.path[a];let h;if(e.path.length>1){let o=1/0;const i=Math.max(0,a-1),r=Math.min(e.path.length-2,a);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[l,a]=e.path[s+1],c=Ge(t,n,i,r,l,a);o>c&&(o=c)}h=o}else{const e=t-c,o=n-u;h=Math.sqrt(e*e+o*o)}const d=null!==(l=null!==(r=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==r?r:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==l?l:1;return h>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:c,y:u,distance:h}}function Ge(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 Xe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function qe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ve(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 Ue(e,t,n){if(0===e.topPath.length)return null;const o=Ke(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 Ke(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 Qe(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 Ze(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Je={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function et(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Je[n])(o(e,t)),i}function tt(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function nt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ot=(t,n,o,i,r,s,l,a,c,u)=>{const{type:h="fill",styleFn:d,items:f}=t,g=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=r;return f.forEach((t,u)=>{const v=et(t,u,h,d),b=nt(t,i,r),x=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=22}),g};function it({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+d.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function rt(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:h="vertical"}=t,[f,g]=d.useState(0),[p,y]=d.useState(0),m=d.useCallback((e,t)=>{g(e),y(t)},[]),v="vertical"===h?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let h=24;const d=[];return t.forEach((t,f)=>{h+=5,d.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,d.push(e.jsx("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-"+f)),h+=8),d.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ot(t,o,i,r,s,l,a,f,c,u)},"legend-group-"+f)),h+=22*t.items.length+8}),d})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:h})=>{let d=0;const f=[];t.forEach((t,n)=>{let g=0;t.label&&(g+=16);const p=((t,n,o,i,r,s,l,a,c,u,h)=>{const{type:d="fill",styleFn:f,items:g}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=r;g.forEach((t,u)=>{const x=et(t,u,d,f),k=nt(t,i,r),w=r&&r.size>0&&r.has(t.label),j=26+7*t.label.length;h&&h>0&&y>0&&y+j>h&&(m++,y=0),p.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?a===s&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=j});let x=0,k=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,i,r,s,l,a,c,n,u,h,o);g+=p.offset+5,f.push(Object.assign(Object.assign({label:t.label},p),{offset:g,totalRows:p.totalRows,totalHeight:p.totalHeight})),d+=g+12});let g=d>o?0:Math.max(0,(o-d)/2);const p=[];return f.forEach((o,i)=>{const r=t[i];r.label&&(p.push(e.jsx("text",{transform:`translate(${g},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)),g+=16),p.push(e.jsx("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+i)),g+=o.offset+5,t[i+1]&&p.push(e.jsx("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e.jsx("g",{children:p})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}),b=!(!o&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===h&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),v]})}function st(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function lt(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:l,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=t;if(!n)return null;const f="top"===s||"bottom"===s;let g,p;return"left"===s?(g=4,p=r.top):"top"===s?(g=0,p=l?32:8):"bottom"===s?(g=0,p=i-r.bottom+50):(g=o-r.right+10,p=r.top),e.jsx("g",{transform:`translate(${g}, ${p})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(it,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):st(n)?e.jsx(rt,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):n)});var y}function at(e){return"string"==typeof e?{type:e}:e}function ct({orient:n,config:o,values:i,scale:r,size:s,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,h=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),o=s-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],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(!t)return null;const{q1:s,median:l,q3:a,whiskerLow:h,whiskerHigh:d}=t,f=Math.min(.5*o,20),g=(o-f)/2+4;if(u){const t=r(s),o=r(a),i=r(l),u=r(h),p=r(d),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(g+f/2),x2:p,y2:m+y*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*g,x2:u,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*g,x2:p,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-g-f:m+g,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-g-f:m+g,x2:i,y2:"top"===n?m-g:m+g+f,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),o=r(a),i=r(l),u=r(h),p=r(d),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(g+f/2),y1:u,x2:m+y*(g+f/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:u,x2:m+y*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:p,x2:m+y*(g+f),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-g-f:m+g,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-g-f:m+g,y1:i,x2:"left"===n?m-g:m+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const h=l.bin().domain(t).thresholds(c.bins)(i);if(0===h.length)return null;const d=Math.max(...h.map(e=>e.length));if(0===d)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:h.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/d*o;if(u){const o=r(t.x0),l=r(t.x1)-r(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-s:4,width:Math.max(l,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=r(t.x0),l=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===n?-4-s:4,y:Math.min(o,o+l),width:s,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of h){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),l=r((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-s):t-s}`:`${"left"===n?-(t-s):t-s},${l}`)}for(let e=h.length-1;e>=0;e--){const s=h[e];if(null==s.x0||null==s.x1)continue;const l=s.length/d*(o/2),a=r((s.x0+s.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.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,i=null!=h[0].x0?r(h[0].x0):0;t.push(`M${i},${e}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===n?-i-4:i+4}`)}const s=null!=h[h.length-1].x1?r(h[h.length-1].x1):a;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=h[0].x0?r(h[0].x0):0;t.push(`M${e},${i}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,s=r((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${s}`)}const s=null!=h[h.length-1].x1?r(h[h.length-1].x1):a;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,a,n,u,4]);return h?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:h}):null}function ut(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 ht(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 dt(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===h?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===h?"right"===d?f="end":"middle"===d&&(f="middle"):f=0>n?"end":"start";const g=16,p=s?u?[s]:ut(s,c):[],y=r?u?[r]:ut(r,c):[],m="leftRight"===h?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:p.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=p.length*g),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let k=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===h){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*g+(y.length>0?g:0);let n=0,o=t;"bottom"===d?(n=-t,o=0):"middle"===d&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*g;let j=0;return"topBottom"===h?j=0>o?-(w+2):18:"leftRight"===h&&(j="middle"===d?-(w+g+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function ft(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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("path",{d:ht((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.jsx("g",{className:"annotation-subject",children:l})}function gt(t,n,o,i,r,s){const l=[];let a=0,c=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),u=e/2,h=o/2,d=t*h>n*u?u/t:h/n;a=i+s*d,c=r+l*d}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e.jsx("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-a);l.push(e.jsx("path",{d:`M${a},${c}L${a+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${a+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:l})}function pt(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:l,note:a,connector:c,subject:u,type:h,color:d,className:f,disable:g,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(g)?g:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=l&&(b=l-o);const x="string"==typeof h?h:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&>(v,b,c,d,x,u),!m.has("subject")&&ft(x,u,d,n,o),!m.has("note")&&dt(a,v,b,d)]}))}function yt(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.jsx(pt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(pt,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function mt(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 vt(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 bt(e,t,n){var o,i,r,s;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=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 h=a[e.xAccessor||"x"],d=a[e.yAccessor||"y"];return null==h||null==d?null:{x:c(h),y:u(d)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=mt(e,n),c=vt(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===l){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function xt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const kt={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};let wt={positions:new Map};const jt=new Set;function At(){for(const e of jt)e()}function Ot(e,t){const n=wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function Mt(e,t){const n=wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function St(){return wt}function Ct(e){return jt.add(e),()=>jt.delete(e)}const _t={positions:new Map};function Pt(){return()=>{}}function Lt(){return _t}function Bt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Tt(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 Rt(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:l,scales:a,showAxes:c,axes:u,showGrid:h,xFormat:d,yFormat:f}=n,g=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||d||Ft,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=a.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),s=r.map(e=>e.valueOf()),l=r.map((e,t)=>({value:e,pixel:a.x(e),label:n(e,t,s)})),c=l.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 Ht(l,Math.max(55,c+8))},[a,u,d,o]),p=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||f||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Ht(a.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:a.y(e),label:n(e)})),22)},[a,u,f,i]),y=h&&a,m=c&&a;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,j=(null==b?void 0:b.jaggedBase)||!1,A="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[y&&(()=>{var t,n;const r=Bt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=Bt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[g.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),p.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),x&&!w&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:A,strokeWidth:1}),w&&e.jsx("path",{d:Tt("bottom",o,i),fill:"none",stroke:A,strokeWidth:1}),k&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:A,strokeWidth:1}),j&&e.jsx("path",{d:Tt("left",o,i),fill:"none",stroke:A,strokeWidth:1})]})})}function Ft(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ht(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 It(n){var o,i;const{width:r,height:l,totalWidth:c,totalHeight:u,margin:h,scales:d,showAxes:g,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:j,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S,legendPosition:C="right",foregroundGraphics:_,marginalGraphics:P,xValues:L,yValues:B,annotations:T,svgAnnotationRules:R,xAccessor:F,yAccessor:H,annotationData:I,pointNodes:N,curve:z,underlayRendered:W,canvasObscuresUnderlay:D=!0,linkedCrosshairName:$,linkedCrosshairSourceId:E,children:Y}=n,G=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=d.x.ticks(Math.min(o,Math.max(2,Math.floor(r/70)))),s=i.map(e=>e.valueOf()),l=i.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,s)})),a=l.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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Ht(l,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,s);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[g,d,p,b,r]),X=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=d.y.domain()[1],t=d.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[g,d,p,x,l]),q=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||Ft,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[g,d,p,x,l]),V=t.useRef(new Map),U=t.useRef(null!==(o=null==T?void 0:T.length)&&void 0!==o?o:0),K=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;U.current!==K&&(U.current=K,V.current=new Map);const Q=t.useMemo(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var i,r,l,c,u,h,d,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,$,E,Y,G,X,q,V,U,K,Q,Z,J,ee;switch(t.type){case"label":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return xt(r,s,o)?e.jsx(yt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return xt(r,s,o)?e.jsx(yt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const i=mt(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let l;return l="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=vt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=a.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...l)-r,h=Math.max(...l)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:h-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=mt(n,o),l=vt(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=mt(t,o),r=vt(t,o);return e.jsx(yt,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const s=o.data||[];if(2>s.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",p=s.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(h=o.scales)||void 0===h?void 0:h.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===v?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,h=0,d=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*i[e],d+=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-h*h;if(1e-12>Math.abs(p))l.push([t,d/u]);else{const e=(u*g-h*d)/p;l.push([t,(d-e*h)/u+e*t])}}return l}(p,null!==(d=t.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?f.default.polynomial(p,{order:t.order||2}):f.default.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(p=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==p?p:null===(y=o.scales)||void 0===y?void 0:y.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",l=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.time,a=null!==(j=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=o.scales)||void 0===A?void 0:A.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",h=t.filter,d=i.filter(e=>null!=e[c]&&null!=e[u]&&!(h&&!h(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const f=kt[o.curve||"linear"]||s.curveLinear,g=s.area().x(e=>l(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:p,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&d.length>0&&e.jsx("text",{x:l(d[d.length-1][r])+4,y:a(d[d.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(S=null===(M=o.scales)||void 0===M?void 0:M.x)&&void 0!==S?S:null===(C=o.scales)||void 0===C?void 0:C.time,l=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,h=Math.sqrt(u),d=null!==(B=t.threshold)&&void 0!==B?B:2,f=c-d*h,g=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=l(c+d*h),x=l(f),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>d*h});return e.jsxs("g",{children:[g&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const i=mt(t,o),r=vt(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.x)&&void 0!==H?H:null===(I=o.scales)||void 0===I?void 0:I.time,a=null!==(z=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==z?z:null===(W=o.scales)||void 0===W?void 0:W.value;if(!l||!a)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=f.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)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;u=e=>l+s*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(h-2,1)),p=c.reduce((e,t)=>e+t[0],0)/h,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(D=t.confidence)&&void 0!==D?D:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==($=t.steps)&&void 0!==$?$:5,x=c[h-1][0],k=(x-c[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),M=`${l(x)},${a(u(x))}`,S=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${M} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:l(j[j.length-1].x)+4,y:a(j[j.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=bt(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!xt(i,r,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(q=t.dy)&&void 0!==q?q:0,a=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(Z=o.scales)||void 0===Z?void 0:Z.x,l=null===(J=o.scales)||void 0===J?void 0:J.y,a=(null==r?void 0:r.bandwidth)?r:(null==s?void 0:s.bandwidth)?s:(null==l?void 0:l.bandwidth)?l:null;if(!a)return null;const c=a(i);if(null==c)return null;const u=a.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",d=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:a===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:F,yAccessor:H,width:r,height:l,data:I,frameType:"xy",pointNodes:N,curve:z,stickyPositionCache:V.current};return T.map((e,o)=>{if(R){const i=R(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[T,R,r,l,F,H,I,d,N,z]),Z=function(e){var n;const o=t.useSyncExternalStore(e?Ct:Pt,e?St:Lt,e?St:Lt);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}($);return t.useEffect(()=>{if(!(null==Z?void 0:Z.locked)||!$)return;const e=e=>{"Escape"===e.key&&Mt($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,$]),g||w||j||_||P||Q&&Q.length>0||k||Y||Z?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[k&&d&&(!W||D)&&(()=>{var t,n;const o=Bt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Bt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),X.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&d&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=r/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!W||D)&&i&&!a&&e.jsx("line",{x1:0,y1:l,x2:r,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&a&&e.jsx("path",{d:Tt("bottom",r,l),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Me(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:l+40,textAnchor:"middle",fontSize:12,fill:g,style:{userSelect:"none"},children:y}),(!W||D)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&s&&e.jsx("path",{d:Tt("left",r,l),fill:"none",stroke:d,strokeWidth:1}),X.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Me(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-h.left,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(-90, ${15-h.left}, ${l/2})`,style:{userSelect:"none"},children:n}):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.jsxs(e.Fragment,{children:[!1!==t.baseline&&e.jsx("line",{x1:r,y1:0,x2:r,y2:l,stroke:d,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Me(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-r-"+o)}),o&&e.jsx("text",{x:r+h.right-15,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(90, ${r+h.right-15}, ${l/2})`,style:{userSelect:"none"},children:o})]})})()]})})(),Q,P&&d&&L&&B&&e.jsxs(e.Fragment,{children:[P.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"top",config:at(P.top),values:L,scale:d.x,size:h.top,length:r})}),P.bottom&&e.jsx("g",{transform:`translate(0, ${l})`,children:e.jsx(ct,{orient:"bottom",config:at(P.bottom),values:L,scale:d.x,size:h.bottom,length:r})}),P.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"left",config:at(P.left),values:B,scale:d.y,size:h.left,length:l})}),P.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ct,{orient:"right",config:at(P.right),values:B,scale:d.y,size:h.right,length:l})})]}),_,Z&&Z.sourceId!==E&&(null==d?void 0:d.x)&&(()=>{const t=d.x(Z.xValue);if(null==t||0>t||t>r)return null;const n=Z.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:l,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"})})(),Y]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),lt({legend:j,totalWidth:c,totalHeight:u,margin:h,legendPosition:C,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S})]}):null}function Nt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const zt="undefined"==typeof window||"undefined"==typeof document,Wt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Dt=()=>()=>{},$t=()=>!1,Et=()=>!0;function Yt(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 Gt(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 Xt(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 qt=d.createContext(null),Vt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ut(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;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 Kt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Qt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Zt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Jt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},en={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},tn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},nn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},on={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function rn({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=d.useState(!1),a=d.useContext(qt),c=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,u=s||c,h=d.useRef(null),f=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=d.useCallback(()=>{s||c||l(!0)},[s,c]),p=d.useCallback(e=>{var t;c||(null===(t=h.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Vt}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:g,style:Vt,role:"region","aria-label":f,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,i,r,s,l,a,c,u,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O;const M=[];if(!Array.isArray(e))return M;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":M.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;M.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":M.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=S.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=S.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(d=null===(h=S.datum)||void 0===h?void 0:h.id)&&void 0!==d?d:"",x:null!==(f=S.cx)&&void 0!==f?f:S.x,y:null!==(g=S.cy)&&void 0!==g?g:S.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(y=null===(p=S.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(v=S.cy)&&void 0!==v?v:S.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=S.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(O=null===(A=S.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return M}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const 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}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Kt(e.min)} to ${Kt(e.max)}, mean ${Kt(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(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:h,id:o,tabIndex:-1,onBlur:p,style:Qt,role:"region","aria-label":f,children:[e.jsx("button",{type:"button",onClick:()=>{c&&a&&a.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:Jt,children:"×"}),e.jsx("div",{role:"note",style:Zt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:en,children:[e.jsxs("caption",{style:on,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:tn,children:"type"}),k.map(t=>e.jsx("th",{style:tn,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:nn,children:t.label}),k.map(n=>{return e.jsx("td",{style:nn,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Kt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function sn({summary:t}){return t?e.jsx("div",{role:"note",style:Vt,children:t}):null}function ln({tableId:t}){return e.jsx("a",{href:"#"+t,style:Vt,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,Vt)},children:"Skip to data table"})}function an({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Vt,children:n})}const cn="var(--semiotic-focus, #005fcc)";function un({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.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:cn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function hn({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=d.useRef(null),[u,h]=d.useState(null);d.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let f;return f=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:l,style:{position:"absolute",left:r.left+t,top:r.top+n,transform:f,pointerEvents:"none",zIndex:a,width:"max-content"},children:s})}function dn(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}const fn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function gn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pn(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=dn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=gn(e.foregroundGraphics,r,s),u=gn(e.backgroundGraphics,r,s),h=P(e=>e.theme),{transition:f,introEnabled:g}=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),p="semiotic-table-"+d.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const M=e.themeDirtyRef;return fn(()=>{M&&(_e++,M.current=!0,v())},[h,v,M]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:h,transition:f,introEnabled:g,tableId:p,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function yn(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 mn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function vn(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 bn=(e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",h=Re(e,u)||u,d=a.style.strokeWidth||2,f=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;vn(e,a.path,h,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Fe(a.curve),y=f&&f.length>0&&g&&g.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=h;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,O=!1;function M(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function S(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[_,P]=a.path[C],L=g[C],B=mn(L,f,h);if(null!==k&&null!==A&&null!==j){if(B===A)e.lineTo(_,P);else{const T=[];for(const R of f){const F=R.value;(j>F||F>L)&&(F>j||L>F)||j===F||L===F||T.push({t:(F-j)/(L-j)})}T.sort((e,t)=>e.t-t.t);for(const H of T){const I=k+(_-k)*H.t,N=w+(P-w)*H.t,z=mn(j+(L-j)*Math.min(H.t+1e-4,1),f,h);e.lineTo(I,N),S(),M(z,I,N)}e.lineTo(_,P)}k=_,w=P,j=L,A=B}else M(B,_,P),k=_,w=P,j=L,A=B}S()}else{e.beginPath();const W=a.strokeGradient&&a.path.length>=2?Ne(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=W||h,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[D,$]=a.path[0];e.moveTo(D,$);for(let E=1;a.path.length>E;E++)e.lineTo(a.path[E][0],a.path[E][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=He(e,a.style.fill,a.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,X]=a.path[0];e.moveTo(G,X);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function xn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function kn(e,t,n=.3){xn(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 wn(e,t,n=.6){var o,i,r,s,l;if(!xn(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,h=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,h,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 jn(e,t,n,o=.35){xn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function An(e,t){const n=Fe(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=s.area().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 On=(e,t,n,o)=>{var i,r,l;const a=t.filter(e=>"area"===e.type);for(const t of a){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 a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=t.style.fill||"#4e79a7",u=t._decayOpacities;if(u&&u.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[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=Re(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*(u[n]+u[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 h=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(An(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=Ie(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,n,0,o);e.fillStyle=i||c,e.globalAlpha=h}else{const n=null!==(l=t.style.fillOpacity)&&void 0!==l?l:.7;e.globalAlpha=n*h,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(An(e,t),jn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=h;const n=t.strokeGradient&&t.topPath.length>=2?Ne(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Fe(t.curve);if(e.beginPath(),o)s.line().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!==a&&1>a&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Mn=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=He(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=He(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),wn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Sn(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 Cn=(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)_n(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(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=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(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=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}kn(e,t),e.globalAlpha=1}};function _n(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 Pn(e,t,n,o){return Object.assign({data:e,x:t,y:n,__semioticHoverData:!0},o)}function Ln(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 Bn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Tn=(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=Re(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),kn(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):Bn(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=Ln(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Rn=(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=Re(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,h=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||h(),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=Re(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&&h(),e.restore()}},Fn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hn(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`${Fn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const In={line:[On,bn,Mn],area:[On,Mn],stackedarea:[On,Mn],scatter:[Mn],bubble:[Mn],heatmap:[Tn],bar:[Cn],swarm:[Mn],waterfall:[(e,t,n,o)=>{var i,r,s;Cn(e,t);const l=t.filter(e=>"rect"===e.type);if(2>l.length)return;const a=l[0].datum,c=null==a?void 0:a._connectorStroke;if(c){e.save(),e.strokeStyle=Re(e,c)||c,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;l.length-1>t;t++){const o=l[t],i=l[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const a=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Rn],mixed:[On,bn,Mn],custom:[On,Cn,Tn,bn,Mn,Rn]},Nn={top:20,right:20,bottom:30,left:40},zn={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 Wn(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 Dn={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 $n({hover:t}){var n,o,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(n=t.data)&&void 0!==n?n:{},l=null!==(o=s.y)&&void 0!==o?o:s.value,a=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:Dn,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(l)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(a)})]})}const En=t.forwardRef(function(n,o){var i,r,s,l,a,c,u,h,f,g,p,m,x;const{chartType:k,runtimeMode:j,data:A,chunkThreshold:O,chunkSize:M,xAccessor:S,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:B,curve:T,normalize:R,baseline:F,stackOrder:H,binSize:I,valueAccessor:N,arrowOfTime:z="right",windowMode:W="sliding",windowSize:D=200,timeAccessor:$,xExtent:E,yExtent:Y,extentPadding:G=.1,scalePadding:X,sizeRange:q,size:V=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:ne,barStyle:oe,waterfallStyle:ie,swarmStyle:re,barColors:se,colorScheme:le,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:he,lineGradient:de,areaGroups:fe,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,showAxes:be=!0,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:Me,yFormat:Se,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Be,customClickBehavior:Te,enableHover:Fe,hoverRadius:He=30,tooltipMode:Ie,annotations:Ne,svgAnnotationRules:ze,showGrid:Ee,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,legendCategoryAccessor:Je,onCategoriesChange:et,backgroundGraphics:tt,foregroundGraphics:nt,canvasPreRenderers:ot,svgPreRenderers:it,title:rt,categoryAccessor:st,brush:lt,onBrush:at,decay:ct,pulse:ut,transition:ht,animate:dt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,marginalGraphics:bt,pointIdAccessor:xt,xScaleType:kt,yScaleType:wt,accessibleTable:jt=!0,description:At,summary:Ot,linkedCrosshairName:Mt,linkedCrosshairSourceId:St,customLayout:Ct,layoutConfig:_t}=n,Pt=t.useId().replace(/:/g,""),Lt=t.useRef(!1),Bt=pn({sizeProp:V,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:Nn,animate:dt,transitionProp:ht,themeDirtyRef:Lt}),Tt=function(){const[e,n]=t.useState(!1);return Wt(()=>{n(!0)},[]),e}(),Ft=function(){const e=t.useSyncExternalStore(Dt,$t,Et);return t.useRef(e).current}(),{reducedMotionRef:Ht,responsiveRef:qt,size:Vt,currentTheme:Kt,transition:Qt,introEnabled:Zt,tableId:Jt,rafRef:en,renderFnRef:tn,scheduleRender:nn}=Bt;let on=Bt.margin;if(bt){const e=60,t=Object.assign({},Bt.margin);bt.top&&e>t.top&&(t.top=e),bt.bottom&&e>t.bottom&&(t.bottom=e),bt.left&&e>t.left&&(t.left=e),bt.right&&e>t.right&&(t.right=e),on=t}const cn="function"==typeof nt?nt({size:Vt,margin:on}):nt,dn="function"==typeof tt?tt({size:Vt,margin:on}):tt,fn=Vt[0]-on.left-on.right,gn=Vt[1]-on.top-on.bottom,mn=t.useMemo(()=>v(A),[A]),vn=null!=Pe?Pe:Fe,bn=t.useRef(null),xn=t.useRef(null),[kn,wn]=t.useState(0),[jn,An]=t.useState(null),On=t.useRef(null),Mn=t.useRef(null),[Sn,Cn]=t.useState(null),_n=t.useRef(zn.primary),Ln=t.useRef([]),Bn=t.useRef(Je),Tn=t.useRef(et);Bn.current=Je,Tn.current=et;const[Rn,Fn]=t.useState(!1),[Dn,En]=t.useState([]),[Yn,Gn]=t.useState([]),Xn="streaming"===j||["bar","swarm","waterfall"].includes(k),qn=t.useMemo(()=>{var e,t,n;return{chartType:k,runtimeMode:Xn?"streaming":"bounded",windowSize:D,windowMode:W,arrowOfTime:Xn?z:"right",extentPadding:G,scalePadding:X,xAccessor:S,yAccessor:C,timeAccessor:Xn?$:void 0,valueAccessor:N,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(B?"_lineGroup":void 0),categoryAccessor:st,lineDataAccessor:B,xScaleType:kt,yScaleType:wt,xExtent:E,yExtent:Y,sizeRange:q,binSize:I,normalize:R,baseline:F,stackOrder:H,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:de,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,lineStyle:ee,pointStyle:te,areaStyle:ne,swarmStyle:re,waterfallStyle:ie,colorScheme:le,barColors:se,barStyle:oe,annotations:Ne,decay:ct,pulse:ut,transition:Qt,introAnimation:Zt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,pointIdAccessor:xt,curve:T,themeCategorical:null===(e=null==Kt?void 0:Kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:w(Kt),themeSequential:null===(t=null==Kt?void 0:Kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Kt?void 0:Kt.colors)||void 0===n?void 0:n.diverging,customLayout:Ct,layoutConfig:_t,layoutMargin:on}},[k,D,W,z,G,X,S,C,$,N,kt,wt,_,P,L,st,B,E,Y,q,I,R,F,H,ae,ce,ue,he,de,fe,ge,pe,ye,me,ve,ee,te,ne,re,ie,oe,le,se,Ne,ct,ut,null==Qt?void 0:Qt.duration,null==Qt?void 0:Qt.easing,Zt,ft,gt,pt,yt,mt,vt,Xn,xt,T,Kt,Ct,_t,on]),Vn=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Gt(e,t);if(!Xt(e)||!Xt(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(!Gt(n,i))return!1}else{if(!Xt(n)||!Xt(i))return!1;if(!Yt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(qn),Un=t.useRef(null);Un.current||(Un.current=new ke(Vn));const Kn=t.useCallback(()=>{var e,t;const n=Bn.current,o=Tn.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=Un.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,Ln.current)||(Ln.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Un.current)||void 0===e||e.updateConfig(Vn),Lt.current=!0,nn()},[Vn,nn]);const Qn=t.useRef(null);Qn.current||(Qn.current=new b(e=>{const t=Un.current;t&&t.ingest(e)&&(Lt.current=!0,nn())},{chunkThreshold:O,chunkSize:M})),t.useEffect(()=>{var e;null===(e=Qn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:O,chunkSize:M})},[O,M]);const Zn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.push(e)},[]),Jn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.pushMany(e)},[]),eo=t.useCallback(()=>{var e,t;null===(e=Qn.current)||void 0===e||e.clear(),null===(t=Un.current)||void 0===t||t.clear(),Lt.current=!0,nn()},[nn]);t.useImperativeHandle(o,()=>({push:Zn,pushMany:Jn,remove:e=>{var t,n,o;null===(t=Qn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Un.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(On.current&&i.some(e=>{var t;return e===(null===(t=On.current)||void 0===t?void 0:t.data)})&&(On.current=null,Cn(null)),Lt.current=!0,nn()),i},update:(e,t)=>{var n,o,i;null===(n=Qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Un.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Lt.current=!0,nn()),r},clear:eo,getData:()=>{var e,t,n;return null===(e=Qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Un.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Zn,Jn,eo,nn]),t.useEffect(()=>{var e,t;if(A){if(B&&mn.length>0&&"object"==typeof mn[0]&&null!==mn[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(mn[0][t])){const n=[];for(const e of mn){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=Qn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Qn.current)||void 0===t||t.setBoundedData(mn)}},[A,mn,B]);const{hoverHandlerRef:to,hoverLeaveRef:no,onPointerMove:oo,onPointerLeave:io}=Bt;to.current=e=>{var t,n,o;if(!vn)return;const i=bn.current;if(!i)return;const r=i.getBoundingClientRect(),s=e.clientX-r.left-on.left,l=e.clientY-r.top-on.top;if(0>s||s>fn||0>l||l>gn)return void(On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn()));const a=Un.current;if(!a||0===a.scene.length)return;const c=De(a.scene,s,l,He,a.quadtree,a.maxPointRadius),u="multi"===Ie,h=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&Be(null),nn())};if(!c&&!u)return void h();const d=u||!c?s:c.x,f=u||!c?l:c.y;let g=Pn(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},d,f);if(u&&a.scene.length>0&&a.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=$e(We(e.path,e.curve),t,n);if(null===r)continue;const s=Ke(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=We(e.topPath,e.curve),s=We(e.bottomPath,e.curve),l=$e(r,t,n);if(null===l)continue;const a=$e(s,t,n),c=Ke(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}(a.scene,d,Math.max(He,fn));if(e.length>0){const t=a.scales.y.invert,n=a.scales.x.invert,o=_n.current,i=n?n(d):d;if(c)g.xValue=i,g.xPx=d;else{const e={xValue:i};"string"==typeof S&&(e[S]=i),g=Pn(e,d,f,{xValue:i,xPx:d})}g.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===k&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:e.datum}})}}c||(null===(n=g.allSeries)||void 0===n?void 0:n.length)?(On.current=g,Mn.current=null!==(o=null==c?void 0:c.node)&&void 0!==o?o:null,Cn(g),Be&&(Be(g),Lt.current=!0),nn()):h()},no.current=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn())};const ro=t.useRef(()=>{});ro.current=e=>{if(!Te)return;const t=bn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-on.left,i=e.clientY-n.top-on.top;if(0>o||o>fn||0>i||i>gn)return void Te(null);const r=Un.current;if(!r||0===r.scene.length)return void Te(null);const s=De(r.scene,o,i,He,r.quadtree,r.maxPointRadius);Te(s?Pn(s.datum||{},s.x,s.y):null)};const so=t.useCallback(e=>ro.current(e),[]),lo=t.useRef(-1),ao=t.useRef(null),co=t.useRef(null),uo=t.useCallback(e=>{const t=Un.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(co.current&&co.current.version===n)o=co.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"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),co.current={version:n,graph:o}}const i=lo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),lo.current=0;const t=o.flat[0];ao.current={shape:t.shape,w:t.w,h:t.h};const n=Ze(t);return On.current=n,Cn(n),Be&&Be(n),void nn()}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?Qe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Qe(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 lo.current=-1,ao.current=null,On.current=null,Mn.current=null,Cn(null),Be&&Be(null),void nn();lo.current=s;const l=o.flat[s];ao.current={shape:l.shape,w:l.w,h:l.h};const a=Ze(l);On.current=a,Cn(a),Be&&Be(a),nn()},[Be,nn]),ho=t.useCallback(e=>{lo.current=-1,ao.current=null,oo(e)},[oo]);tn.current=()=>{var e,t;en.current=0;const n=bn.current,o=xn.current;if(!n||!o)return;const i=Un.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Ht.current?r+1e6:r),l=!Ht.current&&s,a=Lt.current||s;a&&!l&&(i.computeScene({width:fn,height:gn}),Kn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return zn;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||zn.axisStroke,tickText:s||zn.tickText,crosshair:s?Wn(s,"66"):zn.crosshair,hoverFill:c?Wn(c,"4D"):zn.hoverFill,hoverStroke:s?Wn(s,"99"):zn.hoverStroke,pointRing:c||zn.pointRing,primary:r||zn.primary}:zn}(n);_n.current=u.primary;const h=null!==(e=null==ft?void 0:ft.threshold)&&void 0!==e?e:5e3,d=ft&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(a){const e=yn(n,Vt,on,c);if(e){if(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),d&&(e.globalAlpha=null!==(t=null==ft?void 0:ft.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!tt){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=J||(t&&"transparent"!==t?t:null),i=o?Re(e,o):null;i&&(e.fillStyle=i,e.fillRect(-on.left,-on.top,Vt[0],Vt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,fn,gn),e.clip()),ot&&i.scales)for(const t of ot)e.save(),t(e,i.scene,i.scales,{width:fn,height:gn}),e.restore();const o=Ct?In.custom:In[k];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:fn,height:gn});e.restore(),d&&(e.globalAlpha=1)}}{const e=yn(o,Vt,on,c);if(e&&(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),vn&&On.current&&i.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 h="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=h.stroke||s.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.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,On.current,fn,gn,"object"==typeof vn?vn:{},Mn.current,u),Mn.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s=n.group;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,i.scene,Mn.current,t,u)}}a&&n&&n.setAttribute("aria-label",Ut(i.scene,k+" chart"));const f=Lt.current;if(Lt.current=!1,f&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!jn||e(jn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(jn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(jn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(jn.y.domain()[1])!==e(i.scales.y.domain()[1])||jn.x.range()[0]!==i.scales.x.range()[0]||jn.x.range()[1]!==i.scales.x.range()[1]||jn.y.range()[0]!==i.scales.y.range()[0]||jn.y.range()[1]!==i.scales.y.range()[1])&&An(i.scales),bt){const e=i.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof C?C:e=>e[C||"y"];En(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Gn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}f&&Ne&&Ne.length>0&&wn(e=>e+1),(null==ft?void 0:ft.showBadge)&&Fn(!!d),(l||null!=i.activeTransition||i.hasActivePulses)&&(en.current=requestAnimationFrame(()=>tn.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;Wt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Tt,wasHydratingFromSSR:Ft,storeRef:Un,dirtyRef:Lt,renderFnRef:tn,cleanup:()=>{var e;return null===(e=Qn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Lt.current=!0,nn()},[k,fn,gn,be,J,ee,ot,nn]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(ft,Un,Lt,nn,Rn,Fn);const fo=t.useMemo(()=>{if(Me||Ce)return;const e=Un.current;return(null==e?void 0:e.xIsDate)&&jn?Hn(jn.x.domain()):void 0},[Me,Ce,jn]),go=Me||Ce||fo,po=vn&&Sn?Le?Le(Sn):e.jsx($n,{hover:Sn}):null,yo=po?e.jsx(hn,{x:Sn.x,y:Sn.y,containerWidth:fn,containerHeight:gn,margin:on,className:"stream-frame-tooltip",children:po}):null,mo=ao.current,vo=e.jsx(un,{active:lo.current>=0,hoverPoint:Sn,margin:on,size:Vt,shape:null==mo?void 0:mo.shape,width:null==mo?void 0:mo.w,height:null==mo?void 0:mo.h}),bo=(e,t,n,o)=>"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},xo=bo(S,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),ko=bo(C,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),wo=xo.key,jo=ko.key,Ao=Ne&&Ne.length>0,Oo=e=>{if(!e||!Ao||!xo.fn&&!ko.fn)return e;let t=!1;const n=e.map(e=>{const n=xo.fn&&xo.key&&!(xo.key in e),o=ko.fn&&ko.key&&!(ko.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[xo.key]=xo.fn(e)),o&&(i[ko.key]=ko.fn(e)),i});return t?n:e};if(zt||!Tt&&Ft){const t=Un.current;t&&A&&(t.ingest({inserts:mn,bounded:!0}),t.computeScene({width:fn,height:gn}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l=go||(()=>{if((null==t?void 0:t.xIsDate)&&o)return Hn(o.x.domain())})();return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":At||("string"==typeof rt?rt:"XY chart"),style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1]},children:[e.jsx(sn,{summary:Ot}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn}),e.jsxs("g",{transform:`translate(${on.left},${on.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:fn,height:gn,fill:J}),it&&o&&it.map((t,i)=>e.jsx(d.Fragment,{children:t(n,o,{width:fn,height:gn})},"svgpre-"+i)),n.map((t,n)=>function(t,n,o){var i,r,s,l,a;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const a=t;if(0===a.topPath.length)return null;const c=`M${a.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...a.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(a.clipRect){const t=`${o?o+"-":""}area-clip-${n}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:a.clipRect.x,y:a.clipRect.y,width:a.clipRect.width,height:a.clipRect.height})})}),e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(r=null!==(i=a.style.fillOpacity)&&void 0!==i?i:a.style.opacity)&&void 0!==r?r:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+n)}return e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(l=null!==(s=a.style.fillOpacity)&&void 0!==s?s:a.style.opacity)&&void 0!==l?l:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Nt(o.style.fill),opacity:null!==(a=o.style.opacity)&&void 0!==a?a:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Nt(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[i,r,s]=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]}(o.fill),l=.299*i+.587*r+.114*s>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:a+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n,Pt)).filter(Boolean)]})]}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:o,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:l,yFormat:Se||_e,showGrid:Ee,title:rt,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(s=Un.current)||void 0===s?void 0:s.customLayoutOverlays),marginalGraphics:bt,xValues:[],yValues:[],annotations:Ne,svgAnnotationRules:ze,annotationFrame:0,xAccessor:wo,yAccessor:jo,annotationData:Oo(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:St})]})}return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":At||("string"==typeof rt?rt:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1],overflow:"visible"},onKeyDown:uo,children:[jt&&e.jsx(ln,{tableId:Jt}),jt&&e.jsx(rn,{scene:null!==(a=null===(l=Un.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:k+" chart",tableId:Jt,chartTitle:"string"==typeof rt?rt:void 0}),e.jsx(sn,{summary:Ot}),e.jsxs("div",{role:"img","aria-label":At||("string"==typeof rt?rt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:vn?ho:void 0,onMouseLeave:vn?io:void 0,onClick:Te?so:void 0,children:[dn&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn})}),e.jsx(Rt,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,showGrid:Ee,xFormat:go,yFormat:Se||_e}),e.jsx("canvas",{ref:bn,"aria-label":Ut(null!==(u=null===(c=Un.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],k+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:xn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(an,{hoverPoint:Sn}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:go,yFormat:Se||_e,showGrid:Ee,title:rt,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(h=Un.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:bt,xValues:Dn,yValues:Yn,annotations:Ne,svgAnnotationRules:ze,annotationFrame:kn,xAccessor:wo,yAccessor:jo,annotationData:Oo(null===(f=Un.current)||void 0===f?void 0:f.getData()),pointNodes:null===(g=Un.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!tt,linkedCrosshairName:Mt,linkedCrosshairSourceId:St}),(lt||at)&&e.jsx(y,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,dimension:null!==(p=null==lt?void 0:lt.dimension)&&void 0!==p?p:"xy",scales:jn,onBrush:null!=at?at:()=>{},binSize:I,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(m=null==lt?void 0:lt.binBoundaries)&&void 0!==m?m:"bar"===k?null===(x=Un.current)||void 0===x?void 0:x.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===j}),(null==ft?void 0:ft.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ft.badgePosition?{top:4,left:4}:"bottom-left"===ft.badgePosition?{bottom:4,left:4}:"bottom-right"===ft.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Rn?"#dc3545":"#28a745",color:"white"}),children:Rn?"STALE":"LIVE"}),vo,yo]})]})});En.displayName="StreamXYFrame";const Yn=t.createContext(null);function Gn({colors:n,categories:o,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(n)return n;if(o){const e=Array.isArray(i)?i:se[i]||le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[n,o,i]);return e.jsx(Yn.Provider,{value:s,children:r})}function Xn(){return t.useContext(Yn)}function qn(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 Vn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Gn.displayName="CategoryColorProvider";const[Un,Kn]=x(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Vn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)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=new Map(e.selections),i=Vn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qn,Zn]=x(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 Jn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Kn(e=>e.selections.get(i)),s=Kn(e=>e.setClause),l=Kn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(qn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function eo(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=Jn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}function to(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function no(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:l,clear:a}=Jn({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void a();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&to(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&to(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[c,o,i,l,a]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:a}}const oo=t.createContext(!1),io=t.createContext(null),ro="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function so(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function lo(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 ao({selections:e}){const n=Kn(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function co({categoryColors:n,interaction:o,selectionName:i,field:r}){const s=Object.entries(n),l=s.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=eo({name:i,fields:[r]}),u=Jn({name:i,clientId:"__linked-legend-isolate__"}),[h,d]=t.useState(new Set),[f,g]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(h.size>0?p.current({[r]:Array.from(h)}):y.current())},[o,h,r]);const m=t.useCallback(e=>{"highlight"===o&&(e?(g(e.label),c.onHover({[r]:e.label})):(g(null),c.onHover(null)))},[o,r,c]),v=t.useCallback(e=>{"isolate"===o&&d(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===l.length?new Set:n})},[o,l.length]),[b,[x]]=dn([0,0],!0,!1),k=t.useMemo(()=>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}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(rt,{legendGroups:a,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:f,isolatedCategories:h})})})}function uo({children:n,selections:o,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:l="legend",legendField:a="category"}){const c=Xn(),[u,h]=t.useState({}),d=t.useRef({}),f=t.useMemo(()=>({registerCategories:(e,t)=>{const n=so(t);h(t=>{var o;return lo(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{h(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),g=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const n of t)e.push(n);return so(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},n=d.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of g)t[e]||n[e]||(n[e]=le[o%le.length],o++);const i=Object.assign({},t);for(const o of g)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[c,g]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(Un,{children:e.jsxs(Qn,{children:[o&&e.jsx(ao,{selections:o}),e.jsx(io.Provider,{value:f,children:e.jsx(Gn,{colors:p,children:e.jsxs(oo.Provider,{value:m,children:[y&&"top"===r&&e.jsx(co,{categoryColors:p,interaction:s,selectionName:l,field:a}),n,y&&"bottom"===r&&e.jsx(co,{categoryColors:p,interaction:s,selectionName:l,field:a})]})})})]})})}function ho(e){return e?"string"==typeof e?{name:e}:e:null}function fo(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function go(){return P(e=>e.theme)}d.createContext(void 0);const po="#007bff";function yo(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 mo(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 vo(){var e;const t=go(),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 bo(e,n,o){const i=Xn(),r=vo();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=he(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return he(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=he(e,n,s);return e=>i[e]||t(e)}return he(e,n,s)}if(i&&Object.keys(i).length>0){const e=he([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}function xo({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const h=t.useId(),d=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),f=Jn({name:(null==e?void 0:e.name)||"__unused__"}),g=eo({name:(null==d?void 0:d.name)||"hover",fields:(null==d?void 0:d.fields)||o||[]}),p=Zn(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==d?void 0:d.mode)&&d.xField){const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n})},At())}(d.name||"hover",n,h)}"x-position"!==(null==d?void 0:d.mode)&&g.onHover(t)}else"x-position"===(null==d?void 0:d.mode)&&Ot(d.name||"hover",h),"x-position"!==(null==d?void 0:d.mode)&&g.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||p){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=mo(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),p&&p(e)}}},[n,g,d,h,r,s,l,p,c,b]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==d?void 0:d.mode)&&d.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(wt.positions);return t.delete(e),wt={positions:t},At(),!1}wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},At()}(d.name||"hover",n,h)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=mo(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[a,r,p,s,l,d,h]);return t.useEffect(()=>{if("x-position"!==(null==d?void 0:d.mode))return;const e=d.name||"hover";return()=>{Mt(e,h),Ot(e,h)}},[null==d?void 0:d.mode,null==d?void 0:d.name,h]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:h}}function ko(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 wo({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(oo),u=null!==t.useContext(io),h=void 0!==i?i:!c&&!!n,d=!!n&&(h||u),f=t.useMemo(()=>{if(!d)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,d]);!function(e){const n=t.useContext(io),o=t.useId(),i=so(e),r=t.useRef([]);lo(r.current,i)||(r.current=i);const s=r.current;ro(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),ro(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const g=t.useMemo(()=>{if(!h||!n)return;const t=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):ae[r%ae.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:ue,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[h,n,e,o,f]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},l),e);return g&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[l,s,g,r]);return{legend:g,margin:p,legendPosition:r}}function jo(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}const Ao={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 Oo(e,t,n){var o,i,r,s,l,a,c;const u=Ao[e||"primary"],h="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:h?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:h?void 0:t.xLabel,yLabel:h?void 0:t.yLabel,categoryLabel:h?void 0:t.categoryLabel,valueLabel:h?void 0:t.valueLabel,marginDefaults:Mo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:h}}function Mo(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 So(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)}const Co={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 _o(e,t){return"function"==typeof t?t(e):e[t]}function Po(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 Lo(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=_o(t,o);l=Po(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=_o(t,o);a.push({label:n,value:Po(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Po(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Po(t[e[0]],i))}}const c=Object.assign(Object.assign({},Co),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Bo(){return t=>{var n,o,i,r,s,l,a;const c=t.allSeries;if(!c||0===c.length){const r=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:Co,children:e.jsx("div",{children:Po(r)})})}const u=null!==(l=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==l?l:null===(a=t.data)||void 0===a?void 0:a.x;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Po(u)}),c.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Po(t.value)})]},n))]})}}function To(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!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,r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Co,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lo(t):Lo())}}function Ro(e){return"string"==typeof e?e:"value"}function Fo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ho(e,t){if(!t)return Fo(e);try{const n=t(e);return null==n?Fo(e):n}catch(t){return Fo(e)}}function Io(e,t){return"function"==typeof t?t(e):e[t]}function No(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=n?Ho(Io(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((t,n)=>{const o=Ho(Io(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function zo({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,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:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class Wo extends d.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.jsx(zo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Do;const $o="undefined"!=typeof process&&"production"!==(null===(Do=process.env)||void 0===Do?void 0:Do.NODE_ENV);function Eo({componentName:t,width:n,height:o,children:i}){return e.jsx(Wo,{fallback:i=>e.jsx(zo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Yo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Go={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xo(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Yo),{width:n,height:o}),children:i||"No data available"}):null}function qo(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(r+s)-s))/2);return e.jsx("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:i},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Go),{position:"absolute",top:l+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Vo(e,t,n,o){if(!$o)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 Uo(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 Ko(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=Uo(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 Qo({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)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(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=Ko(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Zo(e){const n=P(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Jo(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:d,chartType:f,chartId:g,showLegend:p,userMargin:y,marginDefaults:m,onClick:b,hoverHighlight:x,loading:k,emptyContent:w,width:j,height:A}=e,O=void 0===o,M=t.useMemo(()=>v(n),[n]),[S,C]=t.useState([]),_=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:R,crosshairSourceId:F}=xo({selection:a,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:d,chartType:f,chartId:g,onClick:b,hoverHighlight:x,colorByField:P}),H=ko(c,F),I=bo(M,i,r),N=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[M,i]),z=t.useMemo(()=>O&&S.length>0?S:N,[O,S,N]),W=jo(s,i,z),D=t.useMemo(()=>B||(W.legendSelectionHook?W.legendSelectionHook:L),[B,W.legendSelectionHook,L]),$=Zo(a),E=vo(),Y=Xn(),G=t.useMemo(()=>{if(I)return I;if(!i||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:E&&E.length>0?E:ae,t="__streamCat",n=he(z.map(e=>({[t]:e})),t,e);return e=>(null==Y?void 0:Y[e])||n(e)||"#999"},[I,i,z,r,E,Y]),{legend:X,margin:q,legendPosition:V}=wo({data:M,colorBy:i,colorScale:G,showLegend:p,legendPosition:l,userMargin:y,defaults:m,categories:z}),U=t.useMemo(()=>{const e={};return X&&(e.legend=X,e.legendPosition=V),s&&"none"!==s&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=_),e},[X,V,s,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,O,i,_]),K=Array.isArray(o)?v(o):o,Q=qo(k,j,A),Z=Q?null:Xo(K,j,A,w);return{data:M,colorScale:I,allCategories:z,legendState:W,effectiveSelectionHook:D,activeSelectionHook:L,customHoverBehavior:T,customClickBehavior:R,legend:X,margin:q,legendPosition:V,earlyReturn:Q||Z||null,legendBehaviorProps:U,crosshairProps:H,resolvedSelection:$}}function ei(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(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:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removePoint(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.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.push(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.getData())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function ti(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 ni="__forecastSegment";let oi=null;function ii(){return ti(this,void 0,void 0,function*(){return oi||(oi=yield Promise.resolve().then(function(){return Ni})),oi})}const ri=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",lineBy:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:b,curve:x="linear",showPoints:k=!1,pointRadius:w=3,fillArea:j=!1,areaOpacity:A=.3,lineWidth:O=2,lineGradient:M,tooltip:S,pointIdAccessor:C,annotations:_,directLabel:P,gapStrategy:L="break",anomaly:B,forecast:T,frameProps:R={},selection:F,linkedHover:H,onObservation:I,onClick:N,hoverHighlight:z,hoverRadius:W,chartId:D,loading:$,emptyContent:E,legendInteraction:Y,legendPosition:G,xScaleType:X,yScaleType:q,color:V,stroke:U,strokeWidth:K,opacity:Q}=n,{width:Z,height:J,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:se,xLabel:le,yLabel:ae}=l,ce=t.useMemo(()=>v(a),[a]);Vo("LineChart",ce,"xAccessor",f),Vo("LineChart",ce,"yAccessor",g);const he="string"==typeof f?f:"__semiotic_resolvedX",de="string"==typeof g?g:"__semiotic_resolvedY",[fe,ge]=t.useState(null),[pe,ye]=t.useState([]),me=t.useMemo(()=>{if(!T&&!B)return ce;const e="function"==typeof f,t="function"==typeof g;return e||t?ce.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=f(n)),t&&(o.__semiotic_resolvedY=g(n)),o}):ce},[ce,T,B,f,g]),ve=t.useRef(T),be=t.useRef(B);t.useEffect(()=>{if(!T&&!B)return void((ve.current||be.current)&&(ge(null),ye([]),ve.current=T,be.current=B));let e=!1;const t=T!==ve.current||B!==be.current;if(ve.current=T,be.current=B,t&&(ge(null),ye([])),T){const t=p&&"string"==typeof p&&"object"==typeof T?Object.assign(Object.assign({},T),{_groupBy:p}):T;(function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildForecast(...e)})})(me,he,de,t,B).then(t=>{e||(ge(t),ye(t.annotations))}).catch(()=>{e||(ge(null),ye([]))})}else B&&function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildAnomalyAnnotations(...e)})}(B).then(t=>{e||(ge(null),ye(t))}).catch(()=>{e||ye([])});return()=>{e=!0}},[me,T,B,he,de]);const xe=fe?fe.processedData:ce,ke="__compoundGroup",we=!(!T||!p),je=we?ke:T?ni:p,Ae=t.useMemo(()=>{if(!we)return xe;const e="function"==typeof p?p:e=>e[p];return xe.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[ni]||"observed"}`,n})},[xe,we,p]),Oe=we?Ae:xe,Me=t.useMemo(()=>{if(!T)return;const e=T.upperBounds,t=T.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=fe?fe.processedData:ce;for(const e of s){const t="function"==typeof g?g(e):+e[g];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},[T,fe,ce,g]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],n="function"==typeof g?g(e):e[g];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[f,g]),Ce=void 0!==(null===(i=Oe[0])||void 0===i?void 0:i[y]),_e=t.useMemo(()=>{if(Ce)return Oe;if(je){const e=Oe.reduce((e,t)=>{const n="function"==typeof je?je(t):t[je];if(!e[n]){const o={[y]:[]};"string"==typeof je&&(o[je]=n),we&&(o[ni]=t[ni],"string"==typeof p&&(o[p]=t[p])),e[n]=o}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:Oe}]},[Oe,je,y,Ce]),{gapProcessedLineData:Pe,hasGaps:Le}=t.useMemo(()=>{if("interpolate"===L){let e=!1;const t=[];for(const n of _e){const o=(n[y]||[]).filter(t=>!Se(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===L){let e=!1;const t=[];for(const n of _e){const o=n[y]||[];let i=[],r=0;const s=je&&"string"==typeof je?n[je]:void 0;for(const l of o)if(Se(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[y]: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),{[y]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===L){let e=!1;const t="string"==typeof g?g:"y",n=[];for(const o of _e){const i=o[y]||[],r=[];for(const n of i)Se(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[y]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:_e,hasGaps:!1}},[_e,L,y,Se,je,g]),Be="object"==typeof P?P:{},Te=Be.position||"end",Re=Be.fontSize||11,Fe=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof m?m:e=>e[m],n=new Set;for(const o of Pe){const i=o[y]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Te?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)},[P,m,Pe,y,Te]),He=t.useMemo(()=>{if(!P)return l.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Re)),0)+10,t="end"===Te?"right":"left";return Object.assign(Object.assign({},l.marginDefaults),{[t]:Math.max(l.marginDefaults[t]||0,e)})},[P,Fe,Re,Te,l.marginDefaults]),Ie=Jo({data:xe,rawData:a,colorBy:m,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:F,linkedHover:H,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:I,onClick:N,hoverHighlight:z,chartType:"LineChart",chartId:D,showLegend:(!P||void 0!==ne)&&ne,userMargin:c,marginDefaults:He,loading:$,emptyContent:E,width:Z,height:J}),Ne=Ie.colorScale,ze=Ie.effectiveSelectionHook,We=Ie.resolvedSelection,De=Ie.customHoverBehavior,$e=Ie.customClickBehavior,Ee=Ie.crosshairProps,Ye=t.useMemo(()=>(e,t)=>{const n={strokeWidth:O},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return m?Ne&&(n.stroke=ue(e,m,Ne),o&&(n.fill=n.stroke,n.fillOpacity=A)):(n.stroke=V||po,o&&(n.fill=V||po,n.fillOpacity=A)),n},[m,Ne,O,j,A,V]),[Ge,Xe]=t.useState(null);t.useEffect(()=>{if(!T)return void Xe(null);let e=!1;return function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).createSegmentLineStyle(...e)})}(Ye,T).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,T]);const qe=Ge||Ye,Ve=t.useMemo(()=>So(qe,{stroke:U,strokeWidth:K,opacity:Q}),[qe,U,K,Q]),Ue=t.useMemo(()=>fo(Ve,ze,We),[Ve,ze,We]),Ke=t.useMemo(()=>{if(k)return e=>{const t={r:w,fillOpacity:1};return m?Ne&&(t.fill=ue(e.parentLine||e,m,Ne)):t.fill=V||po,t}},[k,w,m,Ne,V]),Qe=Array.isArray(j)?"mixed":j?"area":"line",Ze=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof f?f:e=>e[f],n="function"==typeof g?g:e=>e[g],o="function"==typeof m?m:e=>e[m],i=new Map;for(const t of Pe){const n=t[y]||[];if(0===n.length)continue;const r="end"===Te?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 f?f:"x"]:t(o),["string"==typeof g?g:"y"]:n(o),dx:"end"===Te?6:-6,dy:0,color:Ne?Ne(e):po,fontSize:Re}));r.sort((e,t)=>{const n="string"==typeof g?g:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof g?g:"y",n=r[e-1],o=r[e];Re+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Re+2)}return r},[P,m,Ne,Pe,y,f,g,Te,Re]),Je=Ie.margin,et=p||m,tt=t.useMemo(()=>No([{label:le||Ro(f),accessor:f,role:"x",format:h},{label:ae||Ro(g),accessor:g,role:"y",format:d},...et?[{label:Ro(et),accessor:et,role:"group"}]:[]]),[f,g,le,ae,et,h,d]),nt=Qo({componentName:"LineChart",data:Ce?(null===(r=xe[0])||void 0===r?void 0:r[y])||[]:a,accessors:{xAccessor:f,yAccessor:g}}),ot=t.useMemo(()=>Ce||je||Le?Pe.flatMap(e=>{const t=e[y]||[];return je&&"string"==typeof je?t.map(t=>Object.assign(Object.assign({},t),{[je]:e[je]})):t}):Oe,[Pe,y,Ce,je,Oe,Le]),it=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:Qe},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=W&&{hoverRadius:W}),null!=a&&{data:ot}),{xAccessor:f,yAccessor:g,xScaleType:X,yScaleType:q}),Me&&{yExtent:Me}),{groupAccessor:"break"===L&&Le?"_gapSegment":je||void 0,curve:x,lineStyle:Ue}),k&&{pointStyle:Ke}),{size:[Z,J],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Je,showAxes:l.showAxes,xLabel:le,yLabel:ae,xFormat:h,yFormat:d,enableHover:ee,showGrid:te}),Ie.legendBehaviorProps),oe&&{title:oe}),ie&&{description:ie}),re&&{summary:re}),void 0!==se&&{accessibleTable:se}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===S?()=>null:"multi"===S?Bo():To(S)||tt}),"multi"===S&&{tooltipMode:"multi"}),(H||I||N||z)&&{customHoverBehavior:De}),(I||N||H)&&{customClickBehavior:$e}),C&&{pointIdAccessor:C}),((null==_?void 0:_.length)||pe.length||Ze.length)&&{annotations:[..._||[],...pe,...Ze]}),Ee),R);return Ie.earlyReturn?Ie.earlyReturn:nt?e.jsx(zo,{componentName:"LineChart",message:nt,width:Z,height:J}):e.jsx(Eo,{componentName:"LineChart",width:Z,height:J,children:e.jsx(En,Object.assign({ref:s},it))})});function si(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),l}function li(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 ai(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:To(t)||n}}ri.displayName="LineChart";const ci=t.forwardRef(function(n,o){var i;const r=t.useRef(null);ei(o,{variant:"xy",frameRef:r});const s=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:O=2,showPoints:M=!1,pointRadius:S=3,tooltip:C,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,chartId:H,loading:I,emptyContent:N,legendInteraction:z,legendPosition:W,color:D,stroke:$,strokeWidth:E,opacity:Y}=n,{width:G,height:X,enableHover:q,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>v(l),[l]);Vo("AreaChart",ne,"xAccessor",d),Vo("AreaChart",ne,"yAccessor",f);const oe=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[m]),ie=t.useMemo(()=>{if(oe)return ne;if(g){const e=ne.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[m]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:ne}]},[ne,g,m,oe]),re=Jo({data:ne,rawData:l,colorBy:b,colorScheme:x,legendInteraction:z,legendPosition:W,selection:L,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:F,chartType:"AreaChart",chartId:H,showLegend:U,userMargin:a,marginDefaults:s.marginDefaults,loading:I,emptyContent:N,width:G,height:X}),se=t.useMemo(()=>e=>{const t={};if(b){if(re.colorScale){const n=ue(e,b,re.colorScale);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}}else{const e=D||po;t.fill=e,A?(t.stroke=e,t.strokeWidth=O):t.stroke="none"}return t.fillOpacity=w,t},[b,re.colorScale,D,w,A,O]),le=t.useMemo(()=>So(se,{stroke:$,strokeWidth:E,opacity:Y}),[se,$,E,Y]),ae=t.useMemo(()=>fo(le,re.effectiveSelectionHook,re.resolvedSelection),[le,re.effectiveSelectionHook,re.resolvedSelection]),ce=t.useMemo(()=>{if(M)return e=>{const t={r:S,fillOpacity:1};return b?re.colorScale&&(t.fill=ue(e.parentLine||e,b,re.colorScale)):t.fill=po,t}},[M,S,b,re.colorScale]),he=g||b,de=t.useMemo(()=>No([{label:ee||Ro(d),accessor:d,role:"x",format:u},{label:te||Ro(f),accessor:f,role:"y",format:h},...he?[{label:Ro(he),accessor:he,role:"group"}]:[]]),[d,f,ee,te,he,u,h]),fe=Qo({componentName:"AreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),ge=t.useMemo(()=>oe||g?ie.flatMap(e=>{const t=e[m]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ne,[ie,m,oe,g,ne]),pe=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:ge}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),y&&{gradientFill:y}),j&&{lineGradient:j}),{curve:k,lineStyle:ae}),M&&ce&&{pointStyle:ce}),{size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:h,enableHover:q}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:V}),re.legendBehaviorProps),si({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:de})),li({linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),_&&_.length>0&&{annotations:_}),re.crosshairProps),P);return re.earlyReturn?re.earlyReturn:fe?e.jsx(zo,{componentName:"AreaChart",message:fe,width:G,height:X}):e.jsx(Eo,{componentName:"AreaChart",width:G,height:X,children:e.jsx(En,Object.assign({ref:r},pe))})});ci.displayName="AreaChart";const ui=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:b="monotoneX",areaOpacity:x=.7,showLine:k=!0,lineWidth:w=2,showPoints:j=!1,pointRadius:A=3,normalize:O=!1,baseline:M="zero",stackOrder:S,tooltip:C,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,chartId:H,loading:I,emptyContent:N,legendInteraction:z,legendPosition:W,color:D,stroke:$,strokeWidth:E,opacity:Y}=n,{width:G,height:X,enableHover:q,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>v(l),[l]),oe=y||g;ei(o,{variant:"xy",frameRef:r});const ie=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[p]),re=t.useMemo(()=>{if(ie)return ne;if(g){const e=ne.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[p]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][p].push(t),e},{});return Object.values(e)}return[{[p]:ne}]},[ne,g,p,ie]),se=Jo({data:ne,rawData:l,colorBy:oe,colorScheme:m,legendInteraction:z,legendPosition:W,selection:L,linkedHover:B,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:F,chartType:"StackedAreaChart",chartId:H,showLegend:U,userMargin:a,marginDefaults:s.marginDefaults,loading:I,emptyContent:N,width:G,height:X}),le=t.useMemo(()=>e=>{const t={};if(oe&&se.colorScale){const n=ue(e,oe,se.colorScale);t.fill=n,k?(t.stroke=n,t.strokeWidth=w):t.stroke="none"}else if(!oe){const e=D||po;t.fill=e,t.stroke=k?e:"none",k&&(t.strokeWidth=w)}return t.fillOpacity=x,t},[oe,se.colorScale,x,k,w,D]),ae=t.useMemo(()=>So(le,{stroke:$,strokeWidth:E,opacity:Y}),[le,$,E,Y]),ce=t.useMemo(()=>fo(ae,se.effectiveSelectionHook,se.resolvedSelection),[ae,se.effectiveSelectionHook,se.resolvedSelection]),he=t.useMemo(()=>{if(j)return e=>{const t={r:A,fillOpacity:1};return oe?se.colorScale&&(t.fill=ue(e.parentLine||e,oe,se.colorScale)):t.fill=D||po,t}},[j,A,oe,se.colorScale,D]),de=g||y,fe=t.useMemo(()=>No([{label:ee||Ro(d),accessor:d,role:"x",format:u},{label:te||Ro(f),accessor:f,role:"y",format:h},...de?[{label:Ro(de),accessor:de,role:"group"}]:[]]),[d,f,ee,te,de,u,h]),ge=Qo({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),pe=t.useMemo(()=>ie||g?re.flatMap(e=>{const t=e[p]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ne,[re,p,ie,g,ne]),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(Object.assign({chartType:"stackedarea"},null!=l&&{data:pe}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0,curve:b,normalize:O,baseline:O?"zero":M,stackOrder:S,lineStyle:ce}),j&&he&&{pointStyle:he}),{size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:h,enableHover:q}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:V}),se.legendBehaviorProps),si({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:fe})),li({linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),_&&_.length>0&&{annotations:_}),se.crosshairProps),P);return se.earlyReturn?se.earlyReturn:ge?e.jsx(zo,{componentName:"StackedAreaChart",message:ge,width:G,height:X}):e.jsx(Eo,{componentName:"StackedAreaChart",width:G,height:X,children:e.jsx(En,Object.assign({ref:r},ye))})});ui.displayName="StackedAreaChart";const hi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:f="y",colorBy:g,colorScheme:p,sizeBy:y,sizeRange:m=[3,15],pointRadius:b=5,pointOpacity:x=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,frameProps:O={},selection:M,linkedHover:S,linkedBrush:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:F,legendPosition:H,color:I,stroke:N,strokeWidth:z,opacity:W}=n,{width:D,height:$,enableHover:E,showGrid:Y,showLegend:G,title:X,description:q,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=r,Z=t.useMemo(()=>v(s),[s]),J=Jo({data:Z,rawData:s,colorBy:g,colorScheme:p,legendInteraction:F,legendPosition:H,selection:M,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"Scatterplot",chartId:B,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:D,height:$}),ee=ho(C),te=no({name:(null==ee?void 0:ee.name)||"__unused_brush__",xField:(null==ee?void 0:ee.xField)||("string"==typeof h?h:void 0),yField:(null==ee?void 0:ee.yField)||("string"==typeof f?f:void 0)}),ne=ee?"xyBrush"===te.brushInteraction.brush?"xy":"xBrush"===te.brushInteraction.brush?"x":"y":void 0,oe=d.useRef(te.brushInteraction);oe.current=te.brushInteraction;const ie=t.useCallback(e=>{const t=oe.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)},[]);if(J.earlyReturn)return J.earlyReturn;Vo("Scatterplot",Z,"xAccessor",h),Vo("Scatterplot",Z,"yAccessor",f);const re=t.useMemo(()=>{if(!y||0===Z.length)return;const e=Z.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[Z,y]),se=t.useMemo(()=>e=>{const t={fillOpacity:x};return g?J.colorScale&&(t.fill=ue(e,g,J.colorScale)):t.fill=I||po,t.r=y?de(e,y,m,re):b,t},[g,J.colorScale,y,m,re,b,x,I]),le=t.useMemo(()=>So(se,{stroke:N,strokeWidth:z,opacity:W}),[se,N,z,W]),ae=t.useMemo(()=>fo(le,J.effectiveSelectionHook,J.resolvedSelection),[le,J.effectiveSelectionHook,J.resolvedSelection]),ce=t.useMemo(()=>No([{label:K||Ro(h),accessor:h,role:"x",format:c},{label:Q||Ro(f),accessor:f,role:"y",format:u},...g?[{label:Ro(g),accessor:g,role:"color"}]:[],...y?[{label:Ro(y),accessor:y,role:"size"}]:[]]),[h,f,K,Q,g,y,c,u]),he=Qo({componentName:"Scatterplot",data:s,accessors:{xAccessor:h,yAccessor:f}});if(he)return e.jsx(zo,{componentName:"Scatterplot",message:he,width:D,height:$});const 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({chartType:"scatter"},null!=s&&{data:Z}),{xAccessor:h,yAccessor:f,colorAccessor:g||void 0,sizeAccessor:y||void 0,sizeRange:m,pointStyle:ae,colorScheme:p,size:[D,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,showAxes:r.showAxes,xLabel:K,yLabel:Q,xFormat:c,yFormat:u,enableHover:E,showGrid:Y}),J.legendBehaviorProps),si({title:X,description:q,summary:V,accessibleTable:U,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:ce})),li({linkedHover:S,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),ee&&{brush:{dimension:ne},onBrush:ie}),J.crosshairProps),O);return e.jsx(Eo,{componentName:"Scatterplot",width:D,height:$,children:e.jsx(En,Object.assign({ref:i},fe))})});function di(e,t){return ee(1===t?.5:e/(t-1))}hi.displayName="Scatterplot";const fi=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,frameProps:k={},selection:w,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:M,chartId:S,loading:C,emptyContent:_,legendInteraction:P,stroke:L,strokeWidth:B,opacity:T}=n,{width:R,height:F,enableHover:H,showGrid:I,title:N,description:z,summary:W,accessibleTable:D,xLabel:$,yLabel:E}=l,Y=a||[],{safeData:G,orderMap:X}=t.useMemo(()=>{const e="function"==typeof f?f:e=>e[f],t="function"==typeof g?g:e=>e[g];let n=Y;if(p&&Y.length>0){const e="function"==typeof p?p:e=>e[p];n=[...Y].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}},[Y,p,f,g]);Vo("ConnectedScatterplot",G,"xAccessor",f),Vo("ConnectedScatterplot",G,"yAccessor",g);const q=Jo({data:G,rawData:a,colorBy:void 0,colorScheme:void 0,legendInteraction:P,selection:w,linkedHover:j,fallbackFields:[],unwrapData:!1,onObservation:A,onClick:O,hoverHighlight:M,chartType:"ConnectedScatterplot",chartId:S,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:C,emptyContent:_,width:R,height:F}),V=null!==(r=null===(i=q.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,U=t.useMemo(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const l=null===(n=q.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=q.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],h=di(t,u),d=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(r=o.datum)&&void 0!==r?r:o),f=l?d?1:V:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=h,e.lineWidth=m,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[m,q.effectiveSelectionHook,V]),K=t.useMemo(()=>[U],[U]),Q=t.useMemo(()=>(t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const l=s.length,a=100>l,c=[];for(let t=0;l-1>t;t++){const n=s[t],o=s[t+1],u=di(t,l),h="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,d="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,f=Math.min(h,d);a&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:f},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),Z=t.useMemo(()=>[Q],[Q]),J=t.useMemo(()=>e=>{var t,n;const o=X.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?di(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,X]),ee=t.useMemo(()=>So(J,{stroke:L,strokeWidth:B,opacity:T}),[J,L,B,T]),te=t.useMemo(()=>fo(ee,q.effectiveSelectionHook,q.resolvedSelection),[ee,q.effectiveSelectionHook,q.resolvedSelection]),ne=y||("string"==typeof p?p:"Order"),oe=t.useMemo(()=>No([{label:$||Ro(f),accessor:f,role:"x",format:h},{label:E||Ro(g),accessor:g,role:"y",format:d},...p?[{label:ne,accessor:p,role:"group"}]:[]]),[f,g,$,E,p,ne,h,d]),ie=Qo({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:f,yAccessor:g}}),re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:G}),{xAccessor:f,yAccessor:g,pointStyle:te,size:[R,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q.margin,showAxes:l.showAxes,xLabel:$,yLabel:E,xFormat:h,yFormat:d,enableHover:H,showGrid:I}),si({title:N,description:z,summary:W,accessibleTable:D,className:u,animate:n.animate})),ai({tooltip:v,defaultTooltipContent:oe})),li({linkedHover:j,onObservation:A,onClick:O,hoverHighlight:M,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:K,svgPreRenderers:Z}),x&&x.length>0&&{annotations:x}),q.crosshairProps),k);return q.earlyReturn?q.earlyReturn:ie?e.jsx(zo,{componentName:"ConnectedScatterplot",message:ie,width:R,height:F}):e.jsx(Eo,{componentName:"ConnectedScatterplot",width:R,height:F,children:e.jsx(En,Object.assign({ref:s},re))})});fi.displayName="ConnectedScatterplot";const gi=t.forwardRef(function(n,o){const i=t.useRef(null),r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",sizeBy:f,sizeRange:g=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:b=1,bubbleStrokeColor:x="white",tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,frameProps:O={},selection:M,linkedHover:S,linkedBrush:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:F,legendPosition:H,color:I,stroke:N,strokeWidth:z,opacity:W}=n,{width:D,height:$,enableHover:E,showGrid:Y,showLegend:G,title:X,description:q,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=r,Z=t.useMemo(()=>v(s),[s]),J=void 0===s,ee=Jo({data:Z,rawData:s,colorBy:p,colorScheme:y,legendInteraction:F,legendPosition:H,selection:M,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"BubbleChart",chartId:B,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:D,height:$}),te=t.useRef(null),[ne,oe]=t.useState(0),ie=t.useCallback(e=>{if(!J)return;let t=!1;for(const n of e){const e="function"==typeof f?f(n):n[f];null!=e&&isFinite(e)&&(te.current?(te.current[0]>e&&(te.current[0]=e,t=!0),e>te.current[1]&&(te.current[1]=e,t=!0)):(te.current=[e,e],t=!0))}t&&oe(e=>e+1)},[J,f]),re=t.useCallback(e=>{var t;ie([e]),null===(t=i.current)||void 0===t||t.push(e)},[ie]),se=t.useCallback(e=>{var t;ie(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[ie]);ei(o,{variant:"xy",frameRef:i,overrides:{push:re,pushMany:se,clear:()=>{var e;te.current=null,oe(e=>e+1),null===(e=i.current)||void 0===e||e.clear()}},deps:[re,se]});const le=ho(C);no({name:(null==le?void 0:le.name)||"__unused_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof h?h:void 0),yField:(null==le?void 0:le.yField)||("string"==typeof d?d:void 0)});const ae=t.useMemo(()=>{if(J)return te.current||[0,1];const e=Z.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[Z,f,J,ne]),ce=t.useMemo(()=>e=>{const t={fillOpacity:m,strokeWidth:b,stroke:x};return p?ee.colorScale&&(t.fill=ue(e,p,ee.colorScale)):t.fill=I||po,t.r=de(e,f,g,ae),t},[p,ee.colorScale,f,g,ae,m,b,x,I]),he=t.useMemo(()=>So(ce,{stroke:N,strokeWidth:z,opacity:W}),[ce,N,z,W]),fe=t.useMemo(()=>fo(he,ee.effectiveSelectionHook,ee.resolvedSelection),[he,ee.effectiveSelectionHook,ee.resolvedSelection]),ge=t.useMemo(()=>No([{label:K||Ro(h),accessor:h,role:"x",format:c},{label:Q||Ro(d),accessor:d,role:"y",format:u},{label:Ro(f),accessor:f,role:"size"},...p?[{label:Ro(p),accessor:p,role:"color"}]:[]]),[h,d,K,Q,f,p,c,u]),pe=Qo({componentName:"BubbleChart",data:s,accessors:{xAccessor:h,yAccessor:d},requiredProps:{sizeBy:f}});if(pe)return e.jsx(zo,{componentName:"BubbleChart",message:pe,width:D,height:$});const ye=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!=s&&{data:Z}),{xAccessor:h,yAccessor:d,colorAccessor:p||void 0,sizeAccessor:f,sizeRange:g,pointStyle:fe,colorScheme:y,size:[D,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,showAxes:r.showAxes,xLabel:K,yLabel:Q,xFormat:c,yFormat:u,enableHover:E,showGrid:Y}),ee.legendBehaviorProps),si({title:X,description:q,summary:V,accessibleTable:U,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:ge})),li({linkedHover:S,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),ee.crosshairProps),O);return ee.earlyReturn?ee.earlyReturn:e.jsx(Eo,{componentName:"BubbleChart",width:D,height:$,children:e.jsx(En,Object.assign({ref:i},ye))})});gi.displayName="BubbleChart";const pi=t.forwardRef(function(n,o){var r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xAccessor:h="x",yAccessor:d="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:j={},selection:A,linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,chartId:_,loading:P,emptyContent:L,showLegend:B,legendPosition:T,legendInteraction:R}=n,{width:F,height:H,enableHover:I,title:N,description:z,summary:W,accessibleTable:D,xLabel:$,yLabel:E}=l,Y=qo(P,F,H),G=Y?null:Xo(a,F,H,L),X=t.useMemo(()=>v(a),[a]),q=function(){var e;const t=go();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),se=null!==(r=null!=y?y:q)&&void 0!==r?r:"blues",le=null!=B&&B,ae=null!=T?T:"right",{margin:ce}=wo({data:X,colorBy:le?"value":void 0,colorScale:void 0,showLegend:le,legendPosition:ae,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:ue,customClickBehavior:he,crosshairSourceId:de}=xo({selection:A,linkedHover:O,fallbackFields:[],onObservation:M,onClick:S,chartType:"Heatmap",chartId:_,hoverHighlight:C,colorByField:void 0});Zo(A);const fe=ko(O,de);jo(R,void 0,[]);const ge=t.useMemo(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),pe=t.useMemo(()=>{const e=X.map(ge);return[Math.min(...e),Math.max(...e)]},[X,ge]),ye=t.useMemo(()=>"custom"===se&&m?m:i.scaleSequential({blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:re}[se]||V).domain(pe),[se,m,pe]),me=t.useMemo(()=>No([{label:$||Ro(h),accessor:h,role:"x",format:g},{label:E||Ro(d),accessor:d,role:"y",format:p},{label:Ro(f),accessor:f,role:"value",format:x}]),[h,d,$,E,f,g,p,x]),ve=Qo({componentName:"Heatmap",data:a,accessors:{xAccessor:h,yAccessor:d,valueAccessor:f}}),be=t.useMemo(()=>{if(le)return{gradient:{colorFn:e=>ye(e),domain:pe,label:"string"==typeof f?f:"value",format:x}}},[le,ye,pe,f,x]),xe=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:X}),{xAccessor:h,yAccessor:d,valueAccessor:f,colorScheme:"custom"!==se?se:void 0,showValues:b,heatmapValueFormat:x,size:[F,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,showAxes:l.showAxes,xLabel:$,yLabel:E,xFormat:g,yFormat:p,enableHover:I}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),be&&{legend:be,legendPosition:ae}),si({title:N,description:z,summary:W,accessibleTable:D,className:u,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:me})),li({linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,customHoverBehavior:ue,customClickBehavior:he})),w&&w.length>0&&{annotations:w}),fe),j);return Y||G||(ve?e.jsx(zo,{componentName:"Heatmap",message:ve,width:F,height:H}):e.jsx(Eo,{componentName:"Heatmap",width:F,height:H,children:e.jsx(En,Object.assign({ref:s},xe))}))});pi.displayName="Heatmap";const yi="__splomIdx",mi={top:4,bottom:4,left:4,right:4};function vi({frameRef:i,cellSize:r,onBrush:s}){const l=t.useRef(null),a=r-mi.left-mi.right,c=r-mi.top-mi.bottom;return t.useEffect(()=>{if(!l.current)return;const e=n.select(l.current).select(".brush-g"),t=o.brush().extent([[0,0],[a,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void s(null);const[[o,r],[l,a]]=e.selection,c=[[n.x.invert(o),n.y.invert(r)],[n.x.invert(l),n.y.invert(a)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,c,i,s]),e.jsx("svg",{ref:l,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${mi.left},${mi.top})`})})}function bi({data:n,xField:o,yField:i,cellSize:r,pointRadius:s,pointOpacity:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:h,unselectedOpacity:d,mode:f,onPointHover:g}){const p=t.useRef(null),y=Jn({name:u,clientId:`splom-${o}-${i}`}),m=no({name:u,xField:o,yField:i}),v=Jn({name:h,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==g||g(null));const t=e.data,n=null==t?void 0:t[yi];void 0!==n&&(b({[yi]:[n]}),null==g||g(t,e.x+mi.left,e.y+mi.top))},[b,g]),w=t.useCallback(e=>{const t={opacity:l,r:s};return t.fill=a?ue(e,a,c):po,"hover"===f?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*l):y.isActive&&!y.predicate(e)&&(t.opacity=d),t},[a,c,l,s,f,y.isActive,y.predicate,v.isActive,v.predicate,d]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(En,{ref:p,chartType:"scatter",data:n,size:[r,r],xAccessor:o,yAccessor:i,pointStyle:w,margin:mi,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?k:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.jsx(vi,{frameRef:p,cellSize:r,xField:o,yField:i,onBrush:x})]})}function xi({data:n,field:o,label:i,cellSize:r,bins:s,colorBy:l,colorScale:a,brushSelectionName:c,hoverSelectionName:u,mode:h}){const d=Jn({name:c,clientId:"splom-diag-"+o}),f=Jn({name:u,clientId:`splom-diag-${o}-hover`}),g="hover"===h?f:d,p=g.isActive,y=g.predicate,m=t.useMemo(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/s||1,a="string"==typeof l?l:null,c=a?[...new Set(n.map(e=>e[a]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),h=Array(s).fill(0),d=Array(s).fill(0),f=Array.from({length:s},()=>Array(c.length).fill(0)),g=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const r=Math.min(Math.floor((n-t)/i),s-1);if(h[r]++,p&&!y(e)||d[r]++,a){const t=u.get(e[a]+"");void 0!==t&&(f[r][t]++,p&&!y(e)||g[r][t]++)}}const m=Math.max(...h,1),v=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),l={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,l})}),b=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),l={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,l})});return{bars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[n,o,s,r,p,y,l]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:p?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:p?.3:.6},"bg-"+n)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:.7},"sel-"+n)))]})}function ki({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function wi(n){const{data:o,fields:i,fieldLabels:r={},colorBy:s,colorScheme:l,cellSize:a=150,cellGap:c=4,pointRadius:u=2,pointOpacity:h=.5,diagonal:f="histogram",histogramBins:g=20,brushMode:p="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=n,O="splom",M="splom-hover",S=y?"hover":p?"brush":"hover",C=Kn(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(M),P(null)},[C,M]),B=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[yi]?e:Object.assign(Object.assign({},e),{[yi]:t})),[o]),T=bo(B,s,l),R=void 0!==x?x:!!s,F=t.useMemo(()=>{if(!R||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:T?T(e+""):po})):null},[R,s,B,T]),H=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>a+"px").join(" "),gridTemplateRows:i.map(()=>a+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,a,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[F&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:H,onMouseLeave:"hover"===S?L:void 0,children:[i.map((t,n)=>e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((o,i)=>n===i?"label"===f?e.jsx(ki,{label:r[t]||t,cellSize:a},"diag-"+t):e.jsx(xi,{data:B,field:t,label:r[t]||t,cellSize:a,bins:g,colorBy:s,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,mode:S},"diag-"+t):e.jsx(bi,{data:B,xField:o,yField:t,fieldLabels:r,cellSize:a,pointRadius:u,pointOpacity:h,colorBy:s,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,showGrid:v,tooltip:b,mode:S,onPointHover:"hover"===S?(e,r,s)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===S&&(()=>{const t=_.datum,n=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,l=k?"function"==typeof k?k(t):t[k]:"Row "+t[yi];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(a+c)+_.px,top:_.rowIndex*(a+c)+_.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.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function ji(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(uo,{selections:i,children:e.jsx(wi,Object.assign({},t))})}function Ai({width:i,height:r,margin:s,scales:l,brushDirection:a,extent:c,onBrush:u}){const h=t.useRef(null),d=t.useRef(null),f=t.useRef(!1),g=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!h.current||!l)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?o.brushX().extent([[0,0],[i,r]]):o.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(f.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===a?l.x:l.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,i,r,a,u]),t.useEffect(()=>{if(!d.current||!l||!h.current)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?l.x:l.y;if(f.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);f.current=!1},[c,l,a]),e.jsx("svg",{ref:h,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function Oi(n){var o,i;const{data:r,width:s=600,height:l=400,margin:a,className:c,title:u,description:h,summary:d,xLabel:f,yLabel:g,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:O=2,fillArea:M=!1,areaOpacity:S=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:B,legendPosition:T,tooltip:R,minimap:F={},renderBefore:H=!1,onBrush:I,brushExtent:N,frameProps:z={},loading:W,emptyContent:D}=n,$=qo(W,s,l),E=$?null:Xo(r,s,l,D),Y=t.useMemo(()=>v(r),[r]),[G,X]=t.useState(null),q=null!=N?N:G,V=t.useCallback(e=>{N||X(e),null==I||I(e)},[N,I]),U=t.useRef(null),[K,Q]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=U.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?Q(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const Z=void 0!==(null===(o=Y[0])||void 0===o?void 0:o[k]),J=t.useMemo(()=>{if(Z)return Y;if(x){const e=Y.reduce((e,t)=>{const n="function"==typeof x?x(t):t[x];if(!e[n]){const t={[k]:[]};"string"==typeof x&&(t[x]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Y}]},[Y,x,k,Z]),ee=t.useMemo(()=>Z||x?J.flatMap(e=>{const t=e[k]||[];return x&&"string"==typeof x?t.map(t=>Object.assign(Object.assign({},t),{[x]:e[x]})):t}):Y,[J,k,Z,x,Y]),te=bo(Y,w,j),ne=t.useMemo(()=>e=>{const t={strokeWidth:O};return t.stroke=w?ue(e,w,te):po,M&&(t.fill=t.stroke,t.fillOpacity=S),t},[w,te,O,M,S]),oe=t.useMemo(()=>F.lineStyle?F.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=w?ue(e,w,te):po,t},[w,te,F.lineStyle]),ie=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ue(e.parentLine||e,w,te):po,t}},[C,_,w,te]),{legend:re,margin:se,legendPosition:le}=wo({data:J,colorBy:w,colorScale:te,showLegend:B,legendPosition:T,userMargin:a}),ae=F.height||60,ce=t.useMemo(()=>{var e,t,n,o,i,r,s,l;return{top:null!==(t=null===(e=F.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=F.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=F.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:se.left,right:null!==(l=null===(s=F.margin)||void 0===s?void 0:s.right)&&void 0!==l?l:se.right}},[F.margin,se]),he=F.brushDirection||"x",de=Qo({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:b}});if(de)return e.jsx(zo,{componentName:"MinimapChart",message:de,width:s,height:l});const fe=M?"area":"line",ge=t.useMemo(()=>No([{label:f||Ro(m),accessor:m,role:"x",format:p},{label:g||Ro(b),accessor:b,role:"y",format:y}]),[m,b,f,g,p,y]),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:fe,data:ee,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:ne},C&&{pointStyle:ie}),{size:[s,l],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se,showAxes:!0,xLabel:f,yLabel:g,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),re&&{legend:re,legendPosition:le}),u&&{title:u}),h&&{description:h}),d&&{summary:d}),{tooltipContent:!1===R?()=>null:To(R)||ge}),q&&{xExtent:q}),z),ye={chartType:fe,data:ee,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:oe,size:[s,ae+ce.top+ce.bottom],margin:ce,showAxes:null!==(i=F.showAxes)&&void 0!==i&&i,background:F.background,enableHover:!1},me=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(En,Object.assign({ref:U},ye)),e.jsx(Ai,{width:s-ce.left-ce.right,height:ae,margin:ce,scales:K,brushDirection:he,extent:q,onBrush:V})]},"minimap"),ve=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(En,Object.assign({},pe))},"main");return $||E||e.jsx(Eo,{componentName:"MinimapChart",width:s,height:l,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[H?me:ve,H?ve:me]})})}ji.displayName="ScatterplotMatrix",Oi.displayName="MinimapChart";const Mi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",xCenter:f,yCenter:g,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:b=12,colorBy:x,colorScheme:k,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:O=.8,tooltip:M,pointIdAccessor:S,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:B,onClick:T,hoverHighlight:R,chartId:F,loading:H,emptyContent:I,legendInteraction:N,legendPosition:z,color:W,stroke:D,strokeWidth:$,opacity:E}=n,{width:Y,height:G,enableHover:X,showGrid:q,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>v(s),[s]),ne=Jo({data:te,rawData:s,colorBy:x,colorScheme:k,legendInteraction:N,legendPosition:z,selection:P,linkedHover:L,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:R,chartType:"QuadrantChart",chartId:F,showLegend:V,userMargin:l,marginDefaults:r.marginDefaults,loading:H,emptyContent:I,width:Y,height:G});Vo("QuadrantChart",te,"xAccessor",h),Vo("QuadrantChart",te,"yAccessor",d);const oe=t.useMemo(()=>{if(!te.length)return;const e="function"==typeof h?h:e=>+e[h],t="function"==typeof d?d:e=>+e[d];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of te){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!=f&&isFinite(f)&&(n>f&&(n=f),f>o&&(o=f)),null!=g&&isFinite(g)&&(i>g&&(i=g),g>r&&(r=g)),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]}},[te,h,d,f,g]),ie=t.useMemo(()=>{if(!w||0===te.length)return;const e=te.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,w]),re=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),se=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>e=>{const t={fillOpacity:O};if(x)ne.colorScale&&(t.fill=ue(e,x,ne.colorScale));else{const n=re(e),o=se(e),i=null!=f?n>=f:void 0,r=null!=g?o>=g:void 0;t.fill=void 0===r||void 0===i?W||po:r&&i?p.topRight.color:r&&!i?p.topLeft.color:!r&&i?p.bottomRight.color:p.bottomLeft.color}return t.r=w?de(e,w,j,ie):A,t},[x,ne.colorScale,w,j,ie,A,O,re,se,f,g,p,W]),ae=t.useMemo(()=>So(le,{stroke:D,strokeWidth:$,opacity:E}),[le,D,$,E]),ce=t.useMemo(()=>fo(ae,ne.effectiveSelectionHook,ne.resolvedSelection),[ae,ne.effectiveSelectionHook,ne.resolvedSelection]),he=t.useMemo(()=>{if(!te.length)return;const e=new Set;"string"==typeof h&&e.add(h),"string"==typeof d&&e.add(d),"string"==typeof x&&e.add(x),"string"==typeof w&&e.add(w);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,h,d,x,w]),fe=t.useMemo(()=>No([...he?[{label:he,accessor:he,role:"title"}]:[],{label:J||Ro(h),accessor:h,role:"x",format:c},{label:ee||Ro(d),accessor:d,role:"y",format:u},...x?[{label:Ro(x),accessor:x,role:"color"}]:[],...w?[{label:Ro(w),accessor:w,role:"size"}]:[]]),[he,h,d,J,ee,x,w,c,u]),ge=Qo({componentName:"QuadrantChart",data:s,accessors:{xAccessor:h,yAccessor:d}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.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!=f?o.x(f):s/2,c=null!=g?o.y(g):l/2;if(null!=f&&!isFinite(a))return;if(null!=g&&!isFinite(c))return;const u=Math.max(0,Math.min(s,a)),h=Math.max(0,Math.min(l,c)),d=[{config:p.topLeft,x:0,y:0,w:u,h:h},{config:p.topRight,x:u,y:0,w:s-u,h:h},{config:p.bottomLeft,x:0,y:h,w:u,h:l-h},{config:p.bottomRight,x:u,y:h,w:s-u,h:l-h}];for(const t of d)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,h),e.lineTo(s,h),e.stroke(),e.setLineDash([])}]},[f,g,p,y]),ye=t.useMemo(()=>m?[...pe,(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!=f?n.x(f):i/2,l=null!=g?n.y(g):r/2;(null==f||isFinite(s))&&(null==g||isFinite(l))&&(e.font=`600 ${b}px sans-serif`,e.globalAlpha=.5,e.fillStyle=p.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(p.topLeft.label,8,8),e.fillStyle=p.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(p.topRight.label,i-8,8),e.fillStyle=p.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(p.bottomLeft.label,8,r-8),e.fillStyle=p.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(p.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:pe,[pe,m,b,p,f,g]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const r=i.width,s=i.height,l=null!=f?o.x(f):r/2,a=null!=g?o.y(g):s/2;if(null!=f&&!isFinite(l))return null;if(null!=g&&!isFinite(a))return null;const c=Math.max(0,Math.min(r,l)),u=Math.max(0,Math.min(s,a));return e.jsxs(e.Fragment,{children:[[{config:p.topLeft,x:0,y:0,w:c,h:u},{config:p.topRight,x:c,y:0,w:r-c,h:u},{config:p.bottomLeft,x:0,y:u,w:c,h:s-u},{config:p.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("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.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+b,fill:p.topLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.topLeft.label}),e.jsx("text",{x:r-8,y:8+b,fill:p.topRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:p.bottomLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:p.bottomRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.bottomRight.label})]})]})}]},[f,g,p,y,m,b]),be=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!=s&&{data:te}),{xAccessor:h,yAccessor:d,colorAccessor:x||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:ce,colorScheme:k,size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:X,showGrid:q}),oe&&{xExtent:oe.xExtent,yExtent:oe.yExtent}),ne.legendBehaviorProps),U&&{title:U}),K&&{description:K}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),a&&{className:a}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?fe:To(M)||fe}),(L||B||T||R)&&{customHoverBehavior:ne.customHoverBehavior}),(B||T||L)&&{customClickBehavior:ne.customClickBehavior}),S&&{pointIdAccessor:S}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ne.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return ne.earlyReturn?ne.earlyReturn:ge?e.jsx(zo,{componentName:"QuadrantChart",message:ge,width:Y,height:G}):e.jsx(Eo,{componentName:"QuadrantChart",width:Y,height:G,children:e.jsx(En,Object.assign({ref:i},be))})});Mi.displayName="QuadrantChart";const Si="__ma_unitized",Ci="__ma_series";function _i(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Pi(e,t){return t[0]+e*(t[1]-t[0])}const Li=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=t.useRef([]),l=t.useRef(n.series);l.current=n.series,t.useImperativeHandle(o,()=>{const e=()=>{var e;return(null!==(e=l.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||s.current[e];if(!i)continue;const l=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=l&&isFinite(l)&&r.current.push(Object.assign(Object.assign({},o),{[Si]:_i(l,i),[Ci]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.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||s.current[t];if(!r)continue;const l=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=l&&isFinite(l)&&o.push(Object.assign(Object.assign({},e),{[Si]:_i(l,r),[Ci]:i.label||"Series "+(t+1)}))}r.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const a=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:h,xFormat:f,xAccessor:g="x",series:p,colorScheme:y,curve:m="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:S,chartId:C,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,stroke:T,strokeWidth:R,opacity:F}=n,{width:H,height:I,enableHover:N,showGrid:z,showLegend:W=!0,title:D,description:$,summary:E,accessibleTable:Y,xLabel:G}=a,X=t.useMemo(()=>v(c),[c]),q=t.useMemo(()=>v(p),[p]),V=q,U=2===q.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||U||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const K=qo(_,H,I),Q=K?null:Xo(c,H,I,P),Z=vo(),J=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(Z&&Z.length>0)e=Z;else{const t=se[y];e=Array.isArray(t)?t:le}return V.map((t,n)=>t.color||e[n%e.length])},[V,y,Z]),ee=t.useMemo(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:te,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(s.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.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]}(X,e.yAccessor));if(s.current=e,!U){const t=[];for(const e of X)for(let n=0;q.length>n;n++){const o=q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Si]:i,[Ci]:ee[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of X)for(let o=0;2>o;o++){const i=q[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Si]:_i(r,e[o]),[Ci]:ee[o]}))}return{unitizedData:t,extents:e}},[X,q,U,ee]),oe=t.useMemo(()=>{if(U&&ne.length>=2)return[{orient:"left",label:ee[0],tickFormat:q[0].format||(e=>{const t=Pi(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ee[1],tickFormat:q[1].format||(e=>{const t=Pi(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[U,ne,q,ee]),ie=Jo({data:t.useMemo(()=>te.length>0?te:ee.map(e=>({[Ci]:e})),[te,ee]),rawData:c,colorBy:Ci,colorScheme:J,legendInteraction:L,legendPosition:B,selection:j,linkedHover:A,fallbackFields:[Ci],unwrapData:!1,onObservation:O,onClick:M,hoverHighlight:S,chartType:"MultiAxisLineChart",chartId:C,showLegend:W,userMargin:u,marginDefaults:U?Object.assign(Object.assign({},a.marginDefaults),{left:70,right:70}):a.marginDefaults,loading:_,emptyContent:P,width:H,height:I});if(ie.earlyReturn)return ie.earlyReturn;const re=t.useMemo(()=>{const e=new Map;return ee.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[Ci])||J[0],strokeWidth:b,fill:"none"})},[ee,J,b]),ae=t.useMemo(()=>So(re,{stroke:T,strokeWidth:R,opacity:F}),[re,T,R,F]),ce=t.useMemo(()=>fo(ae,ie.effectiveSelectionHook,ie.resolvedSelection),[ae,ie.effectiveSelectionHook,ie.resolvedSelection]),ue=t.useMemo(()=>{if(!1===x)return()=>null;return To(x)||(e=>{var t;const n=e.data||e,o=n[Ci],i=ee.indexOf(o),r=n[Si],s=U&&i>=0&&ne[i]?Pi(r,ne[i]):r,l=i>=0&&(null===(t=q[i])||void 0===t?void 0:t.format)?q[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof g?g(n):n[g];return d.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},d.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[i]||"inherit"}},o),d.createElement("div",null,`${"string"==typeof g?g:"x"}: ${a}`),d.createElement("div",null,`${o}: ${l(s)}`))})},[x,ee,J,ne,U,q,g]),he=Qo({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),de=U?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:te}),{xAccessor:g,yAccessor:Si,groupAccessor:Ci,lineStyle:ce,colorScheme:J,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:a.showAxes}),oe&&{axes:oe}),{xLabel:G}),U?{}:{yLabel:ee[0]}),{xFormat:f}),U&&de&&{yExtent:de}),{enableHover:N}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:z,curve:m}),ie.legendBehaviorProps),D&&{title:D}),$&&{description:$}),E&&{summary:E}),void 0!==Y&&{accessibleTable:Y}),h&&{className:h}),null!=n.animate&&{animate:n.animate}),{tooltipContent:ue}),k&&{annotations:k}),(A||O||M||S)&&{customHoverBehavior:ie.customHoverBehavior}),(O||M||A)&&{customClickBehavior:ie.customClickBehavior}),ie.crosshairProps),w);return K||Q||(he?e.jsx(zo,{componentName:"MultiAxisLineChart",message:he,width:H,height:I}):e.jsx(Eo,{componentName:"MultiAxisLineChart",width:H,height:I,children:e.jsx(En,Object.assign({ref:r},fe))}))});Li.displayName="MultiAxisLineChart";const Bi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",highAccessor:d="high",lowAccessor:f="low",openAccessor:g,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:j,onClick:A,chartId:O,loading:M,emptyContent:S}=n,{width:C,height:_,enableHover:P,showGrid:L,title:B,description:T,summary:R,accessibleTable:F,xLabel:H,yLabel:I}=r,N=qo(M,C,_),z=N?null:Xo(s,C,_,S),W=t.useMemo(()=>v(s),[s]),D=null==g||null==p;Vo("CandlestickChart",W,"xAccessor",h),Vo("CandlestickChart",W,"highAccessor",d),Vo("CandlestickChart",W,"lowAccessor",f),D||(Vo("CandlestickChart",W,"openAccessor",g),Vo("CandlestickChart",W,"closeAccessor",p));const{customHoverBehavior:$,customClickBehavior:E,crosshairSourceId:Y}=xo({selection:k,linkedHover:w,onObservation:j,onClick:A,chartType:"CandlestickChart",chartId:O}),G=ko(w,Y),X=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?t:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},t),l)},[l,r.marginDefaults,n.mode]),q=t.useMemo(()=>{const e=[{label:H||Ro(h),accessor:h,role:"x",format:c}];return D?(e.push({label:"High",accessor:d,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:g,format:u}),e.push({label:"High",accessor:d,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:p,format:u})),No(e)},[h,H,c,u,d,f,g,p,D]),V=Qo({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:h,highAccessor:d,lowAccessor:f},!D&&{openAccessor:g,closeAccessor:p})}),U=Math.max(2,Math.min(12,Math.round(C/40))),K=C>200?.1:.02,Q=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!=s&&{data:W}),{xAccessor:h,yAccessor:d,highAccessor:d,lowAccessor:f}),!D&&{openAccessor:g,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:U,extentPadding:K,size:[C,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X,showAxes:r.showAxes,xLabel:H,yLabel:I,xFormat:c,yFormat:u,enableHover:P,showGrid:L}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),si({title:B,description:T,summary:R,accessibleTable:F,className:a,animate:n.animate})),ai({tooltip:m,defaultTooltipContent:q})),li({linkedHover:w,onObservation:j,onClick:A,customHoverBehavior:$,customClickBehavior:E})),b&&b.length>0&&{annotations:b}),G),x);return N||z||(V?e.jsx(zo,{componentName:"CandlestickChart",message:V,width:C,height:_}):e.jsx(Eo,{componentName:"CandlestickChart",width:C,height:_,children:e.jsx(En,Object.assign({ref:i},Q))}))});Bi.displayName="CandlestickChart";const Ti=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,xExtent:l,yExtent:a,showAxes:c=!1,margin:u,className:h,annotations:d,onObservation:f,onClick:g,selection:p,linkedHover:y,chartId:m,loading:v,emptyContent:b,colorScheme:x,frameProps:k={}}=n,{frameRef:w,resolved:j,safeData:A,setup:O,earlyReturn:M}=function(e){var n;const o=function(e){const n=t.useRef(null);return ei(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:Oo(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:t.useMemo(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=Jo({data:null!==(n=e.data)&&void 0!==n?n:[],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:i.showLegend,userMargin:r,marginDefaults:i.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:i,colorScheme:x,selection:p,linkedHover:y,onObservation:f,onClick:g,chartId:m,loading:v,emptyContent:b,margin:u,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,mode:n.mode,xLabel:n.xLabel,yLabel:n.yLabel});if(M)return M;const{width:S,height:C,enableHover:_,showGrid:P,title:L,description:B,summary:T,accessibleTable:R,xLabel:F,yLabel:H}=j,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:A}),{customLayout:r,layoutConfig:s,xExtent:l,yExtent:a,colorScheme:x,size:[S,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,showAxes:c,xLabel:F,yLabel:H,enableHover:_,showGrid:P}),O.legendBehaviorProps),si({title:L,description:B,summary:T,accessibleTable:R,className:h,animate:n.animate})),null!=n.tooltip&&{tooltipContent:n.tooltip}),li({linkedHover:y,onObservation:f,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),d&&d.length>0&&{annotations:d}),O.crosshairProps),k);return e.jsx(Eo,{componentName:"XYCustomChart",width:S,height:C,children:e.jsx(En,Object.assign({ref:w},I))})});function Ri(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),r=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Fi(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),r=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}Ti.displayName="XYCustomChart";const Hi="__forecastSegment";function Ii(e,t){return"function"==typeof t?t(e):!!e[t]}const Ni=Object.freeze({__proto__:null,SEGMENT_FIELD:Hi,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(r=o).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,n,o,i){var r,s,l,a;const{isTraining:c,isForecast:u,isAnomaly:h,upperBounds:d,lowerBounds:f,color:g="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&Ii(e,u)?t="forecast":c&&Ii(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[Hi]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][Hi]!==n[e+1][Hi]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[Hi]:n[e][Hi]})),t.push(Object.assign(Object.assign({},n[e]),{[Hi]:n[e+1][Hi]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][Hi]!==b[e+1][Hi]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[Hi]:b[e][Hi]})),k.push(Object.assign(Object.assign({},b[e]),{[Hi]:b[e+1][Hi]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[Hi]&&e.push(Object.assign(Object.assign({},t),{[Hi]:"training-base"}));k.unshift(...e)}const w=[];if(d&&f){const e="string"==typeof d?d:"__envUpper",t="string"==typeof f?f:"__envLower";if("function"==typeof d||"function"==typeof f)for(const n of k)"function"==typeof d&&(n[e]=d(n)),"function"==typeof f&&(n[t]=f(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:g,fillOpacity:p,label:v})}if(h){const e=o.anomalyStyle,t={type:"highlight",filter:e=>Ii(e,h)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(l=i.bandOpacity)&&void 0!==l?l:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var r,s,l;const{trainEnd:a,steps:c=10,confidence:u=.95,color:h="#6366f1",bandOpacity:d=.15,label:f}=o;if(null==a)return{processedData:e,annotations:[]};const g=[],p=[];for(const n of e)n[t]>a?p.push(Object.assign(Object.assign({},n),{[Hi]:"observed"})):g.push(Object.assign(Object.assign({},n),{[Hi]:"training"}));const y=g.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const o=y.length;let i=0,r=0,s=0,l=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,l+=e*t;const a=o*s-i*i;if(Math.abs(a)>1e-12){const s=(o*l-i*r)/a,g=(r-s*i)/o,p=e=>g+s*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(o-2,1)),k=y.reduce((e,t)=>e+t[0],0)/o,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),O=Math.max(...A),M=y.length>1?(y[o-1][0]-y[0][0])/(o-1):1;for(let e=1;c>=e;e++){const i=O+e*M,r=p(i),s=x*Math.sqrt(1+1/o+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[n]:r,[Hi]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:h,fillOpacity:d,label:f})}}m.push({type:"x-threshold",x:a,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label});const b=[];if(b.push(...g),g.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},g[g.length-1]),{[Hi]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:g[g.length-1];e&&b.push(Object.assign(Object.assign({},e),{[Hi]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var r},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",r=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",s=t.color||"#6366f1",l=t.trainOpacity,a=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,h=t.trainUnderline;return t=>{const n=e(t),o=t[Hi];if("training"===o){let e=n.stroke;return"darken"===c?e=Ri(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=l&&{strokeOpacity:l})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===h&&(e=Fi(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}return"forecast"===o?Object.assign(Object.assign(Object.assign({},n),{stroke:s,strokeDasharray:r}),null!=a&&{strokeOpacity:a}):n}},darkenColor:Ri,lightenColor:Fi});exports.AreaChart=ci,exports.BubbleChart=gi,exports.CandlestickChart=Bi,exports.ConnectedScatterplot=fi,exports.Heatmap=pi,exports.LineChart=ri,exports.MinimapChart=Oi,exports.MultiAxisLineChart=Li,exports.QuadrantChart=Mi,exports.Scatterplot=hi,exports.ScatterplotMatrix=ji,exports.StackedAreaChart=ui,exports.StreamXYFrame=En,exports.XYCustomChart=Ti;
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),s=require("d3-quadtree"),r=require("d3-shape"),l=require("d3-array"),a=require("d3-hierarchy"),c=require("regression");function u(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const d=h(t),f=u(c);function g(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 p(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 y({width:i,height:s,totalWidth:r,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:h,binSize:d,snap:f,binBoundaries:y,snapDuring:m,streaming:v}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(h);k.current=h;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>y?[...y].sort((e,t)=>e-t):void 0,[y]),A=t.useRef(j);A.current=j;const O=t.useRef(!1),M=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,s]]),t.on("brush end",n=>{if(O.current)return;const o=w.current;if(!o)return;if(!n.selection)return M.current=null,void k.current(null);let r,l;if("x"===c){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],l=[o.y.invert(s),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(i)],l=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,s]]=n.selection;r=[o.x.invert(e),o.x.invert(i)],l=[o.y.invert(s),o.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===n.type||"brush"===n.type&&m)){const i=A.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[g(e[0],t),p(e[1],t)]}(r,i):d&&d>0&&(r=[Math.floor(r[0]/d)*d,Math.ceil(r[1]/d)*d]);const s=o.x(r[0]),l=o.x(r[1]);if(O.current=!0,"x"===c)e.call(t.move,[s,l]);else if("xy"===c){const o=n.selection;e.call(t.move,[[s,o[0][1]],[l,o[1][1]]])}O.current=!1}const a={x:r,y:l};M.current=a,k.current(a)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,s,c,f,d,m]),t.useEffect(()=>{if(!(v&&u&&x.current&&M.current))return;if(!b.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);let i=e.x[0],s=!1;if(t>e.x[0]){if(i=t,"bin"===f){const e=A.current;e&&e.length>0?i=p(t,e):d&&d>0&&(i=Math.ceil(t/d)*d)}if(i>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);s=!0}const r=u.x(i),l=u.x(e.x[1]);if(O.current=!0,"x"===c)o.call(x.current.move,[r,l]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[r,t],[l,n]])}if(O.current=!1,s){const t={x:[i,e.x[1]],y:e.y};M.current=t,k.current(t)}},[u,v,c,f,d]),e.jsx("svg",{ref:b,width:r,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const m=Object.freeze([]);function v(e){if(!e)return m;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 b{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=v(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=v(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 x(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),s=k(n);return[function({children:o,initialState:s}){const r=t.useRef(s),l=t.useMemo(()=>k(n,r.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),r=null!==(n=t.useContext(o))&&void 0!==n?n:s,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(r.getState()),[r]),c=t.useCallback(()=>l.current(r.getState()),[r]);return t.useSyncExternalStore(r.subscribe,a,c)}]}function k(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function w(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 j(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:A})})),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 A=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],O={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:10}},M={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:10}},S={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:A,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 C(e,t){if("light"===t)return O;if("dark"===t)return M;if("high-contrast"===t)return S;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?M:O;return j(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 j(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[_,P]=x(e=>({theme:O,setTheme(t){e(e=>({theme:C(e.theme,t)}))}}));class L{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 s=(o+i)%this._capacity,r=this.buffer[s];if(e(r)){let e;e="object"!=typeof r||null===r?r:Array.isArray(r)?[...r]:Object.assign({},r),n.push(e),this.buffer[s]=t(r)}}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 B{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 T(e,t,n,o,i){const s=new Map;for(const r of e){const e=t(r),l=n(r);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=s.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},s.set(a,c)),c.total+=l,i){const e=i(r);c.categories.set(e,(c.categories.get(e)||0)+l)}}return s}function R(e,t,n,o,i,s){const r=[];for(const i of e){const e=n(i),s=o(i);Number.isFinite(e)&&Number.isFinite(s)&&r.push({px:t.x(e),py:t.y(s),rawY:s,d:i})}r.sort((e,t)=>e.px-t.px);const l=Array(r.length),a=Array(r.length),c=Array(r.length);for(let e=0;r.length>e;e++){const t=r[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:s}}function F(e,t,n,o,i,s,r,l){const a=[];for(const s of e){const e=n(s),r=o(s);if(!Number.isFinite(e)||!Number.isFinite(r))continue;const c=t.x(e),u=l?l(s):i;a.push({px:c,topY:t.y(r),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:s,datum:e,group:r}}function H(e,t,n,o){var i,s,r;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 s=e[o-1],r=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,r)||0;a+=(2*u+t)*(t-(n(e,s)||0)),c+=t,u+=t}const h=null!==(i=l.get(s))&&void 0!==i?i:0;l.set(r,h-(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!==(s=l.get(i))&&void 0!==s?s:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(r=l.get(t))&&void 0!==r?r:0)-i)}}else for(const t of e)l.set(t,0);return l}function I(e,t,n,o,i,s,r){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:s,datum:e};return void 0!==r&&(c.pointId=r),c}function N(e,t,n,o,i,s,r){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:s,group:r}}function z(e,t,n,o,i,s,r){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:s};return(null==r?void 0:r.showValues)&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}function W(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function D(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function E(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function $(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function Y(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function G(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function X(e){const t=e.map(Y),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return G(e,n,o)}if(e>=1){const[e,o,i]=t[n];return G(e,o,i)}const o=e*n,i=Math.floor(o),s=o-i,[r,l,a]=t[i],[c,u,h]=t[i+1];return G(Math.round(r+(c-r)*s),Math.round(l+(u-l)*s),Math.round(a+(h-a)*s))}}const q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],V=X(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),U=X(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),K=X(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Q=X(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Z=X(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),J=X(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ee=X(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),te=X(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ne=X(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),oe=X(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ie=X(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),se=X(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);X(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),X(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),X(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),X(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),X(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const re={category10:q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:V,reds:U,greens:K,oranges:Q,purples:Z,viridis:ee,plasma:te},le=q,ae=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=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 ue(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")||ce.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):le[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%le.length]}function he(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+""))),s=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const r=re[n]||re.category10;if(s&&"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:le;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function de(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[s,r]=o,[l,a]=n;return r===s?(l+a)/2:l+(i-s)/(r-s)*(a-l)}function fe(e,t,n){var o,i,s;if(1>=n)return 1;const r=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return r+(1-l/(n-1))*(1-r);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return r+Math.pow(.5,l/t)*(1-r)}case"step":return(null!==(s=e.stepThreshold)&&void 0!==s?s:.5*n)>l?1:r;default:return 1}}function ge(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,s=n-t;return i>s?1-s/i:0}function pe(e,t,n){return e+(t-e)*n}function ye(e,t,n){var o,i,s,r;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!==(r=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(s=t.datum)||void 0===s?void 0:s.category)&&void 0!==r?r: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 me(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],i=[];for(const n of t){const t=e.getX(n),s=e.getY(n);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const r=e.getBounds(n),l=e.scales.x(t);if(r&&0!==r)o.push([l,e.scales.y(s+r)]),i.push([l,e.scales.y(s-r)]);else{const t=e.scales.y(s);o.push([l,t]),i.push([l,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:i,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function ve(e,t,n,o){var i;if(!e.config.pointStyle)return;const s=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const r of o.data){let o=e.config.pointStyle(r);!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(r)+"":void 0,c=I(r,e.scales,e.getX,s,l,o,a);c&&n.push(c)}}}const be={blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:se},xe=new Map;class ke{constructor(e){if(this.xExtent=new B,this.yExtent=new B,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._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.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new L(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=D(e.timeAccessor||e.xAccessor,"time"),this.getY=D(e.valueAccessor||e.yAccessor,"value")):(this.getX=D(e.xAccessor,"x"),this.getY=D(e.yAccessor,"y")),this.getGroup=$(e.groupAccessor),this.getCategory=$(e.categoryAccessor),this.getSize=e.sizeAccessor?D(e.sizeAccessor,"size"):void 0,this.getColor=$(e.colorAccessor),this.getBounds=e.boundsAccessor?D(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?D(e.y0Accessor,"y0"):void 0,this.getPointId=$(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?D(e.openAccessor,"open"):void 0,this.getHigh=D(e.highAccessor,"high"),this.getLow=D(e.lowAccessor,"low"),this.getClose=n?D(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new L(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))}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?D(this.config.timeAccessor||this.config.xAccessor,"time"):D(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,s="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||s,s){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)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))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}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);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))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(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!0}computeScene(e){var t,n,o,s,r,l,a,c,u,h,d,f,g,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&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(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:b[0],null!==(o=y.xExtent[1])&&void 0!==o?o:b[1]]:b,w=y.yExtent?[null!==(s=y.yExtent[0])&&void 0!==s?s:x[0],null!==(r=y.yExtent[1])&&void 0!==r?r:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1];if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(a=y.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),n=new Map,o=new Set;let i=0;const s=new Map,r=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),r=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(r))continue;t.set(e,(t.get(e)||0)+r),o.add(e),l+=r;const a=(s.get(e)||0)+r;s.set(e,a),a>i&&(i=a)}n.set(e.key,t),r.set(e.key,l)}const l=null!==(c=y.stackOrder)&&void 0!==c?c:"key",a=(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=r.get(t))&&void 0!==n?n:0)-(null!==(o=r.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}),n=[],o=[];let i=0,s=0;for(const t of e)s>i?(n.push(t),i+=null!==(u=r.get(t))&&void 0!==u?u:0):(o.push(t),s+=null!==(h=r.get(t))&&void 0!==h?h:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=r.get(e))&&void 0!==n?n:0)-(null!==(o=r.get(t))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=r.get(t))&&void 0!==n?n:0)-(null!==(o=r.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):t.map(e=>e.key).sort(a);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=H(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},y.baseline);let i=1/0,r=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(f=s.get(n))&&void 0!==f?f:0;i>e&&(i=e),e+o>r&&(r=e+o)}Number.isFinite(i)&&Number.isFinite(r)||(i=0,r=0);const l=r-i,a=l>0?l*y.extentPadding:1;w=[i-a,r+a]}else w=[0,i+(i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,n,o,i){const s=T(e,t,n,o,i);if(0===s.size)return[0,0];let r=0;for(const e of s.values())e.total>r&&(r=e.total);return[0,r]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const s of e){const e=t(s);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(m,this.getY),n=t-e,o=n>0?n*y.extentPadding:1;w=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!j&&w[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>w[1]&&(w[1]=t+n),w[0]>t-n&&(w[0]=t-n))}const e=w[1]-w[0],t=e>0?e*y.extentPadding:1,n=null===(g=y.yExtent)||void 0===g?void 0:g[0],o=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=n?w[0]:w[0]-t,null!=o?w[1]:w[1]+t],"log"===y.yScaleType&&0>=w[0]&&x[0]>0&&(w[0]=null!=n?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!j){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const A="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(A)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).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 i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),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,ke.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.quadtree().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(),s=this.scales.y.domain(),r=this.scales.x.range(),l=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=l[1]>l[0];this.scales={x:a(this.config.xScaleType,o,r[0]>r[1]?[e.width-c,c]:[c,e.width-c]),y:a(this.config.yScaleType,s,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,s,r,l,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},h={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:a,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ae},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const s=this.resolveLineStyle(e,t);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(s=c.layoutConfig)&&void 0!==s?s:{}};let d;try{d=c.customLayout(h)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(r=d.overlays)&&void 0!==r?r:null,null!==(l=d.nodes)&&void 0!==l?l:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const h={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,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(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],s=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.getBounds)for(const t of o){const n=me(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=R(t.data,e.scales,e.getX,e.getY,n,t.key);s&&s.length>0&&(o.colorThresholds=s),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return ve(e,o,i),i}(h,t);case"area":return function(e,t){const n=e.groupData(t),o=[],i=e.scales.y.domain()[0],s=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]),r=F(t.data,e.scales,e.getX,e.getY,i,n,t.key,s);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ve(e,n,o),o}(h,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set,s=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?s:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=F(t.data,e.scales,e.getX,e.getY,s,n,t.key,r);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),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=R(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 ve(e,n,o),o}(h,t);case"stackedarea":return function(e,t){var n,o,i,s;const r=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>r.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 r){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)r.sort((e,o)=>{var i,s;const r=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(s=t.get(o.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)});else if("desc"===l)r.sort((e,o)=>{var i,s;const r=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(s=t.get(e.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)});else{const e=[...r].sort((e,o)=>{var i,s;const r=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(s=t.get(e.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)}),s=[],l=[];let a=0,c=0;for(const n of e)c>a?(s.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);r.length=0,r.push(...l.reverse(),...s)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(s=e.config.baseline)&&void 0!==s?s:"zero",{nodes:h,stackedTops:d}=function(e,t,n,o,i,s,r,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 h=Array.from(u).sort((e,t)=>e-t),d=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),s=o(i);Number.isFinite(t)&&Number.isFinite(s)&&e.set(t,(e.get(t)||0)+s)}d.set(t.key,e)}let f;if(s){f=new Map;for(const t of h){let n=0;for(const o of e)n+=(null===(a=d.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=H(h,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=d.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of h)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=d.get(n.key),o=[],l=[],a=new Map;for(const n of h){let i=e.get(n)||0;const r=m.get(n);s&&(i/=f.get(n));const c=r+i,u=t.x(n);l.push([u,t.y(r)]),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};r&&(c.curve=r),p.push(c)}return{nodes:p,stackedTops:y}}(r,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=h;if(e.config.pointStyle){const t=new WeakMap;for(const n of r){const o=d.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),s=e.getY(i);null==n||Number.isNaN(n)||null==s||Number.isNaN(s)||!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)};ve(e,r,f,n)}return f}(h,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,s=e.config.sizeRange||[3,15];let r=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);r=n=>e===t?(s[0]+s[1])/2:s[0]+(n-e)/(t-e)*(s[1]-s[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},s=t.r||i;if(r&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(s=r(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 c=e.getPointId?e.getPointId(n)+"":void 0,u=I(n,e.scales,e.getX,e.getY,s,t,c);u&&o.push(u)}return o}(h,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,s;const r=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!==(s=e.config.heatmapAggregation)&&void 0!==s?s:"count",c=D(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,h]=e.scales.x.domain(),[d,f]=e.scales.y.domain(),g=(h-u||1)/r,p=(f-d||1)/l,y=r*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),s=e.getY(o);if(!isFinite(i)||!isFinite(s))continue;const a=Math.min(Math.floor((i-u)/g),r-1),h=Math.min(Math.floor((s-d)/p),l-1);if(0>a||0>h)continue;const f=h*r+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 k=x-b||1,w=n.width/r,j=n.height/l,A=e.config.showValues,O=e.config.heatmapValueFormat,M=[];for(let e=0;l>e;e++){const t=e*r;for(let n=0;r>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 s=(i-b)/k;M.push(z(n*w,(l-1-e)*j,w,j,`rgb(${220-(180*s+.5)|0},${220-(100*s+.5)|0},${255-(50*s+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*g,yCenter:d+(e+.5)*p,agg:a},A?{value:i,showValues:!0,valueFormat:O}:void 0))}}return M}(e,t,n);if(0===t.length)return[];const o=D(e.config.valueAccessor,"value"),i=E(e.config.xAccessor,"x"),s=E(e.config.yAccessor,"y"),r=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=s(n);a[e]=o,c[e]=u,r.has(o)||r.set(o,r.size),l.has(u)||l.set(u,l.size)}const u=r.size,h=l.size;if(0===u||0===h)return[];const d=Array.from(r.keys()),f=Array.from(l.keys()),g=d.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){d.sort((e,t)=>e-t),r.clear();for(let e=0;d.length>e;e++)r.set(d[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=r.get(a[e]),s=l.get(c[e]);if(void 0===i||void 0===s)continue;const h=o(n),d=s*u+i,f=b.get(d);let g;void 0!==f?g=f:(g=x++,b.set(d,g)),y[g]=d,m[g]=h,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const j=function(e){const t=e in be?e:"blues";let n=xe.get(t);if(n)return n;n=Array(256);const o=be[t]||V;for(let e=0;256>e;e++)n[e]=o(e/255);return xe.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),O=n.width/u,M=n.height/h,S=e.config.showValues,C=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(z(o*O,(h-1-(n-o)/u)*M,O,M,j[Math.min((t-k)*A+.5|0,255)],v[e],S?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(h,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=T(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let s=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),r=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+r.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?s=e.barCategoryCache.order:(s=[...l,...r],e.barCategoryCache={key:a,order:s})}const r=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,h=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,d=null==u?void 0:u.gap,f="number"!=typeof d||0>d?1:d,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 d=l.x(n),p=l.x(i),y=Math.abs(p-d),m=y>f+1?f:0,v=Math.min(d,p)+m/2,b=Math.max(y-m,1);if(b>0)if(s&&t.categories.size>0){let n=0;for(const i of s){const s=t.categories.get(i)||0;if(0===s)continue;const a=l.y(n),c=l.y(n+s),d=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||h||"#4e79a7";r.push(N(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:d},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:s},i)),n+=s}}else{const e=l.y(0),n=l.y(t.total);r.push(N(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||h||"#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:r,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(h,t);return this._barCategoryCache=null!==(a=h.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,s,r,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,h=null!==(s=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==s?s:"#007bff",d=null!==(r=c.opacity)&&void 0!==r?r:.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),s=e.scales.y(o);let r=h;if(e.getCategory){const t=e.getCategory(n);r=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||r}const c={type:"point",x:i,y:s,r:u,style:{fill:r,opacity:d,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(h,t);case"waterfall":return function(e,t,n){var o,i,s,r,l,a,c;const u=[],h=e.scales,d=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!==(s=null!==(o=null==d?void 0:d.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==s?s:"#28a745",p=null!==(a=null!==(r=null==d?void 0:d.negativeColor)&&void 0!==r?r:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==d?void 0:d.gap)&&void 0!==c?c:1,m=null==d?void 0:d.stroke,v=null==d?void 0:d.strokeWidth,b=null==d?void 0:d.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),s=e.getY(o),r=x+s;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=h.x(i),c=0!==l?h.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=r;continue}const j=h.y(x),A=h.y(r),O=Math.min(j,A),M=Math.abs(j-A),S={fill:0>s?p:g,stroke:m,strokeWidth:v};null!=b&&(S.opacity=b),u.push(N(k,O,w,M,S,Object.assign(Object.assign({},o),{baseline:x,cumEnd:r,delta:s,_connectorStroke:null==d?void 0:d.connectorStroke,_connectorWidth:null==d?void 0:d.connectorWidth}))),x=r}return u}(h,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 s=[],r=e.config.candlestickStyle||{},l=r.rangeColor||"#6366f1",a=i?l:r.upColor||"#28a745",c=i?l:r.downColor||"#dc3545",u=i?l:r.wickColor||"#333",h=r.wickWidth||(i?2:1),d=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=r.bodyWidth)&&void 0!==o?o:0;if(null==r.bodyWidth)if(d.length>1){let t=1/0;for(let n=1;d.length>n;n++){const o=Math.abs(e.scales.x(d[n])-e.scales.x(d[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),r=e.getLow(n);if(null==o||Number.isNaN(o)||null==r||Number.isNaN(r))continue;const l=i?o:e.getOpen(n),d=i?r:e.getClose(n);if(!i&&[l,d].some(e=>null==e||Number.isNaN(e)))continue;const g=d>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(d),highY:e.scales.y(o),lowY:e.scales.y(r),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:h,isUp:g,datum:n};i&&(p.isRange=!0),s.push(p)}return s}(h,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?fe(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const s=n.length;if(1>=s)return;const r=new Map;for(let e=0;n.length>e;e++)r.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=r.get(t[n]);null!=l?(o[n]=fe(e,l,s),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=r.get(t[n]);null!=o?(i[n]=fe(e,o,s),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=r.get(n);if(null!=t){const n=fe(e,t,s);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=r.get(n.datum);if(null==t)continue;const l=fe(e,t,s);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,s;const r="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(s=e.glowRadius)&&void 0!==s?s: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 s=o.get(t);if(null==s)continue;const l=ge(e,s,r);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 s=ge(e,i,r);s>0&&(n._pulseIntensity=s,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,s=t.peek();return null!=s&&i>o-s}(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,s,r,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=ye(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===(s=c.style)||void 0===s?void 0:s.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(r=c.style)||void 0===r?void 0:r.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=ye(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 s,r,l,a,c,u,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,E,$,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(s=t.duration)&&void 0!==s?s:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let q=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const s=n.scene[t],P=ye(e,s,t);if(!P)continue;if(s._transitionKey=P,"line"===s.type||"area"===s.type){const e=i.get(P);if(e){if(U.add(P),"line"===s.type&&e.path&&e.path.length===s.path.length){s._targetPath=s.path.map(e=>[e[0],e[1]]),s._prevPath=e.path;for(let t=0;s.path.length>t;t++)s.path[t]=[e.path[t][0],e.path[t][1]];q=!0}else if("area"===s.type&&e.topPath&&e.bottomPath&&e.topPath.length===s.topPath.length&&e.bottomPath.length===s.bottomPath.length){s._targetTopPath=s.topPath.map(e=>[e[0],e[1]]),s._targetBottomPath=s.bottomPath.map(e=>[e[0],e[1]]),s._prevTopPath=e.topPath,s._prevBottomPath=e.bottomPath;for(let t=0;s.topPath.length>t;t++)s.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;s.bottomPath.length>t;t++)s.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];q=!0}s._targetOpacity=null!==(r=s.style.opacity)&&void 0!==r?r:1,s._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:s.style.opacity)&&void 0!==a?a:1}else s._targetOpacity=null!==(c=s.style.opacity)&&void 0!==c?c:1,s._startOpacity=0,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),q=!0;continue}const L=o.get(P);if("point"===s.type)if(L){V.add(P);const e={x:s.x,y:s.y,r:s.r};s._targetOpacity=null!==(u=s.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(s._targetX=e.x,s._targetY=e.y,s._targetR=e.r,s.x=L.x,s.y=L.y,s.r=null!==(h=L.r)&&void 0!==h?h:s.r,q=!0)}else s._targetOpacity=null!==(d=s.style.opacity)&&void 0!==d?d:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),q=!0;else if("rect"===s.type)if(L){V.add(P);const e={x:s.x,y:s.y,w:s.w,h:s.h};s._targetOpacity=null!==(f=s.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=L.x,s.y=L.y,s.w=null!==(g=L.w)&&void 0!==g?g:s.w,s.h=null!==(p=L.h)&&void 0!==p?p:s.h,q=!0)}else s._targetOpacity=null!==(y=s.style.opacity)&&void 0!==y?y:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),q=!0;else if("heatcell"===s.type)if(L){V.add(P);const e={x:s.x,y:s.y,w:s.w,h:s.h};s._targetOpacity=null!==(v=null===(m=s.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||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=L.x,s.y=L.y,s.w=null!==(b=L.w)&&void 0!==b?b:s.w,s.h=null!==(x=L.h)&&void 0!==x?x:s.h,q=!0)}else s._targetOpacity=null!==(w=null===(k=s.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,s.style=Object.assign(Object.assign({},s.style||{}),{opacity:0}),q=!0;else if("candlestick"===s.type)if(L&&null!=L.openY){V.add(P);const e={x:s.x,openY:s.openY,closeY:s.closeY,highY:s.highY,lowY:s.lowY};s._targetOpacity=null!==(A=null===(j=s.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(s._targetX=e.x,s._targetOpenY=e.openY,s._targetCloseY=e.closeY,s._targetHighY=e.highY,s._targetLowY=e.lowY,s.x=L.x,s.openY=L.openY,s.closeY=null!==(O=L.closeY)&&void 0!==O?O:s.closeY,s.highY=null!==(M=L.highY)&&void 0!==M?M:s.highY,s.lowY=null!==(S=L.lowY)&&void 0!==S?S:s.lowY,q=!0)}else s._targetOpacity=null!==(_=null===(C=s.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,s.style=Object.assign(Object.assign({},s.style||{}),{opacity:0}),q=!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),q=!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),q=!0}for(const[e,t]of o)if(!V.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(B=t.r)&&void 0!==B?B:3,style:{opacity:null!==(T=t.opacity)&&void 0!==T?T: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!==(R=t.w)&&void 0!==R?R:0,h:null!==(F=t.h)&&void 0!==F?F: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!==(I=t.w)&&void 0!==I?I:0,h:null!==(N=t.h)&&void 0!==N?N:0,fill:"#999",datum:null,style:{opacity:null!==(z=t.opacity)&&void 0!==z?z:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(D=t.closeY)&&void 0!==D?D:o,highY:null!==(E=t.highY)&&void 0!==E?E: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)}q=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),q&&(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,s,r,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),h=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,s=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=pe(s,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==e._targetR&&void 0!==n.r&&(e.r=pe(n.r,e._targetR,h))}else if("rect"===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.opacity=pe(i,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}else if("heatcell"===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=Object.assign(Object.assign({},e.style||{}),{opacity:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}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:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),void 0!==n.openY&&(e.openY=pe(n.openY,e._targetOpenY,h)),void 0!==n.closeY&&(e.closeY=pe(n.closeY,e._targetCloseY,h)),void 0!==n.highY&&(e.highY=pe(n.highY,e._targetHighY,h)),void 0!==n.lowY&&(e.lowY=pe(n.lowY,e._targetLowY,h))}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:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);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]=pe(t[o][0],n[o][0],h),e.path[o][1]=pe(t[o][1],n[o][1],h)}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:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);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]=pe(t[n][0],o[n][0],h),e.topPath[n][1]=pe(t[n][1],o[n][1],h);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=pe(n[t][0],i[t][0],h),e.bottomPath[t][1]=pe(n[t][1],i[t][1],h)}}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.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data: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||ae,s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:s,version:this._ingestVersion},s}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 s=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||s||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||s||"#4e79a7",strokeWidth:i.strokeWidth||2};const r=this.resolveGroupColor(e)||s||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,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)||ae;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ke.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++,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 s=this.buffer.update(e=>n.has(o(e)),t);if(0===s.length)return s;for(const e of s)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++,s}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._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}updateConfig(e){var t,n,o,i;const s=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||"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 r=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==s.chartType||"runtimeMode"in e&&e.runtimeMode!==s.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!W(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=s.xAccessor)&&void 0!==n?n:s.timeAccessor),u=a||!W(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=s.yAccessor)&&void 0!==i?i:s.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=D(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=D(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=D(this.config.xAccessor,"x"),this.getY=D(this.config.yAccessor,"y")),r=!0,l=!0)}if("groupAccessor"in e&&!W(e.groupAccessor,s.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?$(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!W(e.categoryAccessor,s.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?$(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!W(e.sizeAccessor,s.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?D(this.config.sizeAccessor,"size"):void 0,r=!0),"colorAccessor"in e&&!W(e.colorAccessor,s.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?$(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!W(e.y0Accessor,s.y0Accessor)&&(this.getY0=this.config.y0Accessor?D(this.config.y0Accessor,"y0"):void 0,r=!0,l=!0),"boundsAccessor"in e&&!W(e.boundsAccessor,s.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?D(this.config.boundsAccessor,"bounds"):void 0,r=!0,l=!0),"pointIdAccessor"in e&&!W(e.pointIdAccessor,s.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?$(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!W(e.openAccessor,s.openAccessor)||"closeAccessor"in e&&!W(e.closeAccessor,s.closeAccessor)||"highAccessor"in e&&!W(e.highAccessor,s.highAccessor)||"lowAccessor"in e&&!W(e.lowAccessor,s.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?D(this.config.openAccessor,"open"):void 0,this.getHigh=D(this.config.highAccessor,"high"),this.getLow=D(this.config.lowAccessor,"low"),this.getClose=t?D(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,l=!0}if(!r){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==s[n]){r=!0;break}}r&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function we(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:d.createElement(d.Fragment,null,...t)}function je(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 Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Me(e,t){const n=Oe(e);if(!n)return!1;const o=Oe(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}ke.GROUP_COLOR_MAP_CAP=1e3,ke.QUADTREE_THRESHOLD=500;const Se=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ce=new WeakMap;let _e=0,Pe=!1,Le=null,Be=null,Te=null;function Re(e,t){var n,o;if(!t)return t;const i=Se.exec(t);if(!i)return t;const s=e.canvas;if(!s)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pe=!0;const e=()=>{_e++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Le=new MutationObserver(e),Le.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Be=window.matchMedia("(prefers-color-scheme: dark)"),Te=e,"function"==typeof Be.addEventListener?Be.addEventListener("change",Te):"function"==typeof Be.addListener&&Be.addListener(Te)}catch(e){}}();let r=Ce.get(s);r&&r.version===_e||(r={version:_e,map:new Map},Ce.set(s,r));const l=r.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(s).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return r.map.set(t,a),a}function Fe(e){switch(e){case"monotoneX":return r.curveMonotoneX;case"monotoneY":return r.curveMonotoneY;case"cardinal":return r.curveCardinal;case"catmullRom":return r.curveCatmullRom;case"step":return r.curveStep;case"stepBefore":return r.curveStepBefore;case"stepAfter":return r.curveStepAfter;case"basis":return r.curveBasis;case"natural":return r.curveNatural;default:return null}}function He(e,t,n){return null==t?n:"string"!=typeof t?t:Re(e,t)||n}function Ie(e,t,n,o,i,s,r){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,s,r);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)),h=e.createLinearGradient(o,i,s,r),[d,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 s=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return s?[+s[1],+s[2],+s[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${g},${c})`),h.addColorStop(1,`rgba(${d},${f},${g},${u})`),h}function Ne(e,t,n,o,i,s){const r=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>r.length)return null;const l=e.createLinearGradient(n,o,i,s);for(const e of r)l.addColorStop(e.offset,e.color);return l}const ze=new WeakMap;function We(e,t){const n=Fe(t);if(!n)return e;const o=ze.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 s={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,s,r,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 h=i/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*s+h*h*h*l,d*d*d*u+3*d*d*h*t+3*d*h*h*r+h*h*h*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,s){i=[n,s],o.push([n,s])}};return r.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(s)(e),o}(e,n);return ze.set(e,i),i}function De(e,t,n,o=30,i,s=0){let r=null;if(i){const e=function(e,t,n,o,i){const s=Math.max(o,i+5,12),r=t-s,l=t+s,a=n-s,c=n+s;let u=null,h=1/0;return e.visit((e,i,s,d,f)=>{if(i>l||r>d||s>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,s=e.x-t,r=e.y-n,l=Math.sqrt(s*s+r*r);Ae(e.r,o)>=l&&h>l&&(u=e,h=l),i=i.next}while(i)}return!1}),u?{node:u,distance:h}:null}(i,t,n,o,s);e&&(r={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"point":if(i)break;e=$e(s,t,n,o);break;case"line":e=Ye(s,t,n,o);break;case"rect":if(null==s.datum)break;e=Xe(s,t,n);break;case"heatcell":e=qe(s,t,n);break;case"area":if(!1===s.interactive)break;e=Ue(s,t,n);break;case"candlestick":e=Ve(s,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}function Ee(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Ke(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,s=o;o>0&&e[o][0]>=t?(i=o-1,s=o):e.length-1>o&&(i=o,s=o+1);const[r,l]=e[i],[a,c]=e[s];return a===r?l:l+Math.max(0,Math.min(1,(t-r)/(a-r)))*(c-l)}function $e(e,t,n,o=30){const i=t-e.x,s=n-e.y,r=Math.sqrt(i*i+s*s);return r>Ae(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:r}}function Ye(e,t,n,o=30){var i,s,r,l;if(0===e.path.length)return null;const a=Ke(e.path,t);if(0>a)return null;const[c,u]=e.path[a];let h;if(e.path.length>1){let o=1/0;const i=Math.max(0,a-1),s=Math.min(e.path.length-2,a);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[l,a]=e.path[r+1],c=Ge(t,n,i,s,l,a);o>c&&(o=c)}h=o}else{const e=t-c,o=n-u;h=Math.sqrt(e*e+o*o)}const d=null!==(l=null!==(s=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==s?s:null===(r=e.style)||void 0===r?void 0:r.lineWidth)&&void 0!==l?l:1;return h>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:c,y:u,distance:h}}function Ge(e,t,n,o,i,s){const r=i-n,l=s-o,a=r*r+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*r+(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*r),2)+Math.pow(t-u,2))}function Xe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function qe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ve(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,s=t-e.x,r=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(s*s+r*r)}}return null}function Ue(e,t,n){if(0===e.topPath.length)return null;const o=Ke(e.topPath,t);if(0>o)return null;const[i,s]=e.topPath[o],r=t-i,l=n-s,a=Math.sqrt(r*r+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:s,distance:a}}function Ke(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 Qe(e,t,n){const o=e.byGroup.get(t);let i=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,i=e)}return o[i]._flatIndex}function Ze(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Je={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function et(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Je[n])(o(e,t)),i}function tt(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function nt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ot=(t,n,o,i,s,r,l,a,c,u)=>{const{type:h="fill",styleFn:d,items:f}=t,g=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=s;return f.forEach((t,u)=>{const v=et(t,u,h,d),b=nt(t,i,s),x=s&&s.size>0&&s.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===r&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=22}),g};function it({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:s,label:r,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+d.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(s[0]+n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":r||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),r&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:r}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(s[1]-n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":r||"Gradient legend",children:[r&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:r}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[0])})]})}function st(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:h="vertical"}=t,[f,g]=d.useState(0),[p,y]=d.useState(0),m=d.useCallback((e,t)=>{g(e),y(t)},[]),v="vertical"===h?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let h=24;const d=[];return t.forEach((t,f)=>{h+=5,d.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,d.push(e.jsx("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-"+f)),h+=8),d.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ot(t,o,i,s,r,l,a,f,c,u)},"legend-group-"+f)),h+=22*t.items.length+8}),d})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:h})=>{let d=0;const f=[];t.forEach((t,n)=>{let g=0;t.label&&(g+=16);const p=((t,n,o,i,s,r,l,a,c,u,h)=>{const{type:d="fill",styleFn:f,items:g}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=s;g.forEach((t,u)=>{const x=et(t,u,d,f),k=nt(t,i,s),w=s&&s.size>0&&s.has(t.label),j=26+7*t.label.length;h&&h>0&&y>0&&y+j>h&&(m++,y=0),p.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?a===r&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=j});let x=0,k=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,i,s,r,l,a,c,n,u,h,o);g+=p.offset+5,f.push(Object.assign(Object.assign({label:t.label},p),{offset:g,totalRows:p.totalRows,totalHeight:p.totalHeight})),d+=g+12});let g=d>o?0:Math.max(0,(o-d)/2);const p=[];return f.forEach((o,i)=>{const s=t[i];s.label&&(p.push(e.jsx("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s.label},"legend-text-"+i)),g+=16),p.push(e.jsx("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+i)),g+=o.offset+5,t[i+1]&&p.push(e.jsx("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e.jsx("g",{children:p})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}),b=!(!o&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==l&&(void 0!==l||null==r))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===h&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),v]})}function rt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function lt(t){const{legend:n,totalWidth:o,totalHeight:i,margin:s,legendPosition:r="right",title:l,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=t;if(!n)return null;const f="top"===r||"bottom"===r;let g,p;return"left"===r?(g=4,p=s.top):"top"===r?(g=0,p=l?32:8):"bottom"===r?(g=0,p=i-s.bottom+50):(g=o-s.right+10,p=s.top),e.jsx("g",{transform:`translate(${g}, ${p})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(it,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):rt(n)?e.jsx(st,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):n)});var y}function at(e){return"string"==typeof e?{type:e}:e}function ct({orient:n,config:o,values:i,scale:s,size:r,length:a}){const c=function(e){var t,n,o,i,s;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!==(s=e.strokeWidth)&&void 0!==s?s:1}}(o),u="top"===n||"bottom"===n,h=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=r-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],s=t[Math.floor(.75*n)],r=s-o;return{q1:o,median:i,q3:s,whiskerLow:Math.max(t[0],o-1.5*r),whiskerHigh:Math.min(t[n-1],s+1.5*r)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:h,whiskerHigh:d}=t,f=Math.min(.5*o,20),g=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(h),p=s(d),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(g+f/2),x2:p,y2:m+y*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*g,x2:u,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*g,x2:p,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-g-f:m+g,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-g-f:m+g,x2:i,y2:"top"===n?m-g:m+g+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(h),p=s(d),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(g+f/2),y1:u,x2:m+y*(g+f/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:u,x2:m+y*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:p,x2:m+y*(g+f),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-g-f:m+g,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-g-f:m+g,y1:i,x2:"left"===n?m-g:m+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const h=l.bin().domain(t).thresholds(c.bins)(i);if(0===h.length)return null;const d=Math.max(...h.map(e=>e.length));if(0===d)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:h.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/d*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of h){if(null==e.x0||null==e.x1)continue;const r=e.length/d*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=h.length-1;e>=0;e--){const r=h[e];if(null==r.x0||null==r.x1)continue;const l=r.length/d*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.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,i=null!=h[0].x0?s(h[0].x0):0;t.push(`M${i},${e}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=h[h.length-1].x1?s(h[h.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=h[0].x0?s(h[0].x0):0;t.push(`M${e},${i}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=h[h.length-1].x1?s(h[h.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("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,r,a,n,u,4]);return h?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:h}):null}function ut(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),s=[];let r="";for(const e of i)r&&r.length+1+e.length>o?(s.push(r),r=e):r=r?`${r} ${e}`:e;return r&&s.push(r),s}function ht(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 dt(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:s,title:r,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!s&&!r)return e.jsx("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===h?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===h?"right"===d?f="end":"middle"===d&&(f="middle"):f=0>n?"end":"start";const g=16,p=r?u?[r]:ut(r,c):[],y=s?u?[s]:ut(s,c):[],m="leftRight"===h?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:p.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=p.length*g),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let k=null;if((r||s)&&(0!==n||0!==o))if("topBottom"===h){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*g+(y.length>0?g:0);let n=0,o=t;"bottom"===d?(n=-t,o=0):"middle"===d&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*g;let j=0;return"topBottom"===h?j=0>o?-(w+2):18:"leftRight"===h&&(j="middle"===d?-(w+g+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function ft(t,n,o,i,s){var r;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.jsx("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.jsx("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,r=s||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-r,x2:i,y2:(n.y2||0)-r,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)-r;l.push(e.jsx("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.jsx("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.jsx("line",{x1:0,y1:(n.y1||0)-r,x2:0,y2:(n.y2||0)-r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:ht((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.jsx("g",{className:"annotation-subject",children:l})}function gt(t,n,o,i,s,r){const l=[];let a=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==r?void 0:r.radius)){if("callout-rect"===s&&r){const e=r.width||0,o=r.height||0;if(e>0||o>0){const i=e/2,s=o/2,r=t-i,l=n-s;if(0!==r||0!==l){const t=Math.abs(r),n=Math.abs(l),u=e/2,h=o/2,d=t*h>n*u?u/t:h/n;a=i+r*d,c=s+l*d}}}else if("bracket"===s&&r){const e=r.width,t=r.height,n=r.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(r.radius||0)+(r.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e.jsx("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,s=16/180*Math.PI,r=Math.atan2(n-c,t-a);l.push(e.jsx("path",{d:`M${a},${c}L${a+o*Math.cos(r+s)},${c+o*Math.sin(r+s)}L${a+o*Math.cos(r-s)},${c+o*Math.sin(r-s)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:l})}function pt(t){const{x:n=0,y:o=0,dx:i,dy:s,nx:r,ny:l,note:a,connector:c,subject:u,type:h,color:d,className:f,disable:g,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(g)?g:[]);let v=i||0,b=s||0;null!=r&&(v=r-n),null!=l&&(b=l-o);const x="string"==typeof h?h:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&>(v,b,c,d,x,u),!m.has("subject")&&ft(x,u,d,n,o),!m.has("note")&&dt(a,v,b,d)]}))}function yt(t){var n,o;const{noteData:i}=t,{screenCoordinates:s}=i,r="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&s){const t=i.nx||s[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||s[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=s.map((n,o)=>{const s=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.jsx(pt,Object.assign({"data-testid":"semiotic-annotation"},s,{type:r}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(pt,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:r}),c)}function mt(e,t){var n,o,i;const s=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 s?null!=e.x?s(e.x):t.xAccessor&&null!=e[t.xAccessor]?s(e[t.xAccessor]):null:null}function vt(e,t){var n,o,i;const s=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 s?null!=e.y?s(e.y):t.yAccessor&&null!=e[t.yAccessor]?s(e[t.yAccessor]):null:null}function bt(e,t,n){var o,i,s,r;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const s=n.pointNodes[i];if(s.pointId===e.pointId){const e={x:s.x,y:s.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const s=function(e){var t,n,o,i,s,r;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!==(s=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==s?s:null===(r=e.scales)||void 0===r?void 0:r.value;if(!c||!u)return null;const h=a[e.xAccessor||"x"],d=a[e.yAccessor||"y"];return null==h||null==d?null:{x:c(h),y:u(d)}}(n);return s&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,s)),s}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=mt(e,n),c=vt(e,n)),null!=a&&null!=c)return null===(s=n.stickyPositionCache)||void 0===s||s.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===l){const e=null===(r=n.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}function xt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const kt={linear:r.curveLinear,monotoneX:r.curveMonotoneX,monotoneY:r.curveMonotoneY,step:r.curveStep,stepAfter:r.curveStepAfter,stepBefore:r.curveStepBefore,basis:r.curveBasis,cardinal:r.curveCardinal,catmullRom:r.curveCatmullRom};let wt={positions:new Map};const jt=new Set;function At(){for(const e of jt)e()}function Ot(e,t){const n=wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function Mt(e,t){const n=wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function St(){return wt}function Ct(e){return jt.add(e),()=>jt.delete(e)}const _t={positions:new Map};function Pt(){return()=>{}}function Lt(){return _t}function Bt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Tt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,s=Math.ceil(t/8);let r="M0,"+o;for(let e=0;s>e;e++){const n=8*(e+1);r+=`L${Math.min(8*e+4,t)},${o+4*i}`,r+=`L${Math.min(n,t)},${o}`}return r}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,s=Math.ceil(n/8);let r=`M${o},0`;for(let e=0;s>e;e++){const t=8*(e+1);r+=`L${o+4*i},${Math.min(8*e+4,n)}`,r+=`L${o},${Math.min(t,n)}`}return r}}function Rt(n){const{width:o,height:i,totalWidth:s,totalHeight:r,margin:l,scales:a,showAxes:c,axes:u,showGrid:h,xFormat:d,yFormat:f}=n,g=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||d||Ft,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,s=a.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),r=s.map(e=>e.valueOf()),l=s.map((e,t)=>({value:e,pixel:a.x(e),label:n(e,t,r)})),c=l.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 Ht(l,Math.max(55,c+8))},[a,u,d,o]),p=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||f||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Ht(a.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:a.y(e),label:n(e)})),22)},[a,u,f,i]),y=h&&a,m=c&&a;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,j=(null==b?void 0:b.jaggedBase)||!1,A="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:s,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[y&&(()=>{var t,n;const s=Bt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Bt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[g.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),p.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),x&&!w&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:A,strokeWidth:1}),w&&e.jsx("path",{d:Tt("bottom",o,i),fill:"none",stroke:A,strokeWidth:1}),k&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:A,strokeWidth:1}),j&&e.jsx("path",{d:Tt("left",o,i),fill:"none",stroke:A,strokeWidth:1})]})})}function Ft(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ht(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 It(n){var o,i;const{width:s,height:l,totalWidth:c,totalHeight:u,margin:h,scales:d,showAxes:g,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:j,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S,legendPosition:C="right",foregroundGraphics:_,marginalGraphics:P,xValues:L,yValues:B,annotations:T,svgAnnotationRules:R,xAccessor:F,yAccessor:H,annotationData:I,pointNodes:N,curve:z,underlayRendered:W,canvasObscuresUnderlay:D=!0,linkedCrosshairName:E,linkedCrosshairSourceId:$,children:Y}=n,G=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=d.x.ticks(Math.min(o,Math.max(2,Math.floor(s/70)))),r=i.map(e=>e.valueOf()),l=i.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,r)})),a=l.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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Ht(l,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,r);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[g,d,p,b,s]),X=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=d.y.domain()[1],t=d.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const s=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:s})}}return i},[g,d,p,x,l]),q=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||Ft,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[g,d,p,x,l]),V=t.useRef(new Map),U=t.useRef(null!==(o=null==T?void 0:T.length)&&void 0!==o?o:0),K=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;U.current!==K&&(U.current=K,V.current=new Map);const Q=t.useMemo(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var i,s,l,c,u,h,d,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,E,$,Y,G,X,q,V,U,K,Q,Z,J,ee;switch(t.type){case"label":{const i=bt(t,n,o);if(!i)return null;const{x:s,y:r}=i;return xt(s,r,o)?e.jsx(yt,{noteData:{x:s,y:r,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const i=bt(t,n,o);if(!i)return null;const{x:s,y:r}=i;return xt(s,r,o)?e.jsx(yt,{noteData:{x:s,y:r,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const i=mt(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const s=t.color||"#f97316",r=t.labelPosition||"top";let l;return l="bottom"===r?(o.height||0)-4:"center"===r?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=vt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const s=t.color||"#f97316",r=t.labelPosition||"right";let l,a;return"left"===r?(l=4,a="start"):"center"===r?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=a.packEnclose(i),r=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+r,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-r-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=t.padding||10,r=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...r)-s,c=Math.max(...r)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:h-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],s="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],r={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:s.map((n,i)=>{const s=mt(n,o),l=vt(n,o);if(null==s||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||r;return e.jsx("circle",Object.assign({cx:s,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=mt(t,o),s=vt(t,o);return e.jsx(yt,{noteData:{x:null!=i?i:0,y:null!=s?s:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const r=o.data||[];if(2>r.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",p=r.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(s=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==s?s:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(h=o.scales)||void 0===h?void 0:h.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===v?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]),s=o.map(e=>e[1]),r=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(r-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,h=0,d=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*i[e],d+=t*s[e],f+=t*i[e]*i[e],g+=t*i[e]*s[e])}if(0===u){l.push([t,s[e]]);continue}const p=u*f-h*h;if(1e-12>Math.abs(p))l.push([t,d/u]);else{const e=(u*g-h*d)/p;l.push([t,(d-e*h)/u+e*t])}}return l}(p,null!==(d=t.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?f.default.polynomial(p,{order:t.order||2}):f.default.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(p=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==p?p:null===(y=o.scales)||void 0===y?void 0:y.value,s=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,r=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(s,r),width:o.width||0,height:Math.abs(r-s),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(s,r)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const s=o.xAccessor||"x",l=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.time,a=null!==(j=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=o.scales)||void 0===A?void 0:A.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",h=t.filter,d=i.filter(e=>null!=e[c]&&null!=e[u]&&!(h&&!h(e))).sort((e,t)=>e[s]-t[s]);if(2>d.length)return null;const f=kt[o.curve||"linear"]||r.curveLinear,g=r.area().x(e=>l(e[s])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:p,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&d.length>0&&e.jsx("text",{x:l(d[d.length-1][s])+4,y:a(d[d.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const s=o.yAccessor||"y",r=null!==(S=null===(M=o.scales)||void 0===M?void 0:M.x)&&void 0!==S?S:null===(C=o.scales)||void 0===C?void 0:C.time,l=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!r||!l)return null;const a=i.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,h=Math.sqrt(u),d=null!==(B=t.threshold)&&void 0!==B?B:2,f=c-d*h,g=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=l(c+d*h),x=l(f),k=i.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>d*h});return e.jsxs("g",{children:[g&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const i=mt(t,o),s=vt(t,o);return null==i||null==s?null:e.jsx("circle",{cx:i,cy:s,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const s=o.xAccessor||"x",r=o.yAccessor||"y",l=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.x)&&void 0!==H?H:null===(I=o.scales)||void 0===I?void 0:I.time,a=null!==(z=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==z?z:null===(W=o.scales)||void 0===W?void 0:W.value;if(!l||!a)return null;const c=i.map(e=>[e[s],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=f.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,s]of c)t+=e,n+=s,o+=e*e,i+=e*s;const s=e*o-t*t;if(1e-12>Math.abs(s))return null;const r=(e*i-t*n)/s,l=(n-r*t)/e;u=e=>l+r*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(h-2,1)),p=c.reduce((e,t)=>e+t[0],0)/h,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(D=t.confidence)&&void 0!==D?D:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(E=t.steps)&&void 0!==E?E:5,x=c[h-1][0],k=(x-c[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),M=`${l(x)},${a(u(x))}`,S=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==($=t.fillOpacity)&&void 0!==$?$:.15,stroke:"none"}),e.jsx("polyline",{points:`${M} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:l(j[j.length-1].x)+4,y:a(j[j.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,s=null;if(null!=t.px&&null!=t.py)i=t.px,s=t.py;else{const e=bt(t,n,o);if(!e)return null;i=e.x,s=e.y}if(null==i||null==s)return null;if(!xt(i,s,o))return null;const r=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(q=t.dy)&&void 0!==q?q:0,a=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+r-a/2,y:s+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=bt(t,n,o);if(!i)return null;const{x:s,y:r}=i;return e.jsx("text",{x:s+(t.dx||0),y:r+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const s=null===(Q=o.scales)||void 0===Q?void 0:Q.o,r=null===(Z=o.scales)||void 0===Z?void 0:Z.x,l=null===(J=o.scales)||void 0===J?void 0:J.y,a=(null==s?void 0:s.bandwidth)?s:(null==r?void 0:r.bandwidth)?r:(null==l?void 0:l.bandwidth)?l:null;if(!a)return null;const c=a(i);if(null==c)return null;const u=a.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",d=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:a===r)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:F,yAccessor:H,width:s,height:l,data:I,frameType:"xy",pointNodes:N,curve:z,stickyPositionCache:V.current};return T.map((e,o)=>{if(R){const i=R(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[T,R,s,l,F,H,I,d,N,z]),Z=function(e){var n;const o=t.useSyncExternalStore(e?Ct:Pt,e?St:Lt,e?St:Lt);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(E);return t.useEffect(()=>{if(!(null==Z?void 0:Z.locked)||!E)return;const e=e=>{"Escape"===e.key&&Mt(E)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,E]),g||w||j||_||P||Q&&Q.length>0||k||Y||Z?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[k&&d&&(!W||D)&&(()=>{var t,n;const o=Bt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Bt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),X.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:s,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&d&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,r=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=s/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!W||D)&&i&&!a&&e.jsx("line",{x1:0,y1:l,x2:s,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&a&&e.jsx("path",{d:Tt("bottom",s,l),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Me(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:g,style:{userSelect:"none"},children:y}),(!W||D)&&o&&!r&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&r&&e.jsx("path",{d:Tt("left",s,l),fill:"none",stroke:d,strokeWidth:1}),X.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Me(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-h.left,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(-90, ${15-h.left}, ${l/2})`,style:{userSelect:"none"},children:n}):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.jsxs(e.Fragment,{children:[!1!==t.baseline&&e.jsx("line",{x1:s,y1:0,x2:s,y2:l,stroke:d,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Me(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${s},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-r-"+o)}),o&&e.jsx("text",{x:s+h.right-15,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(90, ${s+h.right-15}, ${l/2})`,style:{userSelect:"none"},children:o})]})})()]})})(),Q,P&&d&&L&&B&&e.jsxs(e.Fragment,{children:[P.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"top",config:at(P.top),values:L,scale:d.x,size:h.top,length:s})}),P.bottom&&e.jsx("g",{transform:`translate(0, ${l})`,children:e.jsx(ct,{orient:"bottom",config:at(P.bottom),values:L,scale:d.x,size:h.bottom,length:s})}),P.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"left",config:at(P.left),values:B,scale:d.y,size:h.left,length:l})}),P.right&&e.jsx("g",{transform:`translate(${s}, 0)`,children:e.jsx(ct,{orient:"right",config:at(P.right),values:B,scale:d.y,size:h.right,length:l})})]}),_,Z&&Z.sourceId!==$&&(null==d?void 0:d.x)&&(()=>{const t=d.x(Z.xValue);if(null==t||0>t||t>s)return null;const n=Z.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:l,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"})})(),Y]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),lt({legend:j,totalWidth:c,totalHeight:u,margin:h,legendPosition:C,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S})]}):null}function Nt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const zt="undefined"==typeof window||"undefined"==typeof document,Wt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Dt=()=>()=>{},Et=()=>!1,$t=()=>!0;function Yt(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 Gt(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 Xt(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 qt=d.createContext(null),Vt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ut(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},s=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],r=Object.keys(n).sort((e,t)=>{const n=s.indexOf(e),o=s.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of r)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Kt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Qt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Zt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Jt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},en={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},tn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},nn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},on={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function sn({scene:t,chartType:n,tableId:o,chartTitle:i}){var s;const[r,l]=d.useState(!1),a=d.useContext(qt),c=null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s,u=r||c,h=d.useRef(null),f=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=d.useCallback(()=>{r||c||l(!0)},[r,c]),p=d.useCallback(e=>{var t;c||(null===(t=h.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Vt}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:g,style:Vt,role:"region","aria-label":f,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,i,s,r,l,a,c,u,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O;const M=[];if(!Array.isArray(e))return M;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":M.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},s=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",r=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;M.push({label:"Bar",values:{category:s,value:null!=r?r:""}});break}case"heatcell":M.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(r=null===(s=S.datum)||void 0===s?void 0:s.category)&&void 0!==r?r:null===(l=S.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(d=null===(h=S.datum)||void 0===h?void 0:h.id)&&void 0!==d?d:"",x:null!==(f=S.cx)&&void 0!==f?f:S.x,y:null!==(g=S.cy)&&void 0!==g?g:S.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(y=null===(p=S.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(v=S.cy)&&void 0!==v?v:S.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=S.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(O=null===(A=S.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return M}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const 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],s=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),s+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:s/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}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Kt(e.min)} to ${Kt(e.max)}, mean ${Kt(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(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:h,id:o,tabIndex:-1,onBlur:p,style:Qt,role:"region","aria-label":f,children:[e.jsx("button",{type:"button",onClick:()=>{c&&a&&a.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:Jt,children:"×"}),e.jsx("div",{role:"note",style:Zt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:en,children:[e.jsxs("caption",{style:on,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:tn,children:"type"}),k.map(t=>e.jsx("th",{style:tn,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:nn,children:t.label}),k.map(n=>{return e.jsx("td",{style:nn,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Kt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function rn({summary:t}){return t?e.jsx("div",{role:"note",style:Vt,children:t}):null}function ln({tableId:t}){return e.jsx("a",{href:"#"+t,style:Vt,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,Vt)},children:"Skip to data table"})}function an({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Vt,children:n})}const cn="var(--semiotic-focus, #005fcc)";function un({active:t,hoverPoint:n,margin:o,size:i,shape:s="circle",width:r,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===s&&null!=r&&null!=l){const t=Math.max(r,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===s?{cx:a,cy:c,r:12,fill:"none",stroke:cn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function hn({x:t,y:n,containerWidth:o,containerHeight:i,margin:s,children:r,className:l="stream-frame-tooltip",zIndex:a=1}){const c=d.useRef(null),[u,h]=d.useState(null);d.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[r,l,o,i]);let f;return f=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:l,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:f,pointerEvents:"none",zIndex:a,width:"max-content"},children:r})}function dn(e,n,o){const i=t.useRef(null),[s,r]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;r(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&s?s.w:e[0],o&&s?s.h:e[1]]]}const fn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function gn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pn(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,s]=dn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),r=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=s[0]-r.left-r.right,a=s[1]-r.top-r.bottom,c=gn(e.foregroundGraphics,s,r),u=gn(e.backgroundGraphics,s,r),h=P(e=>e.theme),{transition:f,introEnabled:g}=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),p="semiotic-table-"+d.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const M=e.themeDirtyRef;return fn(()=>{M&&(_e++,M.current=!0,v())},[h,v,M]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:s,margin:r,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:h,transition:f,introEnabled:g,tableId:p,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function yn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const s=t[0]*o,r=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===s&&e.height===r||(e.width=s,e.height=r),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function mn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function vn(e,t,n,o,i,s){if(2>t.length)return;const r=[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];r.push(r[e-1]+Math.sqrt(n*n+o*o))}const l=r[r.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=s;for(let n=0;t.length-1>n;n++){const o=(r[n]+r[n+1])/2;let s=i;a>o&&(s*=o/a),a>l-o&&(s*=(l-o)/a),e.globalAlpha=Math.max(0,s),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const bn=(e,t,n,o)=>{var i,s;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",h=Re(e,u)||u,d=a.style.strokeWidth||2,f=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;vn(e,a.path,h,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Fe(a.curve),y=f&&f.length>0&&g&&g.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=h;const b=null!==(s=a.style.opacity)&&void 0!==s?s:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,O=!1;function M(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function S(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[_,P]=a.path[C],L=g[C],B=mn(L,f,h);if(null!==k&&null!==A&&null!==j){if(B===A)e.lineTo(_,P);else{const T=[];for(const R of f){const F=R.value;(j>F||F>L)&&(F>j||L>F)||j===F||L===F||T.push({t:(F-j)/(L-j)})}T.sort((e,t)=>e.t-t.t);for(const H of T){const I=k+(_-k)*H.t,N=w+(P-w)*H.t,z=mn(j+(L-j)*Math.min(H.t+1e-4,1),f,h);e.lineTo(I,N),S(),M(z,I,N)}e.lineTo(_,P)}k=_,w=P,j=L,A=B}else M(B,_,P),k=_,w=P,j=L,A=B}S()}else{e.beginPath();const W=a.strokeGradient&&a.path.length>=2?Ne(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=W||h,p)r.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[D,E]=a.path[0];e.moveTo(D,E);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=He(e,a.style.fill,a.style.fill),p&&!y)r.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,X]=a.path[0];e.moveTo(G,X);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function xn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function kn(e,t,n=.3){xn(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 wn(e,t,n=.6){var o,i,s,r,l;if(!xn(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(s=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==s?s:0,h=null!==(l=null!==(r=t.cy)&&void 0!==r?r:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,h,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 jn(e,t,n,o=.35){xn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function An(e,t){const n=Fe(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=r.area().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 On=(e,t,n,o)=>{var i,s,l;const a=t.filter(e=>"area"===e.type);for(const t of a){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 a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=t.style.fill||"#4e79a7",u=t._decayOpacities;if(u&&u.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[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=Re(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*(u[n]+u[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 h=null!==(s=t.style.opacity)&&void 0!==s?s:1;if(An(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=Ie(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,n,0,o);e.fillStyle=i||c,e.globalAlpha=h}else{const n=null!==(l=t.style.fillOpacity)&&void 0!==l?l:.7;e.globalAlpha=n*h,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(An(e,t),jn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=h;const n=t.strokeGradient&&t.topPath.length>=2?Ne(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Fe(t.curve);if(e.beginPath(),o)r.line().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!==a&&1>a&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Mn=(e,t,n,o)=>{var i;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{for(const t of s){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=He(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=He(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),wn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Sn(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 Cn=(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)_n(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const s=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(r,l),e.lineTo(r+a-s,l),e.arcTo(r+a,l,r+a,l+s,s),e.lineTo(r+a,l+c-s),e.arcTo(r+a,l+c,r+a-s,l+c,s),e.lineTo(r,l+c);break;case"left":e.moveTo(r+a,l),e.lineTo(r+s,l),e.arcTo(r,l,r,l+s,s),e.lineTo(r,l+c-s),e.arcTo(r,l+c,r+s,l+c,s),e.lineTo(r+a,l+c);break;case"bottom":e.moveTo(r,l),e.lineTo(r+a,l),e.lineTo(r+a,l+c-s),e.arcTo(r+a,l+c,r+a-s,l+c,s),e.lineTo(r+s,l+c),e.arcTo(r,l+c,r,l+c-s,s);break;default:e.moveTo(r,l+c),e.lineTo(r,l+s),e.arcTo(r,l,r+s,l,s),e.lineTo(r+a-s,l),e.arcTo(r+a,l,r+a,l+s,s),e.lineTo(r+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(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=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}kn(e,t),e.globalAlpha=1}};function _n(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 s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=i+o,r=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=s)e.drawImage(n,r,o,i,i)}else{const s=i+o,r=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,r,i,i)}e.restore()}function Pn(e,t,n,o){return Object.assign({data:e,x:t,y:n,__semioticHoverData:!0},o)}function Ln(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 Bn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Tn=(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=Re(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),kn(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):Bn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,s=t.y+t.h/2;e.fillStyle=Ln(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,s)}}}finally{e.restore()}},Rn=(e,t,n,o)=>{var i,s,r;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!==(r=null===(s=t.style)||void 0===s?void 0:s.opacity)&&void 0!==r?r:1);1!==l&&(e.globalAlpha=l);const a=Re(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,h=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||h(),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,s=Re(e,i)||i;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&h(),e.restore()}},Fn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hn(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`${Fn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const In={line:[On,bn,Mn],area:[On,Mn],stackedarea:[On,Mn],scatter:[Mn],bubble:[Mn],heatmap:[Tn],bar:[Cn],swarm:[Mn],waterfall:[(e,t,n,o)=>{var i,s,r;Cn(e,t);const l=t.filter(e=>"rect"===e.type);if(2>l.length)return;const a=l[0].datum,c=null==a?void 0:a._connectorStroke;if(c){e.save(),e.strokeStyle=Re(e,c)||c,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;l.length-1>t;t++){const o=l[t],i=l[t+1];if(!(null===(s=o.datum)||void 0===s?void 0:s.cumEnd)||!(null===(r=i.datum)||void 0===r?void 0:r.baseline))continue;const a=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Rn],mixed:[On,bn,Mn],custom:[On,Cn,Tn,bn,Mn,Rn]},Nn={top:20,right:20,bottom:30,left:40},zn={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 Wn(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 Dn={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 En({hover:t}){var n,o,i;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",r=null!==(n=t.data)&&void 0!==n?n:{},l=null!==(o=r.y)&&void 0!==o?o:r.value,a=null!==(i=r.x)&&void 0!==i?i:r.time;return e.jsxs("div",{className:"semiotic-tooltip",style:Dn,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:s(a)})]})}const $n=t.forwardRef(function(n,o){var i,s,r,l,a,c,u,h,f,g,p,m,x;const{chartType:k,runtimeMode:j,data:A,chunkThreshold:O,chunkSize:M,xAccessor:S,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:B,curve:T,normalize:R,baseline:F,stackOrder:H,binSize:I,valueAccessor:N,arrowOfTime:z="right",windowMode:W="sliding",windowSize:D=200,timeAccessor:E,xExtent:$,yExtent:Y,extentPadding:G=.1,scalePadding:X,sizeRange:q,size:V=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:ne,barStyle:oe,waterfallStyle:ie,swarmStyle:se,barColors:re,colorScheme:le,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:he,lineGradient:de,areaGroups:fe,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,showAxes:be=!0,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:Me,yFormat:Se,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Be,customClickBehavior:Te,enableHover:Fe,hoverRadius:He=30,tooltipMode:Ie,annotations:Ne,svgAnnotationRules:ze,showGrid:$e,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,legendCategoryAccessor:Je,onCategoriesChange:et,backgroundGraphics:tt,foregroundGraphics:nt,canvasPreRenderers:ot,svgPreRenderers:it,title:st,categoryAccessor:rt,brush:lt,onBrush:at,decay:ct,pulse:ut,transition:ht,animate:dt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,marginalGraphics:bt,pointIdAccessor:xt,xScaleType:kt,yScaleType:wt,accessibleTable:jt=!0,description:At,summary:Ot,linkedCrosshairName:Mt,linkedCrosshairSourceId:St,customLayout:Ct,layoutConfig:_t}=n,Pt=t.useId().replace(/:/g,""),Lt=t.useRef(!1),Bt=pn({sizeProp:V,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:Nn,animate:dt,transitionProp:ht,themeDirtyRef:Lt}),Tt=function(){const[e,n]=t.useState(!1);return Wt(()=>{n(!0)},[]),e}(),Ft=function(){const e=t.useSyncExternalStore(Dt,Et,$t);return t.useRef(e).current}(),{reducedMotionRef:Ht,responsiveRef:qt,size:Vt,currentTheme:Kt,transition:Qt,introEnabled:Zt,tableId:Jt,rafRef:en,renderFnRef:tn,scheduleRender:nn}=Bt;let on=Bt.margin;if(bt){const e=60,t=Object.assign({},Bt.margin);bt.top&&e>t.top&&(t.top=e),bt.bottom&&e>t.bottom&&(t.bottom=e),bt.left&&e>t.left&&(t.left=e),bt.right&&e>t.right&&(t.right=e),on=t}const cn="function"==typeof nt?nt({size:Vt,margin:on}):nt,dn="function"==typeof tt?tt({size:Vt,margin:on}):tt,fn=Vt[0]-on.left-on.right,gn=Vt[1]-on.top-on.bottom,mn=t.useMemo(()=>v(A),[A]),vn=null!=Pe?Pe:Fe,bn=t.useRef(null),xn=t.useRef(null),[kn,wn]=t.useState(0),[jn,An]=t.useState(null),On=t.useRef(null),Mn=t.useRef(null),[Sn,Cn]=t.useState(null),_n=t.useRef(zn.primary),Ln=t.useRef([]),Bn=t.useRef(Je),Tn=t.useRef(et);Bn.current=Je,Tn.current=et;const[Rn,Fn]=t.useState(!1),[Dn,$n]=t.useState([]),[Yn,Gn]=t.useState([]),Xn="streaming"===j||["bar","swarm","waterfall"].includes(k),qn=t.useMemo(()=>{var e,t,n;return{chartType:k,runtimeMode:Xn?"streaming":"bounded",windowSize:D,windowMode:W,arrowOfTime:Xn?z:"right",extentPadding:G,scalePadding:X,xAccessor:S,yAccessor:C,timeAccessor:Xn?E:void 0,valueAccessor:N,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(B?"_lineGroup":void 0),categoryAccessor:rt,lineDataAccessor:B,xScaleType:kt,yScaleType:wt,xExtent:$,yExtent:Y,sizeRange:q,binSize:I,normalize:R,baseline:F,stackOrder:H,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:de,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,lineStyle:ee,pointStyle:te,areaStyle:ne,swarmStyle:se,waterfallStyle:ie,colorScheme:le,barColors:re,barStyle:oe,annotations:Ne,decay:ct,pulse:ut,transition:Qt,introAnimation:Zt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,pointIdAccessor:xt,curve:T,themeCategorical:null===(e=null==Kt?void 0:Kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:w(Kt),themeSequential:null===(t=null==Kt?void 0:Kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Kt?void 0:Kt.colors)||void 0===n?void 0:n.diverging,customLayout:Ct,layoutConfig:_t,layoutMargin:on}},[k,D,W,z,G,X,S,C,E,N,kt,wt,_,P,L,rt,B,$,Y,q,I,R,F,H,ae,ce,ue,he,de,fe,ge,pe,ye,me,ve,ee,te,ne,se,ie,oe,le,re,Ne,ct,ut,null==Qt?void 0:Qt.duration,null==Qt?void 0:Qt.easing,Zt,ft,gt,pt,yt,mt,vt,Xn,xt,T,Kt,Ct,_t,on]),Vn=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Gt(e,t);if(!Xt(e)||!Xt(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(!Gt(n,i))return!1}else{if(!Xt(n)||!Xt(i))return!1;if(!Yt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(qn),Un=t.useRef(null);Un.current||(Un.current=new ke(Vn));const Kn=t.useCallback(()=>{var e,t;const n=Bn.current,o=Tn.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 s=e+"";n.has(s)||(n.add(s),o.push(s))}return o}(null!==(t=null===(e=Un.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,Ln.current)||(Ln.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Un.current)||void 0===e||e.updateConfig(Vn),Lt.current=!0,nn()},[Vn,nn]);const Qn=t.useRef(null);Qn.current||(Qn.current=new b(e=>{const t=Un.current;t&&t.ingest(e)&&(Lt.current=!0,nn())},{chunkThreshold:O,chunkSize:M})),t.useEffect(()=>{var e;null===(e=Qn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:O,chunkSize:M})},[O,M]);const Zn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.push(e)},[]),Jn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.pushMany(e)},[]),eo=t.useCallback(()=>{var e,t;null===(e=Qn.current)||void 0===e||e.clear(),null===(t=Un.current)||void 0===t||t.clear(),Lt.current=!0,nn()},[nn]);t.useImperativeHandle(o,()=>({push:Zn,pushMany:Jn,remove:e=>{var t,n,o;null===(t=Qn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Un.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(On.current&&i.some(e=>{var t;return e===(null===(t=On.current)||void 0===t?void 0:t.data)})&&(On.current=null,Cn(null)),Lt.current=!0,nn()),i},update:(e,t)=>{var n,o,i;null===(n=Qn.current)||void 0===n||n.flush();const s=null!==(i=null===(o=Un.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return s.length>0&&(Lt.current=!0,nn()),s},clear:eo,getData:()=>{var e,t,n;return null===(e=Qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Un.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Zn,Jn,eo,nn]),t.useEffect(()=>{var e,t;if(A){if(B&&mn.length>0&&"object"==typeof mn[0]&&null!==mn[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(mn[0][t])){const n=[];for(const e of mn){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=Qn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Qn.current)||void 0===t||t.setBoundedData(mn)}},[A,mn,B]);const{hoverHandlerRef:to,hoverLeaveRef:no,onPointerMove:oo,onPointerLeave:io}=Bt;to.current=e=>{var t,n,o;if(!vn)return;const i=bn.current;if(!i)return;const s=i.getBoundingClientRect(),r=e.clientX-s.left-on.left,l=e.clientY-s.top-on.top;if(0>r||r>fn||0>l||l>gn)return void(On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn()));const a=Un.current;if(!a||0===a.scene.length)return;const c=De(a.scene,r,l,He,a.quadtree,a.maxPointRadius),u="multi"===Ie,h=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&Be(null),nn())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?l:c.y;let g=Pn(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},d,f);if(u&&a.scene.length>0&&a.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 s=Ee(We(e.path,e.curve),t,n);if(null===s)continue;const r=Ke(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:e.path[r][0],y:s,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 s=We(e.topPath,e.curve),r=We(e.bottomPath,e.curve),l=Ee(s,t,n);if(null===l)continue;const a=Ee(r,t,n),c=Ke(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}(a.scene,d,Math.max(He,fn));if(e.length>0){const t=a.scales.y.invert,n=a.scales.x.invert,o=_n.current,i=n?n(d):d;if(c)g.xValue=i,g.xPx=d;else{const e={xValue:i};"string"==typeof S&&(e[S]=i),g=Pn(e,d,f,{xValue:i,xPx:d})}g.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===k&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:e.datum}})}}c||(null===(n=g.allSeries)||void 0===n?void 0:n.length)?(On.current=g,Mn.current=null!==(o=null==c?void 0:c.node)&&void 0!==o?o:null,Cn(g),Be&&(Be(g),Lt.current=!0),nn()):h()},no.current=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn())};const so=t.useRef(()=>{});so.current=e=>{if(!Te)return;const t=bn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-on.left,i=e.clientY-n.top-on.top;if(0>o||o>fn||0>i||i>gn)return void Te(null);const s=Un.current;if(!s||0===s.scene.length)return void Te(null);const r=De(s.scene,o,i,He,s.quadtree,s.maxPointRadius);Te(r?Pn(r.datum||{},r.x,r.y):null)};const ro=t.useCallback(e=>so.current(e),[]),lo=t.useRef(-1),ao=t.useRef(null),co=t.useRef(null),uo=t.useCallback(e=>{const t=Un.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(co.current&&co.current.version===n)o=co.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const s of e)switch(s.type){case"point":i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:"_default"});break;case"line":{const e=s,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=s,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:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.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)}),s=Array.from(o.values()).flat();s.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;s.length>e;e++){s[e]._flatIndex=e;const t=null===(n=s[e].datum)||void 0===n?void 0:n.id;null!=t&&r.set(t+"",e)}return{flat:s,groups:i,byGroup:o,idToIdx:r}}(e),co.current={version:n,graph:o}}const i=lo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),lo.current=0;const t=o.flat[0];ao.current={shape:t.shape,w:t.w,h:t.h};const n=Ze(t);return On.current=n,Cn(n),Be&&Be(n),void nn()}const s=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)),s=e.flat[i];return{flatIndex:i,group:null!==(n=s.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=s._groupIndex)&&void 0!==o?o:0}}(o,i),r=function(e,t,n){const{group:o,indexInGroup:i}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>i?s[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?s[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Qe(n,n.groups[e+1],s[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Qe(n,n.groups[e-1],s[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,s,o);if(null===r)return;if(e.preventDefault(),0>r)return lo.current=-1,ao.current=null,On.current=null,Mn.current=null,Cn(null),Be&&Be(null),void nn();lo.current=r;const l=o.flat[r];ao.current={shape:l.shape,w:l.w,h:l.h};const a=Ze(l);On.current=a,Cn(a),Be&&Be(a),nn()},[Be,nn]),ho=t.useCallback(e=>{lo.current=-1,ao.current=null,oo(e)},[oo]);tn.current=()=>{var e,t;en.current=0;const n=bn.current,o=xn.current;if(!n||!o)return;const i=Un.current;if(!i)return;const s="undefined"!=typeof performance?performance.now():Date.now(),r=i.advanceTransition(Ht.current?s+1e6:s),l=!Ht.current&&r,a=Lt.current||r;a&&!l&&(i.computeScene({width:fn,height:gn}),Kn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return zn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),s=t.getPropertyValue("--semiotic-primary").trim(),r=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 r||l||n||s?{axisStroke:a||zn.axisStroke,tickText:r||zn.tickText,crosshair:r?Wn(r,"66"):zn.crosshair,hoverFill:c?Wn(c,"4D"):zn.hoverFill,hoverStroke:r?Wn(r,"99"):zn.hoverStroke,pointRing:c||zn.pointRing,primary:s||zn.primary}:zn}(n);_n.current=u.primary;const h=null!==(e=null==ft?void 0:ft.threshold)&&void 0!==e?e:5e3,d=ft&&i.lastIngestTime>0&&s-i.lastIngestTime>h;if(a){const e=yn(n,Vt,on,c);if(e){if(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),d&&(e.globalAlpha=null!==(t=null==ft?void 0:ft.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!tt){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=J||(t&&"transparent"!==t?t:null),i=o?Re(e,o):null;i&&(e.fillStyle=i,e.fillRect(-on.left,-on.top,Vt[0],Vt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,fn,gn),e.clip()),ot&&i.scales)for(const t of ot)e.save(),t(e,i.scene,i.scales,{width:fn,height:gn}),e.restore();const o=Ct?In.custom:In[k];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:fn,height:gn});e.restore(),d&&(e.globalAlpha=1)}}{const e=yn(o,Vt,on,c);if(e&&(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),vn&&On.current&&i.scales&&function(e,t,n,o,i,s,r){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 h="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=h.stroke||r.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.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=r.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||r.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}(s)||r.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=r.pointRing,e.lineWidth=2,e.stroke()}}(e,On.current,fn,gn,"object"==typeof vn?vn:{},Mn.current,u),Mn.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var s;if(!n)return;const r=n.group;if(void 0!==r)for(const n of t){if("line"!==n.type)continue;if(n.group!==r)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!==(s=t.opacity)&&void 0!==s?s:1,e.stroke(),e.restore()}}(e,i.scene,Mn.current,t,u)}}a&&n&&n.setAttribute("aria-label",Ut(i.scene,k+" chart"));const f=Lt.current;if(Lt.current=!1,f&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!jn||e(jn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(jn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(jn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(jn.y.domain()[1])!==e(i.scales.y.domain()[1])||jn.x.range()[0]!==i.scales.x.range()[0]||jn.x.range()[1]!==i.scales.x.range()[1]||jn.y.range()[0]!==i.scales.y.range()[0]||jn.y.range()[1]!==i.scales.y.range()[1])&&An(i.scales),bt){const e=i.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof C?C:e=>e[C||"y"];$n(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Gn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}f&&Ne&&Ne.length>0&&wn(e=>e+1),(null==ft?void 0:ft.showBadge)&&Fn(!!d),(l||null!=i.activeTransition||i.hasActivePulses)&&(en.current=requestAnimationFrame(()=>tn.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:s,renderFnRef:r,cleanup:l}=e;Wt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),s.current=!0,r.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Tt,wasHydratingFromSSR:Ft,storeRef:Un,dirtyRef:Lt,renderFnRef:tn,cleanup:()=>{var e;return null===(e=Qn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Lt.current=!0,nn()},[k,fn,gn,be,J,ee,ot,nn]),function(e,n,o,i,s,r){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==s&&(r(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,s,i])}(ft,Un,Lt,nn,Rn,Fn);const fo=t.useMemo(()=>{if(Me||Ce)return;const e=Un.current;return(null==e?void 0:e.xIsDate)&&jn?Hn(jn.x.domain()):void 0},[Me,Ce,jn]),go=Me||Ce||fo,po=vn&&Sn?Le?Le(Sn):e.jsx(En,{hover:Sn}):null,yo=po?e.jsx(hn,{x:Sn.x,y:Sn.y,containerWidth:fn,containerHeight:gn,margin:on,className:"stream-frame-tooltip",children:po}):null,mo=ao.current,vo=e.jsx(un,{active:lo.current>=0,hoverPoint:Sn,margin:on,size:Vt,shape:null==mo?void 0:mo.shape,width:null==mo?void 0:mo.w,height:null==mo?void 0:mo.h}),bo=(e,t,n,o)=>"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},xo=bo(S,E,"__semiotic_resolvedX","__semiotic_resolvedTime"),ko=bo(C,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),wo=xo.key,jo=ko.key,Ao=Ne&&Ne.length>0,Oo=e=>{if(!e||!Ao||!xo.fn&&!ko.fn)return e;let t=!1;const n=e.map(e=>{const n=xo.fn&&xo.key&&!(xo.key in e),o=ko.fn&&ko.key&&!(ko.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[xo.key]=xo.fn(e)),o&&(i[ko.key]=ko.fn(e)),i});return t?n:e};if(zt||!Tt&&Ft){const t=Un.current;t&&A&&(t.ingest({inserts:mn,bounded:!0}),t.computeScene({width:fn,height:gn}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,l=go||(()=>{if((null==t?void 0:t.xIsDate)&&o)return Hn(o.x.domain())})();return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":At||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1]},children:[e.jsx(rn,{summary:Ot}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn}),e.jsxs("g",{transform:`translate(${on.left},${on.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:fn,height:gn,fill:J}),it&&o&&it.map((t,i)=>e.jsx(d.Fragment,{children:t(n,o,{width:fn,height:gn})},"svgpre-"+i)),n.map((t,n)=>function(t,n,o){var i,s,r,l,a;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const a=t;if(0===a.topPath.length)return null;const c=`M${a.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...a.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(a.clipRect){const t=`${o?o+"-":""}area-clip-${n}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:a.clipRect.x,y:a.clipRect.y,width:a.clipRect.width,height:a.clipRect.height})})}),e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(s=null!==(i=a.style.fillOpacity)&&void 0!==i?i:a.style.opacity)&&void 0!==s?s:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+n)}return e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(l=null!==(r=a.style.fillOpacity)&&void 0!==r?r:a.style.opacity)&&void 0!==l?l:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Nt(o.style.fill),opacity:null!==(a=o.style.opacity)&&void 0!==a?a:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Nt(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[i,s,r]=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]}(o.fill),l=.299*i+.587*s+.114*r>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:a+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),s=Math.max(Math.abs(o.openY-o.closeY),1),r=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:s,fill:r,stroke:r,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n,Pt)).filter(Boolean)]})]}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:o,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:l,yFormat:Se||_e,showGrid:$e,title:st,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(r=Un.current)||void 0===r?void 0:r.customLayoutOverlays),marginalGraphics:bt,xValues:[],yValues:[],annotations:Ne,svgAnnotationRules:ze,annotationFrame:0,xAccessor:wo,yAccessor:jo,annotationData:Oo(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:St})]})}return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":At||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1],overflow:"visible"},onKeyDown:uo,children:[jt&&e.jsx(ln,{tableId:Jt}),jt&&e.jsx(sn,{scene:null!==(a=null===(l=Un.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:k+" chart",tableId:Jt,chartTitle:"string"==typeof st?st:void 0}),e.jsx(rn,{summary:Ot}),e.jsxs("div",{role:"img","aria-label":At||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:vn?ho:void 0,onMouseLeave:vn?io:void 0,onClick:Te?ro:void 0,children:[dn&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn})}),e.jsx(Rt,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,showGrid:$e,xFormat:go,yFormat:Se||_e}),e.jsx("canvas",{ref:bn,"aria-label":Ut(null!==(u=null===(c=Un.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],k+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:xn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(an,{hoverPoint:Sn}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:go,yFormat:Se||_e,showGrid:$e,title:st,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(h=Un.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:bt,xValues:Dn,yValues:Yn,annotations:Ne,svgAnnotationRules:ze,annotationFrame:kn,xAccessor:wo,yAccessor:jo,annotationData:Oo(null===(f=Un.current)||void 0===f?void 0:f.getData()),pointNodes:null===(g=Un.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!tt,linkedCrosshairName:Mt,linkedCrosshairSourceId:St}),(lt||at)&&e.jsx(y,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,dimension:null!==(p=null==lt?void 0:lt.dimension)&&void 0!==p?p:"xy",scales:jn,onBrush:null!=at?at:()=>{},binSize:I,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(m=null==lt?void 0:lt.binBoundaries)&&void 0!==m?m:"bar"===k?null===(x=Un.current)||void 0===x?void 0:x.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===j}),(null==ft?void 0:ft.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ft.badgePosition?{top:4,left:4}:"bottom-left"===ft.badgePosition?{bottom:4,left:4}:"bottom-right"===ft.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Rn?"#dc3545":"#28a745",color:"white"}),children:Rn?"STALE":"LIVE"}),vo,yo]})]})});$n.displayName="StreamXYFrame";const Yn=t.createContext(null);function Gn({colors:n,categories:o,colorScheme:i="category10",children:s}){const r=t.useMemo(()=>{if(n)return n;if(o){const e=Array.isArray(i)?i:re[i]||le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[n,o,i]);return e.jsx(Yn.Provider,{value:r,children:s})}function Xn(){return t.useContext(Yn)}function qn(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 Vn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Gn.displayName="CategoryColorProvider";const[Un,Kn]=x(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Vn(o,t),s=new Map(i.clauses);return s.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:s})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Vn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qn,Zn]=x(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 Jn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,s=Kn(e=>e.selections.get(i)),r=Kn(e=>e.setClause),l=Kn(e=>e.clearClause),a=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(qn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(s,o):()=>!0,[s,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};r(i,{clientId:o,type:"point",fields:t})},[o,i,r]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};r(i,{clientId:o,type:"interval",fields:t})},[o,i,r]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function eo(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:s,selectPoints:r,clear:l}=Jn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,l,n]),predicate:i,isActive:s}}function to(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function no(e){const{name:n,xField:o,yField:i}=e,{predicate:s,isActive:r,selectInterval:l,clear:a}=Jn({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void a();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&to(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&to(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[c,o,i,l,a]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:r,clear:a}}const oo=t.createContext(!1),io=t.createContext(null),so="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function ro(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function lo(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 ao({selections:e}){const n=Kn(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function co({categoryColors:n,interaction:o,selectionName:i,field:s}){const r=Object.entries(n),l=r.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],c=eo({name:i,fields:[s]}),u=Jn({name:i,clientId:"__linked-legend-isolate__"}),[h,d]=t.useState(new Set),[f,g]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(h.size>0?p.current({[s]:Array.from(h)}):y.current())},[o,h,s]);const m=t.useCallback(e=>{"highlight"===o&&(e?(g(e.label),c.onHover({[s]:e.label})):(g(null),c.onHover(null)))},[o,s,c]),v=t.useCallback(e=>{"isolate"===o&&d(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===l.length?new Set:n})},[o,l.length]),[b,[x]]=dn([0,0],!0,!1),k=t.useMemo(()=>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}(r.map(([e])=>e),x),[r,x]);return 0===r.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(st,{legendGroups:a,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:f,isolatedCategories:h})})})}function uo({children:n,selections:o,showLegend:i,legendPosition:s="top",legendInteraction:r="none",legendSelectionName:l="legend",legendField:a="category"}){const c=Xn(),[u,h]=t.useState({}),d=t.useRef({}),f=t.useMemo(()=>({registerCategories:(e,t)=>{const n=ro(t);h(t=>{var o;return lo(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{h(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),g=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const n of t)e.push(n);return ro(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},n=d.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of g)t[e]||n[e]||(n[e]=le[o%le.length],o++);const i=Object.assign({},t);for(const o of g)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[c,g]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(Un,{children:e.jsxs(Qn,{children:[o&&e.jsx(ao,{selections:o}),e.jsx(io.Provider,{value:f,children:e.jsx(Gn,{colors:p,children:e.jsxs(oo.Provider,{value:m,children:[y&&"top"===s&&e.jsx(co,{categoryColors:p,interaction:r,selectionName:l,field:a}),n,y&&"bottom"===s&&e.jsx(co,{categoryColors:p,interaction:r,selectionName:l,field:a})]})})})]})})}function ho(e){return e?"string"==typeof e?{name:e}:e:null}function fo(e,t,n){return t?o=>{var i;const s=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.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 go(){return P(e=>e.theme)}d.createContext(void 0);const po="#007bff";function yo(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 s=Number(i);return Number.isFinite(s)?s:null}function mo(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 vo(){var e;const t=go(),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 bo(e,n,o){const i=Xn(),s=vo();return t.useMemo(()=>{var t;if(!n)return;const r=null!==(t=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=he(t.map(e=>({_cat:e})),"_cat",r);return t=>i[t]||e(t)}return he(t.map(e=>({_cat:e})),"_cat",r)}if(i&&Object.keys(i).length>0){const t=he(e,n,r);return e=>i[e]||t(e)}return he(e,n,r)}if(i&&Object.keys(i).length>0){const e=he([{_:"a"}],"_",r);return t=>i[t]||e(t)}},[e,n,o,i,s])}function xo({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:s,chartType:r,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const h=t.useId(),d=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),f=Jn({name:(null==e?void 0:e.name)||"__unused__"}),g=eo({name:(null==d?void 0:d.name)||"hover",fields:(null==d?void 0:d.fields)||o||[]}),p=Zn(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==d?void 0:d.mode)&&d.xField){const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n})},At())}(d.name||"hover",n,h)}"x-position"!==(null==d?void 0:d.mode)&&g.onHover(t)}else"x-position"===(null==d?void 0:d.mode)&&Ot(d.name||"hover",h),"x-position"!==(null==d?void 0:d.mode)&&g.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(s||p){const n={timestamp:Date.now(),chartType:r||"unknown",chartId:l};if(e){const i=mo(e),r=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),p&&p(r)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});s&&s(e),p&&p(e)}}},[n,g,d,h,s,r,l,p,c,b]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==d?void 0:d.mode)&&d.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(wt.positions);return t.delete(e),wt={positions:t},At(),!1}wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},At()}(d.name||"hover",n,h)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||p){const t={timestamp:Date.now(),chartType:r||"unknown",chartId:l};if(e){const n=mo(e),r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),p&&p(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),p&&p(e)}}},[a,s,p,r,l,d,h]);return t.useEffect(()=>{if("x-position"!==(null==d?void 0:d.mode))return;const e=d.name||"hover";return()=>{Mt(e,h),Ot(e,h)}},[null==d?void 0:d.mode,null==d?void 0:d.name,h]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:h}}function ko(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 wo({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:s="right",userMargin:r,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(oo),u=null!==t.useContext(io),h=void 0!==i?i:!c&&!!n,d=!!n&&(h||u),f=t.useMemo(()=>{if(!d)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,d]);!function(e){const n=t.useContext(io),o=t.useId(),i=ro(e),s=t.useRef([]);lo(s.current,i)||(s.current=i);const r=s.current;so(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),so(()=>{n&&n.registerCategories(o,r)},[n,o,r])}(u&&n?f:[]);const g=t.useMemo(()=>{if(!h||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:s,categories:r}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==s&&(n.strokeWidth=s),n},type:"fill",items:(r&&r.length>0?r:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,s)=>{const r=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=r?o(r,t,n):n?n(i):ae[s%ae.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:ue,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[h,n,e,o,f]),p=t.useMemo(()=>{const e="number"==typeof r?{top:r,bottom:r,left:r,right:r}:null!=r?r:{},t=Object.assign(Object.assign({},l),e);return g&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[l,r,g,s]);return{legend:g,margin:p,legendPosition:s}}function jo(e,n,o){const[i,s]=t.useState(null),[r,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&s(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&r.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return r.has(o)}}:null},[e,n,i,r]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?r:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}const Ao={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 Oo(e,t,n){var o,i,s,r,l,a,c;const u=Ao[e||"primary"],h="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!==(s=t.showAxes)&&void 0!==s?s:u.showAxes,showGrid:null!==(r=t.showGrid)&&void 0!==r?r: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:h?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:h?void 0:t.xLabel,yLabel:h?void 0:t.yLabel,categoryLabel:h?void 0:t.categoryLabel,valueLabel:h?void 0:t.valueLabel,marginDefaults:Mo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:h}}function Mo(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 So(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)}const Co={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 _o(e,t){return"function"==typeof t?t(e):e[t]}function Po(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 Lo(t={}){const{fields:n,title:o,format:i,style:s={},className:r=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=_o(t,o);l=Po(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,s;"string"==typeof e?(n=e,o=e,s=i):(n=e.label,o=e.accessor||e.key||"",s=e.format||i);const r=_o(t,o);a.push({label:n,value:Po(r,s)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Po(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Po(t[e[0]],i))}}const c=Object.assign(Object.assign({},Co),s);return e.jsxs("div",{className:("semiotic-tooltip "+r).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Bo(){return t=>{var n,o,i,s,r,l,a;const c=t.allSeries;if(!c||0===c.length){const s=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:Co,children:e.jsx("div",{children:Po(s)})})}const u=null!==(l=null!==(s=t.xValue)&&void 0!==s?s:null===(r=t.data)||void 0===r?void 0:r.time)&&void 0!==l?l:null===(a=t.data)||void 0===a?void 0:a.x;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Po(u)}),c.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Po(t.value)})]},n))]})}}function To(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!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,s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:Co,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lo(t):Lo())}}function Ro(e){return"string"==typeof e?e:"value"}function Fo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ho(e,t){if(!t)return Fo(e);try{const n=t(e);return null==n?Fo(e):n}catch(t){return Fo(e)}}function Io(e,t){return"function"==typeof t?t(e):e[t]}function No(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const s=n?Ho(Io(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=s&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:s}),o.map((t,n)=>{const o=Ho(Io(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function zo({componentName:t,message:n,diagnosticHint:o,width:i,height:s}){return e.jsx("div",{role:"alert",style:{width:i,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:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class Wo extends d.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.jsx(zo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Do;const Eo="undefined"!=typeof process&&"production"!==(null===(Do=process.env)||void 0===Do?void 0:Do.NODE_ENV);function $o({componentName:t,width:n,height:o,children:i}){return e.jsx(Wo,{fallback:i=>e.jsx(zo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Yo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Go={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xo(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Yo),{width:n,height:o}),children:i||"No data available"}):null}function qo(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*i))),r=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(s+r)-r))/2);return e.jsx("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:i},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Go),{position:"absolute",top:l+o*(s+r),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Vo(e,t,n,o){if(!Eo)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 s=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${s}`)}function Uo(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 s=1;n>=s;s++){let n=i[0];i[0]=s;for(let r=1;o>=r;r++){const o=i[r];i[r]=e[s-1]===t[r-1]?n:1+Math.min(n,i[r],i[r-1]),n=o}}return i[o]}function Ko(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=Uo(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 Qo({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)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(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,s]of Object.entries(n))if(s&&"string"==typeof s&&!(s in o)){const n=Ko(s,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${s}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Zo(e){const n=P(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Jo(e){const{data:n,rawData:o,colorBy:i,colorScheme:s,legendInteraction:r,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:d,chartType:f,chartId:g,showLegend:p,userMargin:y,marginDefaults:m,onClick:b,hoverHighlight:x,loading:k,emptyContent:w,width:j,height:A}=e,O=void 0===o,M=t.useMemo(()=>v(n),[n]),[S,C]=t.useState([]),_=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:R,crosshairSourceId:F}=xo({selection:a,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:d,chartType:f,chartId:g,onClick:b,hoverHighlight:x,colorByField:P}),H=ko(c,F),I=bo(M,i,s),N=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[M,i]),z=t.useMemo(()=>O&&S.length>0?S:N,[O,S,N]),W=jo(r,i,z),D=t.useMemo(()=>B||(W.legendSelectionHook?W.legendSelectionHook:L),[B,W.legendSelectionHook,L]),E=Zo(a),$=vo(),Y=Xn(),G=t.useMemo(()=>{if(I)return I;if(!i||0===z.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:$&&$.length>0?$:ae,t="__streamCat",n=he(z.map(e=>({[t]:e})),t,e);return e=>(null==Y?void 0:Y[e])||n(e)||"#999"},[I,i,z,s,$,Y]),{legend:X,margin:q,legendPosition:V}=wo({data:M,colorBy:i,colorScale:G,showLegend:p,legendPosition:l,userMargin:y,defaults:m,categories:z}),U=t.useMemo(()=>{const e={};return X&&(e.legend=X,e.legendPosition=V),r&&"none"!==r&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=_),e},[X,V,r,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,O,i,_]),K=Array.isArray(o)?v(o):o,Q=qo(k,j,A),Z=Q?null:Xo(K,j,A,w);return{data:M,colorScale:I,allCategories:z,legendState:W,effectiveSelectionHook:D,activeSelectionHook:L,customHoverBehavior:T,customClickBehavior:R,legend:X,margin:q,legendPosition:V,earlyReturn:Q||Z||null,legendBehaviorProps:U,crosshairProps:H,resolvedSelection:E}}function ei(e,n){const{variant:o,frameRef:i,overrides:s,deps:r}=n;t.useImperativeHandle(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,s,r;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!==(s=n.data)&&void 0!==s?s:{}),{id:t})),null===(r=e.current)||void 0===r||r.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:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,s;const r=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removePoint(e))&&void 0!==i?i:[];for(const e of r)null===(s=n.current)||void 0===s||s.push(t(e));return r},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.getData())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),s)},null!=r?r:[])}function ti(e,t,n,o){return new(n||(n=Promise))(function(i,s){function r(e){try{a(o.next(e))}catch(e){s(e)}}function l(e){try{a(o.throw(e))}catch(e){s(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(r,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const ni="__forecastSegment";let oi=null;function ii(){return ti(this,void 0,void 0,function*(){return oi||(oi=yield Promise.resolve().then(function(){return Ni})),oi})}const si=t.forwardRef(function(n,o){var i,s;const r=t.useRef(null);ei(o,{variant:"xy",frameRef:r});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",lineBy:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:b,curve:x="linear",showPoints:k=!1,pointRadius:w=3,fillArea:j=!1,areaOpacity:A=.3,lineWidth:O=2,lineGradient:M,tooltip:S,pointIdAccessor:C,annotations:_,directLabel:P,gapStrategy:L="break",anomaly:B,forecast:T,xExtent:R,yExtent:F,frameProps:H={},selection:I,linkedHover:N,onObservation:z,onClick:W,hoverHighlight:D,hoverRadius:E,chartId:$,loading:Y,emptyContent:G,legendInteraction:X,legendPosition:q,xScaleType:V,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=n,{width:ee,height:te,enableHover:ne,showGrid:oe,showLegend:ie,title:se,description:re,summary:le,accessibleTable:ae,xLabel:ce,yLabel:he}=l,de=t.useMemo(()=>v(a),[a]);Vo("LineChart",de,"xAccessor",f),Vo("LineChart",de,"yAccessor",g);const fe="string"==typeof f?f:"__semiotic_resolvedX",ge="string"==typeof g?g:"__semiotic_resolvedY",[pe,ye]=t.useState(null),[me,ve]=t.useState([]),be=t.useMemo(()=>{if(!T&&!B)return de;const e="function"==typeof f,t="function"==typeof g;return e||t?de.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=f(n)),t&&(o.__semiotic_resolvedY=g(n)),o}):de},[de,T,B,f,g]),xe=t.useRef(T),ke=t.useRef(B);t.useEffect(()=>{if(!T&&!B)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=T,ke.current=B));let e=!1;const t=T!==xe.current||B!==ke.current;if(xe.current=T,ke.current=B,t&&(ye(null),ve([])),T){const t=p&&"string"==typeof p&&"object"==typeof T?Object.assign(Object.assign({},T),{_groupBy:p}):T;(function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildForecast(...e)})})(be,fe,ge,t,B).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else B&&function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildAnomalyAnnotations(...e)})}(B).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,T,B,fe,ge]);const we=pe?pe.processedData:de,je="__compoundGroup",Ae=!(!T||!p),Oe=Ae?je:T?ni:p,Me=t.useMemo(()=>{if(!Ae)return we;const e="function"==typeof p?p:e=>e[p];return we.map(t=>{const n=Object.assign({},t);return n[je]=`${e(t)}__${t[ni]||"observed"}`,n})},[we,Ae,p]),Se=Ae?Me:we,Ce=t.useMemo(()=>{if(!T)return;const e=T.upperBounds,t=T.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,s=-1/0;const r=pe?pe.processedData:de;for(const e of r){const t="function"==typeof g?g(e):+e[g];if(isFinite(t)&&(i>t&&(i=t),t>s&&(s=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>s&&(s=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>s&&(s=t))}}return isFinite(i)&&isFinite(s)?[i,s]:void 0},[T,pe,de,g]),_e=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],n="function"==typeof g?g(e):e[g];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[f,g]),Pe=void 0!==(null===(i=Se[0])||void 0===i?void 0:i[y]),Le=t.useMemo(()=>{if(Pe)return Se;if(Oe){const e=Se.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[y]:[]};"string"==typeof Oe&&(o[Oe]=n),Ae&&(o[ni]=t[ni],"string"==typeof p&&(o[p]=t[p])),e[n]=o}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:Se}]},[Se,Oe,y,Pe]),{gapProcessedLineData:Be,hasGaps:Te}=t.useMemo(()=>{if("interpolate"===L){let e=!1;const t=[];for(const n of Le){const o=(n[y]||[]).filter(t=>!_e(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===L){let e=!1;const t=[];for(const n of Le){const o=n[y]||[];let i=[],s=0;const r=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const l of o)if(_e(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[y]:i})),i=[],s++);else{const e=null!=r?`${r}__seg${s}`:"__seg"+s;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===L){let e=!1;const t="string"==typeof g?g:"y",n=[];for(const o of Le){const i=o[y]||[],s=[];for(const n of i)_e(n)?(e=!0,s.push(Object.assign(Object.assign({},n),{[t]:0}))):s.push(n);n.push(Object.assign(Object.assign({},o),{[y]:s}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Le,hasGaps:!1}},[Le,L,y,_e,Oe,g]),Re="object"==typeof P?P:{},Fe=Re.position||"end",He=Re.fontSize||11,Ie=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof m?m:e=>e[m],n=new Set;for(const o of Be){const i=o[y]||[];if(0===i.length)continue;const s=null!==(e=t("end"===Fe?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==s)continue;const r=s+"";""!==r&&n.add(r)}return Array.from(n)},[P,m,Be,y,Fe]),Ne=t.useMemo(()=>{if(!P)return l.marginDefaults;const e=Ie.reduce((e,t)=>Math.max(e,t.length*(.6*He)),0)+10,t="end"===Fe?"right":"left";return Object.assign(Object.assign({},l.marginDefaults),{[t]:Math.max(l.marginDefaults[t]||0,e)})},[P,Ie,He,Fe,l.marginDefaults]),ze=Jo({data:we,rawData:a,colorBy:m,colorScheme:b,legendInteraction:X,legendPosition:q,selection:I,linkedHover:N,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:z,onClick:W,hoverHighlight:D,chartType:"LineChart",chartId:$,showLegend:(!P||void 0!==ie)&&ie,userMargin:c,marginDefaults:Ne,loading:Y,emptyContent:G,width:ee,height:te}),We=ze.colorScale,De=ze.effectiveSelectionHook,Ee=ze.resolvedSelection,$e=ze.customHoverBehavior,Ye=ze.customClickBehavior,Ge=ze.crosshairProps,Xe=t.useMemo(()=>(e,t)=>{const n={strokeWidth:O},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return m?We&&(n.stroke=ue(e,m,We),o&&(n.fill=n.stroke,n.fillOpacity=A)):(n.stroke=K||po,o&&(n.fill=K||po,n.fillOpacity=A)),n},[m,We,O,j,A,K]),[qe,Ve]=t.useState(null);t.useEffect(()=>{if(!T)return void Ve(null);let e=!1;return function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).createSegmentLineStyle(...e)})}(Xe,T).then(t=>{e||Ve(()=>t)}).catch(()=>{e||Ve(null)}),()=>{e=!0}},[Xe,T]);const Ue=qe||Xe,Ke=t.useMemo(()=>So(Ue,{stroke:Q,strokeWidth:Z,opacity:J}),[Ue,Q,Z,J]),Qe=t.useMemo(()=>fo(Ke,De,Ee),[Ke,De,Ee]),Ze=t.useMemo(()=>{if(k)return e=>{const t={r:w,fillOpacity:1};return m?We&&(t.fill=ue(e.parentLine||e,m,We)):t.fill=K||po,t}},[k,w,m,We,K]),Je=Array.isArray(j)?"mixed":j?"area":"line",et=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof f?f:e=>e[f],n="function"==typeof g?g:e=>e[g],o="function"==typeof m?m:e=>e[m],i=new Map;for(const t of Be){const n=t[y]||[];if(0===n.length)continue;const s="end"===Fe?n[n.length-1]:n[0],r=null!==(e=o(s))&&void 0!==e?e:o(t);if(null==r)continue;const l=r+"";""===l||i.has(l)||i.set(l,s)}const s=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof f?f:"x"]:t(o),["string"==typeof g?g:"y"]:n(o),dx:"end"===Fe?6:-6,dy:0,color:We?We(e):po,fontSize:He}));s.sort((e,t)=>{const n="string"==typeof g?g:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof g?g:"y",n=s[e-1],o=s[e];He+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=He+2)}return s},[P,m,We,Be,y,f,g,Fe,He]),tt=ze.margin,nt=p||m,ot=t.useMemo(()=>No([{label:ce||Ro(f),accessor:f,role:"x",format:h},{label:he||Ro(g),accessor:g,role:"y",format:d},...nt?[{label:Ro(nt),accessor:nt,role:"group"}]:[]]),[f,g,ce,he,nt,h,d]),it=Qo({componentName:"LineChart",data:Pe?(null===(s=we[0])||void 0===s?void 0:s[y])||[]:a,accessors:{xAccessor:f,yAccessor:g}}),st=t.useMemo(()=>Pe||Oe||Te?Be.flatMap(e=>{const t=e[y]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):Se,[Be,y,Pe,Oe,Se,Te]),rt=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:Je},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=E&&{hoverRadius:E}),null!=a&&{data:st}),{xAccessor:f,yAccessor:g,xScaleType:V,yScaleType:U}),R&&{xExtent:R}),!F||null==F[0]&&null==F[1]?Ce?{yExtent:Ce}:{}:{yExtent:F}),{groupAccessor:"break"===L&&Te?"_gapSegment":Oe||void 0,curve:x,lineStyle:Qe}),k&&{pointStyle:Ze}),{size:[ee,te],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:tt,showAxes:l.showAxes,xLabel:ce,yLabel:he,xFormat:h,yFormat:d,enableHover:ne,showGrid:oe}),ze.legendBehaviorProps),se&&{title:se}),re&&{description:re}),le&&{summary:le}),void 0!==ae&&{accessibleTable:ae}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===S?()=>null:"multi"===S?Bo():To(S)||ot}),"multi"===S&&{tooltipMode:"multi"}),(N||z||W||D)&&{customHoverBehavior:$e}),(z||W||N)&&{customClickBehavior:Ye}),C&&{pointIdAccessor:C}),((null==_?void 0:_.length)||me.length||et.length)&&{annotations:[..._||[],...me,...et]}),Ge),H);return ze.earlyReturn?ze.earlyReturn:it?e.jsx(zo,{componentName:"LineChart",message:it,width:ee,height:te}):e.jsx($o,{componentName:"LineChart",width:ee,height:te,children:e.jsx($n,Object.assign({ref:r},rt))})});function ri(e){const{title:t,description:n,summary:o,accessibleTable:i,className:s,animate:r}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),s&&(l.className=s),null!=r&&(l.animate=r),l}function li(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:s,customClickBehavior:r,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=s),(l?n||o||t:n||o)&&(a.customClickBehavior=r),a}function ai(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:To(t)||n}}si.displayName="LineChart";const ci=t.forwardRef(function(n,o){var i;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const r=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:O=2,showPoints:M=!1,pointRadius:S=3,tooltip:C,annotations:_,xExtent:P,yExtent:L,frameProps:B={},selection:T,linkedHover:R,onObservation:F,onClick:H,hoverHighlight:I,chartId:N,loading:z,emptyContent:W,legendInteraction:D,legendPosition:E,color:$,stroke:Y,strokeWidth:G,opacity:X}=n,{width:q,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=r,ie=t.useMemo(()=>v(l),[l]);Vo("AreaChart",ie,"xAccessor",d),Vo("AreaChart",ie,"yAccessor",f);const se=void 0!==(null===(i=ie[0])||void 0===i?void 0:i[m]),re=t.useMemo(()=>{if(se)return ie;if(g){const e=ie.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[m]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:ie}]},[ie,g,m,se]),le=Jo({data:ie,rawData:l,colorBy:b,colorScheme:x,legendInteraction:D,legendPosition:E,selection:T,linkedHover:R,fallbackFields:b?["string"==typeof b?b:""]:[],unwrapData:!1,onObservation:F,onClick:H,hoverHighlight:I,chartType:"AreaChart",chartId:N,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:z,emptyContent:W,width:q,height:V}),ae=t.useMemo(()=>e=>{const t={};if(b){if(le.colorScale){const n=ue(e,b,le.colorScale);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}}else{const e=$||po;t.fill=e,A?(t.stroke=e,t.strokeWidth=O):t.stroke="none"}return t.fillOpacity=w,t},[b,le.colorScale,$,w,A,O]),ce=t.useMemo(()=>So(ae,{stroke:Y,strokeWidth:G,opacity:X}),[ae,Y,G,X]),he=t.useMemo(()=>fo(ce,le.effectiveSelectionHook,le.resolvedSelection),[ce,le.effectiveSelectionHook,le.resolvedSelection]),de=t.useMemo(()=>{if(M)return e=>{const t={r:S,fillOpacity:1};return b?le.colorScale&&(t.fill=ue(e.parentLine||e,b,le.colorScale)):t.fill=po,t}},[M,S,b,le.colorScale]),fe=g||b,ge=t.useMemo(()=>No([{label:ne||Ro(d),accessor:d,role:"x",format:u},{label:oe||Ro(f),accessor:f,role:"y",format:h},...fe?[{label:Ro(fe),accessor:fe,role:"group"}]:[]]),[d,f,ne,oe,fe,u,h]),pe=Qo({componentName:"AreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),ye=t.useMemo(()=>se||g?re.flatMap(e=>{const t=e[m]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ie,[re,m,se,g,ie]),me=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:ye}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),y&&{gradientFill:y}),j&&{lineGradient:j}),{curve:k,lineStyle:he}),M&&de&&{pointStyle:de}),{size:[q,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le.margin,showAxes:r.showAxes,xLabel:ne,yLabel:oe,xFormat:u,yFormat:h,enableHover:U}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:K}),le.legendBehaviorProps),ri({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:ge})),li({linkedHover:R,onObservation:F,onClick:H,hoverHighlight:I,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),_&&_.length>0&&{annotations:_}),P&&{xExtent:P}),L&&{yExtent:L}),le.crosshairProps),B);return le.earlyReturn?le.earlyReturn:pe?e.jsx(zo,{componentName:"AreaChart",message:pe,width:q,height:V}):e.jsx($o,{componentName:"AreaChart",width:q,height:V,children:e.jsx($n,Object.assign({ref:s},me))})});ci.displayName="AreaChart";const ui=t.forwardRef(function(n,o){var i;const s=t.useRef(null),r=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:b="monotoneX",areaOpacity:x=.7,showLine:k=!0,lineWidth:w=2,showPoints:j=!1,pointRadius:A=3,normalize:O=!1,baseline:M="zero",stackOrder:S,tooltip:C,annotations:_,xExtent:P,yExtent:L,frameProps:B={},selection:T,linkedHover:R,onObservation:F,onClick:H,hoverHighlight:I,chartId:N,loading:z,emptyContent:W,legendInteraction:D,legendPosition:E,color:$,stroke:Y,strokeWidth:G,opacity:X}=n,{width:q,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=r,ie=t.useMemo(()=>v(l),[l]),se=y||g;ei(o,{variant:"xy",frameRef:s});const re=void 0!==(null===(i=ie[0])||void 0===i?void 0:i[p]),le=t.useMemo(()=>{if(re)return ie;if(g){const e=ie.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[p]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][p].push(t),e},{});return Object.values(e)}return[{[p]:ie}]},[ie,g,p,re]),ae=Jo({data:ie,rawData:l,colorBy:se,colorScheme:m,legendInteraction:D,legendPosition:E,selection:T,linkedHover:R,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:F,onClick:H,hoverHighlight:I,chartType:"StackedAreaChart",chartId:N,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:z,emptyContent:W,width:q,height:V}),ce=t.useMemo(()=>e=>{const t={};if(se&&ae.colorScale){const n=ue(e,se,ae.colorScale);t.fill=n,k?(t.stroke=n,t.strokeWidth=w):t.stroke="none"}else if(!se){const e=$||po;t.fill=e,t.stroke=k?e:"none",k&&(t.strokeWidth=w)}return t.fillOpacity=x,t},[se,ae.colorScale,x,k,w,$]),he=t.useMemo(()=>So(ce,{stroke:Y,strokeWidth:G,opacity:X}),[ce,Y,G,X]),de=t.useMemo(()=>fo(he,ae.effectiveSelectionHook,ae.resolvedSelection),[he,ae.effectiveSelectionHook,ae.resolvedSelection]),fe=t.useMemo(()=>{if(j)return e=>{const t={r:A,fillOpacity:1};return se?ae.colorScale&&(t.fill=ue(e.parentLine||e,se,ae.colorScale)):t.fill=$||po,t}},[j,A,se,ae.colorScale,$]),ge=g||y,pe=t.useMemo(()=>No([{label:ne||Ro(d),accessor:d,role:"x",format:u},{label:oe||Ro(f),accessor:f,role:"y",format:h},...ge?[{label:Ro(ge),accessor:ge,role:"group"}]:[]]),[d,f,ne,oe,ge,u,h]),ye=Qo({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),me=t.useMemo(()=>re||g?le.flatMap(e=>{const t=e[p]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ie,[le,p,re,g,ie]),ve=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:me}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0,curve:b,normalize:O,baseline:O?"zero":M,stackOrder:S,lineStyle:de}),j&&fe&&{pointStyle:fe}),{size:[q,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae.margin,showAxes:r.showAxes,xLabel:ne,yLabel:oe,xFormat:u,yFormat:h,enableHover:U}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:K}),ae.legendBehaviorProps),ri({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:pe})),li({linkedHover:R,onObservation:F,onClick:H,hoverHighlight:I,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),_&&_.length>0&&{annotations:_}),P&&{xExtent:P}),L&&{yExtent:L}),ae.crosshairProps),B);return ae.earlyReturn?ae.earlyReturn:ye?e.jsx(zo,{componentName:"StackedAreaChart",message:ye,width:q,height:V}):e.jsx($o,{componentName:"StackedAreaChart",width:q,height:V,children:e.jsx($n,Object.assign({ref:s},ve))})});ui.displayName="StackedAreaChart";const hi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const s=Oo(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:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:f="y",colorBy:g,colorScheme:p,sizeBy:y,sizeRange:m=[3,15],pointRadius:b=5,pointOpacity:x=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,xExtent:O,yExtent:M,frameProps:S={},selection:C,linkedHover:_,linkedBrush:P,onObservation:L,onClick:B,hoverHighlight:T,chartId:R,loading:F,emptyContent:H,legendInteraction:I,legendPosition:N,color:z,stroke:W,strokeWidth:D,opacity:E}=n,{width:$,height:Y,enableHover:G,showGrid:X,showLegend:q,title:V,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=s,ee=t.useMemo(()=>v(r),[r]),te=Jo({data:ee,rawData:r,colorBy:g,colorScheme:p,legendInteraction:I,legendPosition:N,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:L,onClick:B,hoverHighlight:T,chartType:"Scatterplot",chartId:R,showLegend:q,userMargin:l,marginDefaults:s.marginDefaults,loading:F,emptyContent:H,width:$,height:Y}),ne=ho(P),oe=no({name:(null==ne?void 0:ne.name)||"__unused_brush__",xField:(null==ne?void 0:ne.xField)||("string"==typeof h?h:void 0),yField:(null==ne?void 0:ne.yField)||("string"==typeof f?f:void 0)}),ie=ne?"xyBrush"===oe.brushInteraction.brush?"xy":"xBrush"===oe.brushInteraction.brush?"x":"y":void 0,se=d.useRef(oe.brushInteraction);se.current=oe.brushInteraction;const re=t.useCallback(e=>{const t=se.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)},[]);if(te.earlyReturn)return te.earlyReturn;Vo("Scatterplot",ee,"xAccessor",h),Vo("Scatterplot",ee,"yAccessor",f);const le=t.useMemo(()=>{if(!y||0===ee.length)return;const e=ee.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ee,y]),ae=t.useMemo(()=>e=>{const t={fillOpacity:x};return g?te.colorScale&&(t.fill=ue(e,g,te.colorScale)):t.fill=z||po,t.r=y?de(e,y,m,le):b,t},[g,te.colorScale,y,m,le,b,x,z]),ce=t.useMemo(()=>So(ae,{stroke:W,strokeWidth:D,opacity:E}),[ae,W,D,E]),he=t.useMemo(()=>fo(ce,te.effectiveSelectionHook,te.resolvedSelection),[ce,te.effectiveSelectionHook,te.resolvedSelection]),fe=t.useMemo(()=>No([{label:Z||Ro(h),accessor:h,role:"x",format:c},{label:J||Ro(f),accessor:f,role:"y",format:u},...g?[{label:Ro(g),accessor:g,role:"color"}]:[],...y?[{label:Ro(y),accessor:y,role:"size"}]:[]]),[h,f,Z,J,g,y,c,u]),ge=Qo({componentName:"Scatterplot",data:r,accessors:{xAccessor:h,yAccessor:f}});if(ge)return e.jsx(zo,{componentName:"Scatterplot",message:ge,width:$,height:Y});const pe=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!=r&&{data:ee}),{xAccessor:h,yAccessor:f,colorAccessor:g||void 0,sizeAccessor:y||void 0,sizeRange:m,pointStyle:he,colorScheme:p,size:[$,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:c,yFormat:u,enableHover:G,showGrid:X}),te.legendBehaviorProps),ri({title:V,description:U,summary:K,accessibleTable:Q,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:fe})),li({linkedHover:_,onObservation:L,onClick:B,hoverHighlight:T,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),O&&{xExtent:O}),M&&{yExtent:M}),ne&&{brush:{dimension:ie},onBrush:re}),te.crosshairProps),S);return e.jsx($o,{componentName:"Scatterplot",width:$,height:Y,children:e.jsx($n,Object.assign({ref:i},pe))})});function di(e,t){return ee(1===t?.5:e/(t-1))}hi.displayName="Scatterplot";const fi=t.forwardRef(function(n,o){var i,s;const r=t.useRef(null);ei(o,{variant:"xy",frameRef:r});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,xExtent:k,yExtent:w,frameProps:j={},selection:A,linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,chartId:_,loading:P,emptyContent:L,legendInteraction:B,stroke:T,strokeWidth:R,opacity:F}=n,{width:H,height:I,enableHover:N,showGrid:z,title:W,description:D,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=l,X=a||[],{safeData:q,orderMap:V}=t.useMemo(()=>{const e="function"==typeof f?f:e=>e[f],t="function"==typeof g?g:e=>e[g];let n=X;if(p&&X.length>0){const e="function"==typeof p?p:e=>e[p];n=[...X].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),s=t(o);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i++}let s=0;for(const r of n){const n=e(r),l=t(r);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(r,{idx:s++,total:i})}return{safeData:n,orderMap:o}},[X,p,f,g]);Vo("ConnectedScatterplot",q,"xAccessor",f),Vo("ConnectedScatterplot",q,"yAccessor",g);const U=Jo({data:q,rawData:a,colorBy:void 0,colorScheme:void 0,legendInteraction:B,selection:A,linkedHover:O,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:S,hoverHighlight:C,chartType:"ConnectedScatterplot",chartId:_,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,emptyContent:L,width:H,height:I}),K=null!==(s=null===(i=U.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==s?s:.5,Q=t.useMemo(()=>(e,t)=>{var n,o,i,s;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const l=null===(n=U.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=U.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>r.length,u=r.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=r[t],o=r[t+1],h=di(t,u),d=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(s=o.datum)&&void 0!==s?s:o),f=l?d?1:K:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=h,e.lineWidth=m,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[m,U.effectiveSelectionHook,K]),Z=t.useMemo(()=>[Q],[Q]),J=t.useMemo(()=>(t,n,o)=>{var i,s;const r=t.filter(e=>"point"===e.type);if(2>r.length)return null;const l=r.length,a=100>l,c=[];for(let t=0;l-1>t;t++){const n=r[t],o=r[t+1],u=di(t,l),h="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,d="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,f=Math.min(h,d);a&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:f},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ee=t.useMemo(()=>[J],[J]),te=t.useMemo(()=>e=>{var t,n;const o=V.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,s=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:s>0?di(i,s):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,V]),ne=t.useMemo(()=>So(te,{stroke:T,strokeWidth:R,opacity:F}),[te,T,R,F]),oe=t.useMemo(()=>fo(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),ie=y||("string"==typeof p?p:"Order"),se=t.useMemo(()=>No([{label:Y||Ro(f),accessor:f,role:"x",format:h},{label:G||Ro(g),accessor:g,role:"y",format:d},...p?[{label:ie,accessor:p,role:"group"}]:[]]),[f,g,Y,G,p,ie,h,d]),re=Qo({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:f,yAccessor:g}}),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({chartType:"scatter"},null!=a&&{data:q}),{xAccessor:f,yAccessor:g,pointStyle:oe,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,showAxes:l.showAxes,xLabel:Y,yLabel:G,xFormat:h,yFormat:d,enableHover:N,showGrid:z}),ri({title:W,description:D,summary:E,accessibleTable:$,className:u,animate:n.animate})),ai({tooltip:v,defaultTooltipContent:se})),li({linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:Z,svgPreRenderers:ee}),x&&x.length>0&&{annotations:x}),k&&{xExtent:k}),w&&{yExtent:w}),U.crosshairProps),j);return U.earlyReturn?U.earlyReturn:re?e.jsx(zo,{componentName:"ConnectedScatterplot",message:re,width:H,height:I}):e.jsx($o,{componentName:"ConnectedScatterplot",width:H,height:I,children:e.jsx($n,Object.assign({ref:r},le))})});fi.displayName="ConnectedScatterplot";const gi=t.forwardRef(function(n,o){const i=t.useRef(null),s=Oo(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:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",sizeBy:f,sizeRange:g=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:b=1,bubbleStrokeColor:x="white",tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,xExtent:O,yExtent:M,frameProps:S={},selection:C,linkedHover:_,linkedBrush:P,onObservation:L,onClick:B,hoverHighlight:T,chartId:R,loading:F,emptyContent:H,legendInteraction:I,legendPosition:N,color:z,stroke:W,strokeWidth:D,opacity:E}=n,{width:$,height:Y,enableHover:G,showGrid:X,showLegend:q,title:V,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=s,ee=t.useMemo(()=>v(r),[r]),te=void 0===r,ne=Jo({data:ee,rawData:r,colorBy:p,colorScheme:y,legendInteraction:I,legendPosition:N,selection:C,linkedHover:_,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:L,onClick:B,hoverHighlight:T,chartType:"BubbleChart",chartId:R,showLegend:q,userMargin:l,marginDefaults:s.marginDefaults,loading:F,emptyContent:H,width:$,height:Y}),oe=t.useRef(null),[ie,se]=t.useState(0),re=t.useCallback(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof f?f(n):n[f];null!=e&&isFinite(e)&&(oe.current?(oe.current[0]>e&&(oe.current[0]=e,t=!0),e>oe.current[1]&&(oe.current[1]=e,t=!0)):(oe.current=[e,e],t=!0))}t&&se(e=>e+1)},[te,f]),le=t.useCallback(e=>{var t;re([e]),null===(t=i.current)||void 0===t||t.push(e)},[re]),ae=t.useCallback(e=>{var t;re(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[re]);ei(o,{variant:"xy",frameRef:i,overrides:{push:le,pushMany:ae,clear:()=>{var e;oe.current=null,se(e=>e+1),null===(e=i.current)||void 0===e||e.clear()}},deps:[le,ae]});const ce=ho(P);no({name:(null==ce?void 0:ce.name)||"__unused_brush__",xField:(null==ce?void 0:ce.xField)||("string"==typeof h?h:void 0),yField:(null==ce?void 0:ce.yField)||("string"==typeof d?d:void 0)});const he=t.useMemo(()=>{if(te)return oe.current||[0,1];const e=ee.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[ee,f,te,ie]),fe=t.useMemo(()=>e=>{const t={fillOpacity:m,strokeWidth:b,stroke:x};return p?ne.colorScale&&(t.fill=ue(e,p,ne.colorScale)):t.fill=z||po,t.r=de(e,f,g,he),t},[p,ne.colorScale,f,g,he,m,b,x,z]),ge=t.useMemo(()=>So(fe,{stroke:W,strokeWidth:D,opacity:E}),[fe,W,D,E]),pe=t.useMemo(()=>fo(ge,ne.effectiveSelectionHook,ne.resolvedSelection),[ge,ne.effectiveSelectionHook,ne.resolvedSelection]),ye=t.useMemo(()=>No([{label:Z||Ro(h),accessor:h,role:"x",format:c},{label:J||Ro(d),accessor:d,role:"y",format:u},{label:Ro(f),accessor:f,role:"size"},...p?[{label:Ro(p),accessor:p,role:"color"}]:[]]),[h,d,Z,J,f,p,c,u]),me=Qo({componentName:"BubbleChart",data:r,accessors:{xAccessor:h,yAccessor:d},requiredProps:{sizeBy:f}});if(me)return e.jsx(zo,{componentName:"BubbleChart",message:me,width:$,height:Y});const ve=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!=r&&{data:ee}),{xAccessor:h,yAccessor:d,colorAccessor:p||void 0,sizeAccessor:f,sizeRange:g,pointStyle:pe,colorScheme:y,size:[$,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:c,yFormat:u,enableHover:G,showGrid:X}),ne.legendBehaviorProps),ri({title:V,description:U,summary:K,accessibleTable:Q,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:ye})),li({linkedHover:_,onObservation:L,onClick:B,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),O&&{xExtent:O}),M&&{yExtent:M}),ne.crosshairProps),S);return ne.earlyReturn?ne.earlyReturn:e.jsx($o,{componentName:"BubbleChart",width:$,height:Y,children:e.jsx($n,Object.assign({ref:i},ve))})});gi.displayName="BubbleChart";const pi=t.forwardRef(function(n,o){var s;const r=t.useRef(null);ei(o,{variant:"xy",frameRef:r});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xAccessor:h="x",yAccessor:d="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,xExtent:j,yExtent:A,frameProps:O={},selection:M,linkedHover:S,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:B,emptyContent:T,showLegend:R,legendPosition:F,legendInteraction:H}=n,{width:I,height:N,enableHover:z,title:W,description:D,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=l,X=qo(B,I,N),q=X?null:Xo(a,I,N,T),re=t.useMemo(()=>v(a),[a]),le=function(){var e;const t=go();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ae=null!==(s=null!=y?y:le)&&void 0!==s?s:"blues",ce=null!=R&&R,ue=null!=F?F:"right",{margin:he}=wo({data:re,colorBy:ce?"value":void 0,colorScale:void 0,showLegend:ce,legendPosition:ue,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:de,customClickBehavior:fe,crosshairSourceId:ge}=xo({selection:M,linkedHover:S,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Zo(M);const pe=ko(S,ge);jo(H,void 0,[]);const ye=t.useMemo(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),me=t.useMemo(()=>{const e=re.map(ye);return[Math.min(...e),Math.max(...e)]},[re,ye]),ve=t.useMemo(()=>"custom"===ae&&m?m:i.scaleSequential({blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:se}[ae]||V).domain(me),[ae,m,me]),be=t.useMemo(()=>No([{label:Y||Ro(h),accessor:h,role:"x",format:g},{label:G||Ro(d),accessor:d,role:"y",format:p},{label:Ro(f),accessor:f,role:"value",format:x}]),[h,d,Y,G,f,g,p,x]),xe=Qo({componentName:"Heatmap",data:a,accessors:{xAccessor:h,yAccessor:d,valueAccessor:f}}),ke=t.useMemo(()=>{if(ce)return{gradient:{colorFn:e=>ve(e),domain:me,label:"string"==typeof f?f:"value",format:x}}},[ce,ve,me,f,x]),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({chartType:"heatmap"},null!=a&&{data:re}),{xAccessor:h,yAccessor:d,valueAccessor:f,colorScheme:"custom"!==ae?ae:void 0,showValues:b,heatmapValueFormat:x,size:[I,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:he,showAxes:l.showAxes,xLabel:Y,yLabel:G,xFormat:g,yFormat:p,enableHover:z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),ke&&{legend:ke,legendPosition:ue}),ri({title:W,description:D,summary:E,accessibleTable:$,className:u,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:be})),li({linkedHover:S,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:de,customClickBehavior:fe})),w&&w.length>0&&{annotations:w}),j&&{xExtent:j}),A&&{yExtent:A}),pe),O);return X||q||(xe?e.jsx(zo,{componentName:"Heatmap",message:xe,width:I,height:N}):e.jsx($o,{componentName:"Heatmap",width:I,height:N,children:e.jsx($n,Object.assign({ref:r},we))}))});pi.displayName="Heatmap";const yi="__splomIdx",mi={top:4,bottom:4,left:4,right:4};function vi({frameRef:i,cellSize:s,onBrush:r}){const l=t.useRef(null),a=s-mi.left-mi.right,c=s-mi.top-mi.bottom;return t.useEffect(()=>{if(!l.current)return;const e=n.select(l.current).select(".brush-g"),t=o.brush().extent([[0,0],[a,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void r(null);const[[o,s],[l,a]]=e.selection,c=[[n.x.invert(o),n.y.invert(s)],[n.x.invert(l),n.y.invert(a)]];r(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,c,i,r]),e.jsx("svg",{ref:l,width:s,height:s,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${mi.left},${mi.top})`})})}function bi({data:n,xField:o,yField:i,cellSize:s,pointRadius:r,pointOpacity:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:h,unselectedOpacity:d,mode:f,onPointHover:g}){const p=t.useRef(null),y=Jn({name:u,clientId:`splom-${o}-${i}`}),m=no({name:u,xField:o,yField:i}),v=Jn({name:h,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==g||g(null));const t=e.data,n=null==t?void 0:t[yi];void 0!==n&&(b({[yi]:[n]}),null==g||g(t,e.x+mi.left,e.y+mi.top))},[b,g]),w=t.useCallback(e=>{const t={opacity:l,r:r};return t.fill=a?ue(e,a,c):po,"hover"===f?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*l):y.isActive&&!y.predicate(e)&&(t.opacity=d),t},[a,c,l,r,f,y.isActive,y.predicate,v.isActive,v.predicate,d]);return e.jsxs("div",{style:{position:"relative",width:s,height:s},children:[e.jsx($n,{ref:p,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:i,pointStyle:w,margin:mi,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?k:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.jsx(vi,{frameRef:p,cellSize:s,xField:o,yField:i,onBrush:x})]})}function xi({data:n,field:o,label:i,cellSize:s,bins:r,colorBy:l,colorScale:a,brushSelectionName:c,hoverSelectionName:u,mode:h}){const d=Jn({name:c,clientId:"splom-diag-"+o}),f=Jn({name:u,clientId:`splom-diag-${o}-hover`}),g="hover"===h?f:d,p=g.isActive,y=g.predicate,m=t.useMemo(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/r||1,a="string"==typeof l?l:null,c=a?[...new Set(n.map(e=>e[a]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),h=Array(r).fill(0),d=Array(r).fill(0),f=Array.from({length:r},()=>Array(c.length).fill(0)),g=Array.from({length:r},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const s=Math.min(Math.floor((n-t)/i),r-1);if(h[s]++,p&&!y(e)||d[s]++,a){const t=u.get(e[a]+"");void 0!==t&&(f[s][t]++,p&&!y(e)||g[s][t]++)}}const m=Math.max(...h,1),v=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(s-24),l={x:t/r*s,w:s/r-1,h:i,y0:n,category:c[o]};return n+=i,l})}),b=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(s-24),l={x:t/r*s,w:s/r-1,h:i,y0:n,category:c[o]};return n+=i,l})});return{bars:h.map((e,t)=>({x:t/r*s,w:s/r-1,h:e/m*(s-24),count:e})),selectedBars:d.map((e,t)=>({x:t/r*s,w:s/r-1,h:e/m*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[n,o,r,s,p,y,l]);return e.jsxs("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e.jsx("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:p?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:p?.3:.6},"bg-"+n)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:.7},"sel-"+n)))]})}function ki({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function wi(n){const{data:o,fields:i,fieldLabels:s={},colorBy:r,colorScheme:l,cellSize:a=150,cellGap:c=4,pointRadius:u=2,pointOpacity:h=.5,diagonal:f="histogram",histogramBins:g=20,brushMode:p="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=n,O="splom",M="splom-hover",S=y?"hover":p?"brush":"hover",C=Kn(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(M),P(null)},[C,M]),B=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[yi]?e:Object.assign(Object.assign({},e),{[yi]:t})),[o]),T=bo(B,r,l),R=void 0!==x?x:!!r,F=t.useMemo(()=>{if(!R||!r)return null;const e="string"==typeof r?r:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:T?T(e+""):po})):null},[R,r,B,T]),H=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>a+"px").join(" "),gridTemplateRows:i.map(()=>a+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,a,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[F&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:H,onMouseLeave:"hover"===S?L:void 0,children:[i.map((t,n)=>e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t}),i.map((o,i)=>n===i?"label"===f?e.jsx(ki,{label:s[t]||t,cellSize:a},"diag-"+t):e.jsx(xi,{data:B,field:t,label:s[t]||t,cellSize:a,bins:g,colorBy:r,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,mode:S},"diag-"+t):e.jsx(bi,{data:B,xField:o,yField:t,fieldLabels:s,cellSize:a,pointRadius:u,pointOpacity:h,colorBy:r,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,showGrid:v,tooltip:b,mode:S,onPointHover:"hover"===S?(e,s,r)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=s?s:0,py:null!=r?r:0}),j&&j({type:"hover",datum:e,x:null!=s?s:0,y:null!=r?r:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t},"col-label-"+t))]}),_&&"hover"===S&&(()=>{const t=_.datum,n=s[_.xField]||_.xField,o=s[_.yField]||_.yField,i=r?"function"==typeof r?r(t):t[r]:null,l=k?"function"==typeof k?k(t):t[k]:"Row "+t[yi];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(a+c)+_.px,top:_.rowIndex*(a+c)+_.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.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function ji(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(uo,{selections:i,children:e.jsx(wi,Object.assign({},t))})}function Ai({width:i,height:s,margin:r,scales:l,brushDirection:a,extent:c,onBrush:u}){const h=t.useRef(null),d=t.useRef(null),f=t.useRef(!1),g=i+r.left+r.right,p=s+r.top+r.bottom;return t.useEffect(()=>{if(!h.current||!l)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?o.brushX().extent([[0,0],[i,s]]):o.brushY().extent([[0,0],[i,s]]);return t.on("brush end",e=>{if(f.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===a?l.x:l.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,i,s,a,u]),t.useEffect(()=>{if(!d.current||!l||!h.current)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?l.x:l.y;if(f.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);f.current=!1},[c,l,a]),e.jsx("svg",{ref:h,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${r.left},${r.top})`})})}function Oi(n){var o,i;const{data:s,width:r=600,height:l=400,margin:a,className:c,title:u,description:h,summary:d,xLabel:f,yLabel:g,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:O=2,fillArea:M=!1,areaOpacity:S=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:B,legendPosition:T,tooltip:R,minimap:F={},renderBefore:H=!1,onBrush:I,brushExtent:N,yExtent:z,frameProps:W={},loading:D,emptyContent:E}=n,$=qo(D,r,l),Y=$?null:Xo(s,r,l,E),G=t.useMemo(()=>v(s),[s]),[X,q]=t.useState(null),V=null!=N?N:X,U=t.useCallback(e=>{N||q(e),null==I||I(e)},[N,I]),K=t.useRef(null),[Q,Z]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const s=null===(i=null===(o=K.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);s?Z(s):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[s]);const J=void 0!==(null===(o=G[0])||void 0===o?void 0:o[k]),ee=t.useMemo(()=>{if(J)return G;if(x){const e=G.reduce((e,t)=>{const n="function"==typeof x?x(t):t[x];if(!e[n]){const t={[k]:[]};"string"==typeof x&&(t[x]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:G}]},[G,x,k,J]),te=t.useMemo(()=>J||x?ee.flatMap(e=>{const t=e[k]||[];return x&&"string"==typeof x?t.map(t=>Object.assign(Object.assign({},t),{[x]:e[x]})):t}):G,[ee,k,J,x,G]),ne=bo(G,w,j),oe=t.useMemo(()=>e=>{const t={strokeWidth:O};return t.stroke=w?ue(e,w,ne):po,M&&(t.fill=t.stroke,t.fillOpacity=S),t},[w,ne,O,M,S]),ie=t.useMemo(()=>F.lineStyle?F.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=w?ue(e,w,ne):po,t},[w,ne,F.lineStyle]),se=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ue(e.parentLine||e,w,ne):po,t}},[C,_,w,ne]),{legend:re,margin:le,legendPosition:ae}=wo({data:ee,colorBy:w,colorScale:ne,showLegend:B,legendPosition:T,userMargin:a}),ce=F.height||60,he=t.useMemo(()=>{var e,t,n,o,i,s,r,l;return{top:null!==(t=null===(e=F.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=F.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(s=null===(i=F.margin)||void 0===i?void 0:i.left)&&void 0!==s?s:le.left,right:null!==(l=null===(r=F.margin)||void 0===r?void 0:r.right)&&void 0!==l?l:le.right}},[F.margin,le]),de=F.brushDirection||"x",fe=Qo({componentName:"MinimapChart",data:s,accessors:{xAccessor:m,yAccessor:b}});if(fe)return e.jsx(zo,{componentName:"MinimapChart",message:fe,width:r,height:l});const ge=M?"area":"line",pe=t.useMemo(()=>No([{label:f||Ro(m),accessor:m,role:"x",format:p},{label:g||Ro(b),accessor:b,role:"y",format:y}]),[m,b,f,g,p,y]),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ge,data:te,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:oe},C&&{pointStyle:se}),{size:[r,l],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,showAxes:!0,xLabel:f,yLabel:g,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),re&&{legend:re,legendPosition:ae}),u&&{title:u}),h&&{description:h}),d&&{summary:d}),{tooltipContent:!1===R?()=>null:To(R)||pe}),V&&{xExtent:V}),z&&{yExtent:z}),W),me=Object.assign({chartType:ge,data:te,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:ie,size:[r,ce+he.top+he.bottom],margin:he,showAxes:null!==(i=F.showAxes)&&void 0!==i&&i,background:F.background,enableHover:!1},z&&{yExtent:z}),ve=e.jsxs("div",{style:{position:"relative",width:r,overflow:"hidden"},children:[e.jsx($n,Object.assign({ref:K},me)),e.jsx(Ai,{width:r-he.left-he.right,height:ce,margin:he,scales:Q,brushDirection:de,extent:V,onBrush:U})]},"minimap"),be=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx($n,Object.assign({},ye))},"main");return $||Y||e.jsx($o,{componentName:"MinimapChart",width:r,height:l,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[H?ve:be,H?be:ve]})})}ji.displayName="ScatterplotMatrix",Oi.displayName="MinimapChart";const Mi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const s=Oo(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:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",xCenter:f,yCenter:g,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:b=12,colorBy:x,colorScheme:k,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:O=.8,tooltip:M,pointIdAccessor:S,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:B,onClick:T,hoverHighlight:R,chartId:F,loading:H,emptyContent:I,legendInteraction:N,legendPosition:z,color:W,stroke:D,strokeWidth:E,opacity:$}=n,{width:Y,height:G,enableHover:X,showGrid:q,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=s,te=t.useMemo(()=>v(r),[r]),ne=Jo({data:te,rawData:r,colorBy:x,colorScheme:k,legendInteraction:N,legendPosition:z,selection:P,linkedHover:L,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:R,chartType:"QuadrantChart",chartId:F,showLegend:V,userMargin:l,marginDefaults:s.marginDefaults,loading:H,emptyContent:I,width:Y,height:G});Vo("QuadrantChart",te,"xAccessor",h),Vo("QuadrantChart",te,"yAccessor",d);const oe=t.useMemo(()=>{if(!te.length)return;const e="function"==typeof h?h:e=>+e[h],t="function"==typeof d?d:e=>+e[d];let n=1/0,o=-1/0,i=1/0,s=-1/0;for(const r of te){const l=e(r),a=t(r);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>s&&(s=a))}if(null!=f&&isFinite(f)&&(n>f&&(n=f),f>o&&(o=f)),null!=g&&isFinite(g)&&(i>g&&(i=g),g>s&&(s=g)),n===1/0)return;const r=.1*(o-n)||1,l=.1*(s-i)||1;return{xExtent:[n-r,o+r],yExtent:[i-l,s+l]}},[te,h,d,f,g]),ie=t.useMemo(()=>{if(!w||0===te.length)return;const e=te.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,w]),se=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),re=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>e=>{const t={fillOpacity:O};if(x)ne.colorScale&&(t.fill=ue(e,x,ne.colorScale));else{const n=se(e),o=re(e),i=null!=f?n>=f:void 0,s=null!=g?o>=g:void 0;t.fill=void 0===s||void 0===i?W||po:s&&i?p.topRight.color:s&&!i?p.topLeft.color:!s&&i?p.bottomRight.color:p.bottomLeft.color}return t.r=w?de(e,w,j,ie):A,t},[x,ne.colorScale,w,j,ie,A,O,se,re,f,g,p,W]),ae=t.useMemo(()=>So(le,{stroke:D,strokeWidth:E,opacity:$}),[le,D,E,$]),ce=t.useMemo(()=>fo(ae,ne.effectiveSelectionHook,ne.resolvedSelection),[ae,ne.effectiveSelectionHook,ne.resolvedSelection]),he=t.useMemo(()=>{if(!te.length)return;const e=new Set;"string"==typeof h&&e.add(h),"string"==typeof d&&e.add(d),"string"==typeof x&&e.add(x),"string"==typeof w&&e.add(w);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,h,d,x,w]),fe=t.useMemo(()=>No([...he?[{label:he,accessor:he,role:"title"}]:[],{label:J||Ro(h),accessor:h,role:"x",format:c},{label:ee||Ro(d),accessor:d,role:"y",format:u},...x?[{label:Ro(x),accessor:x,role:"color"}]:[],...w?[{label:Ro(w),accessor:w,role:"size"}]:[]]),[he,h,d,J,ee,x,w,c,u]),ge=Qo({componentName:"QuadrantChart",data:r,accessors:{xAccessor:h,yAccessor:d}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,n,o,i)=>{var s;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const r=i.width,l=i.height,a=null!=f?o.x(f):r/2,c=null!=g?o.y(g):l/2;if(null!=f&&!isFinite(a))return;if(null!=g&&!isFinite(c))return;const u=Math.max(0,Math.min(r,a)),h=Math.max(0,Math.min(l,c)),d=[{config:p.topLeft,x:0,y:0,w:u,h:h},{config:p.topRight,x:u,y:0,w:r-u,h:h},{config:p.bottomLeft,x:0,y:h,w:u,h:l-h},{config:p.bottomRight,x:u,y:h,w:r-u,h:l-h}];for(const t of d)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(s=t.config.opacity)&&void 0!==s?s:.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,h),e.lineTo(r,h),e.stroke(),e.setLineDash([])}]},[f,g,p,y]),ye=t.useMemo(()=>m?[...pe,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,s=o.height,r=null!=f?n.x(f):i/2,l=null!=g?n.y(g):s/2;(null==f||isFinite(r))&&(null==g||isFinite(l))&&(e.font=`600 ${b}px sans-serif`,e.globalAlpha=.5,e.fillStyle=p.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(p.topLeft.label,8,8),e.fillStyle=p.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(p.topRight.label,i-8,8),e.fillStyle=p.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(p.bottomLeft.label,8,s-8),e.fillStyle=p.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(p.bottomRight.label,i-8,s-8),e.globalAlpha=1)}]:pe,[pe,m,b,p,f,g]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const s=i.width,r=i.height,l=null!=f?o.x(f):s/2,a=null!=g?o.y(g):r/2;if(null!=f&&!isFinite(l))return null;if(null!=g&&!isFinite(a))return null;const c=Math.max(0,Math.min(s,l)),u=Math.max(0,Math.min(r,a));return e.jsxs(e.Fragment,{children:[[{config:p.topLeft,x:0,y:0,w:c,h:u},{config:p.topRight,x:c,y:0,w:s-c,h:u},{config:p.bottomLeft,x:0,y:u,w:c,h:r-u},{config:p.bottomRight,x:c,y:u,w:s-c,h:r-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("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.jsx("line",{x1:c,y1:0,x2:c,y2:r,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:s,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+b,fill:p.topLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.topLeft.label}),e.jsx("text",{x:s-8,y:8+b,fill:p.topRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.topRight.label}),e.jsx("text",{x:8,y:r-8,fill:p.bottomLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.bottomLeft.label}),e.jsx("text",{x:s-8,y:r-8,fill:p.bottomRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.bottomRight.label})]})]})}]},[f,g,p,y,m,b]),be=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!=r&&{data:te}),{xAccessor:h,yAccessor:d,colorAccessor:x||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:ce,colorScheme:k,size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,showAxes:s.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:X,showGrid:q}),oe&&{xExtent:oe.xExtent,yExtent:oe.yExtent}),ne.legendBehaviorProps),U&&{title:U}),K&&{description:K}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),a&&{className:a}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?fe:To(M)||fe}),(L||B||T||R)&&{customHoverBehavior:ne.customHoverBehavior}),(B||T||L)&&{customClickBehavior:ne.customClickBehavior}),S&&{pointIdAccessor:S}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ne.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return ne.earlyReturn?ne.earlyReturn:ge?e.jsx(zo,{componentName:"QuadrantChart",message:ge,width:Y,height:G}):e.jsx($o,{componentName:"QuadrantChart",width:Y,height:G,children:e.jsx($n,Object.assign({ref:i},be))})});Mi.displayName="QuadrantChart";const Si="__ma_unitized",Ci="__ma_series";function _i(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Pi(e,t){return t[0]+e*(t[1]-t[0])}const Li=t.forwardRef(function(n,o){var i;const s=t.useRef(null),r=t.useRef([]),l=t.useRef(n.series);l.current=n.series,t.useImperativeHandle(o,()=>{const e=()=>{var e;return(null!==(e=l.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!s.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||r.current[e];if(!i)continue;const l=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=l&&isFinite(l)&&s.current.push(Object.assign(Object.assign({},o),{[Si]:_i(l,i),[Ci]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!s.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],s=i.extent||r.current[t];if(!s)continue;const l=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=l&&isFinite(l)&&o.push(Object.assign(Object.assign({},e),{[Si]:_i(l,s),[Ci]:i.label||"Series "+(t+1)}))}s.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const a=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:h,xFormat:f,xAccessor:g="x",series:p,colorScheme:y,curve:m="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:S,chartId:C,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,stroke:T,strokeWidth:R,opacity:F}=n,{width:H,height:I,enableHover:N,showGrid:z,showLegend:W=!0,title:D,description:E,summary:$,accessibleTable:Y,xLabel:G}=a,X=t.useMemo(()=>v(c),[c]),q=t.useMemo(()=>v(p),[p]),V=q,U=2===q.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||U||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const K=qo(_,H,I),Q=K?null:Xo(c,H,I,P),Z=vo(),J=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(Z&&Z.length>0)e=Z;else{const t=re[y];e=Array.isArray(t)?t:le}return V.map((t,n)=>t.color||e[n%e.length])},[V,y,Z]),ee=t.useMemo(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:te,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(r.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.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]}(X,e.yAccessor));if(r.current=e,!U){const t=[];for(const e of X)for(let n=0;q.length>n;n++){const o=q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Si]:i,[Ci]:ee[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of X)for(let o=0;2>o;o++){const i=q[o],s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=s&&t.push(Object.assign(Object.assign({},n),{[Si]:_i(s,e[o]),[Ci]:ee[o]}))}return{unitizedData:t,extents:e}},[X,q,U,ee]),oe=t.useMemo(()=>{if(U&&ne.length>=2)return[{orient:"left",label:ee[0],tickFormat:q[0].format||(e=>{const t=Pi(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ee[1],tickFormat:q[1].format||(e=>{const t=Pi(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[U,ne,q,ee]),ie=Jo({data:t.useMemo(()=>te.length>0?te:ee.map(e=>({[Ci]:e})),[te,ee]),rawData:c,colorBy:Ci,colorScheme:J,legendInteraction:L,legendPosition:B,selection:j,linkedHover:A,fallbackFields:[Ci],unwrapData:!1,onObservation:O,onClick:M,hoverHighlight:S,chartType:"MultiAxisLineChart",chartId:C,showLegend:W,userMargin:u,marginDefaults:U?Object.assign(Object.assign({},a.marginDefaults),{left:70,right:70}):a.marginDefaults,loading:_,emptyContent:P,width:H,height:I});if(ie.earlyReturn)return ie.earlyReturn;const se=t.useMemo(()=>{const e=new Map;return ee.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[Ci])||J[0],strokeWidth:b,fill:"none"})},[ee,J,b]),ae=t.useMemo(()=>So(se,{stroke:T,strokeWidth:R,opacity:F}),[se,T,R,F]),ce=t.useMemo(()=>fo(ae,ie.effectiveSelectionHook,ie.resolvedSelection),[ae,ie.effectiveSelectionHook,ie.resolvedSelection]),ue=t.useMemo(()=>{if(!1===x)return()=>null;return To(x)||(e=>{var t;const n=e.data||e,o=n[Ci],i=ee.indexOf(o),s=n[Si],r=U&&i>=0&&ne[i]?Pi(s,ne[i]):s,l=i>=0&&(null===(t=q[i])||void 0===t?void 0:t.format)?q[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof g?g(n):n[g];return d.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},d.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[i]||"inherit"}},o),d.createElement("div",null,`${"string"==typeof g?g:"x"}: ${a}`),d.createElement("div",null,`${o}: ${l(r)}`))})},[x,ee,J,ne,U,q,g]),he=Qo({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),de=U?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:te}),{xAccessor:g,yAccessor:Si,groupAccessor:Ci,lineStyle:ce,colorScheme:J,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:a.showAxes}),oe&&{axes:oe}),{xLabel:G}),U?{}:{yLabel:ee[0]}),{xFormat:f}),U&&de&&{yExtent:de}),{enableHover:N}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:z,curve:m}),ie.legendBehaviorProps),D&&{title:D}),E&&{description:E}),$&&{summary:$}),void 0!==Y&&{accessibleTable:Y}),h&&{className:h}),null!=n.animate&&{animate:n.animate}),{tooltipContent:ue}),k&&{annotations:k}),(A||O||M||S)&&{customHoverBehavior:ie.customHoverBehavior}),(O||M||A)&&{customClickBehavior:ie.customClickBehavior}),ie.crosshairProps),w);return K||Q||(he?e.jsx(zo,{componentName:"MultiAxisLineChart",message:he,width:H,height:I}):e.jsx($o,{componentName:"MultiAxisLineChart",width:H,height:I,children:e.jsx($n,Object.assign({ref:s},fe))}))});Li.displayName="MultiAxisLineChart";const Bi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const s=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",highAccessor:d="high",lowAccessor:f="low",openAccessor:g,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:M,chartId:S,loading:C,emptyContent:_}=n,{width:P,height:L,enableHover:B,showGrid:T,title:R,description:F,summary:H,accessibleTable:I,xLabel:N,yLabel:z}=s,W=qo(C,P,L),D=W?null:Xo(r,P,L,_),E=t.useMemo(()=>v(r),[r]),$=null==g||null==p;Vo("CandlestickChart",E,"xAccessor",h),Vo("CandlestickChart",E,"highAccessor",d),Vo("CandlestickChart",E,"lowAccessor",f),$||(Vo("CandlestickChart",E,"openAccessor",g),Vo("CandlestickChart",E,"closeAccessor",p));const{customHoverBehavior:Y,customClickBehavior:G,crosshairSourceId:X}=xo({selection:j,linkedHover:A,onObservation:O,onClick:M,chartType:"CandlestickChart",chartId:S}),q=ko(A,X),V=t.useMemo(()=>{const e=s.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?t:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},t),l)},[l,s.marginDefaults,n.mode]),U=t.useMemo(()=>{const e=[{label:N||Ro(h),accessor:h,role:"x",format:c}];return $?(e.push({label:"High",accessor:d,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:g,format:u}),e.push({label:"High",accessor:d,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:p,format:u})),No(e)},[h,N,c,u,d,f,g,p,$]),K=Qo({componentName:"CandlestickChart",data:r,accessors:Object.assign({xAccessor:h,highAccessor:d,lowAccessor:f},!$&&{openAccessor:g,closeAccessor:p})}),Q=Math.max(2,Math.min(12,Math.round(P/40))),Z=P>200?.1:.02,J=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!=r&&{data:E}),{xAccessor:h,yAccessor:d,highAccessor:d,lowAccessor:f}),!$&&{openAccessor:g,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Q,extentPadding:Z,size:[P,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,showAxes:s.showAxes,xLabel:N,yLabel:z,xFormat:c,yFormat:u,enableHover:B,showGrid:T}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),ri({title:R,description:F,summary:H,accessibleTable:I,className:a,animate:n.animate})),ai({tooltip:m,defaultTooltipContent:U})),li({linkedHover:A,onObservation:O,onClick:M,customHoverBehavior:Y,customClickBehavior:G})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),q),w);return W||D||(K?e.jsx(zo,{componentName:"CandlestickChart",message:K,width:P,height:L}):e.jsx($o,{componentName:"CandlestickChart",width:P,height:L,children:e.jsx($n,Object.assign({ref:i},J))}))});Bi.displayName="CandlestickChart";const Ti=t.forwardRef(function(n,o){const{data:i,layout:s,layoutConfig:r,xExtent:l,yExtent:a,showAxes:c=!1,margin:u,className:h,annotations:d,onObservation:f,onClick:g,selection:p,linkedHover:y,chartId:m,loading:v,emptyContent:b,colorScheme:x,frameProps:k={}}=n,{frameRef:w,resolved:j,safeData:A,setup:O,earlyReturn:M}=function(e){var n;const o=function(e){const n=t.useRef(null);return ei(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:Oo(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:t.useMemo(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:s}=o,r=Jo({data:null!==(n=e.data)&&void 0!==n?n:[],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:i.showLegend,userMargin:s,marginDefaults:i.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:i,colorScheme:x,selection:p,linkedHover:y,onObservation:f,onClick:g,chartId:m,loading:v,emptyContent:b,margin:u,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,mode:n.mode,xLabel:n.xLabel,yLabel:n.yLabel});if(M)return M;const{width:S,height:C,enableHover:_,showGrid:P,title:L,description:B,summary:T,accessibleTable:R,xLabel:F,yLabel:H}=j,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:A}),{customLayout:s,layoutConfig:r,xExtent:l,yExtent:a,colorScheme:x,size:[S,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,showAxes:c,xLabel:F,yLabel:H,enableHover:_,showGrid:P}),O.legendBehaviorProps),ri({title:L,description:B,summary:T,accessibleTable:R,className:h,animate:n.animate})),null!=n.tooltip&&{tooltipContent:n.tooltip}),li({linkedHover:y,onObservation:f,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),d&&d.length>0&&{annotations:d}),O.crosshairProps),k);return e.jsx($o,{componentName:"XYCustomChart",width:S,height:C,children:e.jsx($n,Object.assign({ref:w},I))})});function Ri(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),s=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}function Fi(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),s=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}Ti.displayName="XYCustomChart";const Hi="__forecastSegment";function Ii(e,t){return"function"==typeof t?t(e):!!e[t]}const Ni=Object.freeze({__proto__:null,SEGMENT_FIELD:Hi,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(s=o).isTraining||s.isForecast||s.isAnomaly||s.upperBounds||s.lowerBounds?function(e,t,n,o,i){var s,r,l,a;const{isTraining:c,isForecast:u,isAnomaly:h,upperBounds:d,lowerBounds:f,color:g="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&Ii(e,u)?t="forecast":c&&Ii(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[Hi]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(s=t[x])&&void 0!==s?s:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][Hi]!==n[e+1][Hi]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[Hi]:n[e][Hi]})),t.push(Object.assign(Object.assign({},n[e]),{[Hi]:n[e+1][Hi]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][Hi]!==b[e+1][Hi]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[Hi]:b[e][Hi]})),k.push(Object.assign(Object.assign({},b[e]),{[Hi]:b[e+1][Hi]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[Hi]&&e.push(Object.assign(Object.assign({},t),{[Hi]:"training-base"}));k.unshift(...e)}const w=[];if(d&&f){const e="string"==typeof d?d:"__envUpper",t="string"==typeof f?f:"__envLower";if("function"==typeof d||"function"==typeof f)for(const n of k)"function"==typeof d&&(n[e]=d(n)),"function"==typeof f&&(n[t]=f(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:g,fillOpacity:p,label:v})}if(h){const e=o.anomalyStyle,t={type:"highlight",filter:e=>Ii(e,h)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(l=i.bandOpacity)&&void 0!==l?l:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var s,r,l;const{trainEnd:a,steps:c=10,confidence:u=.95,color:h="#6366f1",bandOpacity:d=.15,label:f}=o;if(null==a)return{processedData:e,annotations:[]};const g=[],p=[];for(const n of e)n[t]>a?p.push(Object.assign(Object.assign({},n),{[Hi]:"observed"})):g.push(Object.assign(Object.assign({},n),{[Hi]:"training"}));const y=g.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const o=y.length;let i=0,s=0,r=0,l=0;for(const[e,t]of y)i+=e,s+=t,r+=e*e,l+=e*t;const a=o*r-i*i;if(Math.abs(a)>1e-12){const r=(o*l-i*s)/a,g=(s-r*i)/o,p=e=>g+r*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(o-2,1)),k=y.reduce((e,t)=>e+t[0],0)/o,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),O=Math.max(...A),M=y.length>1?(y[o-1][0]-y[0][0])/(o-1):1;for(let e=1;c>=e;e++){const i=O+e*M,s=p(i),r=x*Math.sqrt(1+1/o+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[n]:s,[Hi]:"forecast",__forecastUpper:s+r,__forecastLower:s-r})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:h,fillOpacity:d,label:f})}}m.push({type:"x-threshold",x:a,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(r=i.bandOpacity)&&void 0!==r?r:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label});const b=[];if(b.push(...g),g.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},g[g.length-1]),{[Hi]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:g[g.length-1];e&&b.push(Object.assign(Object.assign({},e),{[Hi]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var s},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",s=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",r=t.color||"#6366f1",l=t.trainOpacity,a=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,h=t.trainUnderline;return t=>{const n=e(t),o=t[Hi];if("training"===o){let e=n.stroke;return"darken"===c?e=Ri(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=l&&{strokeOpacity:l})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===h&&(e=Fi(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}return"forecast"===o?Object.assign(Object.assign(Object.assign({},n),{stroke:r,strokeDasharray:s}),null!=a&&{strokeOpacity:a}):n}},darkenColor:Ri,lightenColor:Fi});exports.AreaChart=ci,exports.BubbleChart=gi,exports.CandlestickChart=Bi,exports.ConnectedScatterplot=fi,exports.Heatmap=pi,exports.LineChart=si,exports.MinimapChart=Oi,exports.MultiAxisLineChart=Li,exports.QuadrantChart=Mi,exports.Scatterplot=hi,exports.ScatterplotMatrix=ji,exports.StackedAreaChart=ui,exports.StreamXYFrame=$n,exports.XYCustomChart=Ti;
|