semiotic 3.4.1 → 3.4.2

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.
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{select as f}from"d3-selection";import{brushX as y,brushY as m,brush as v}from"d3-brush";import{scaleOrdinal as b,scaleLinear as x,scaleLog as k,scaleTime as w,scaleSequential as A}from"d3-scale";import{quadtree as O}from"d3-quadtree";import{schemeCategory10 as S,interpolatePlasma as j,interpolateViridis as C,interpolatePurples as M,interpolateOranges as _,interpolateGreens as P,interpolateReds as L,interpolateBlues as B,schemeSet3 as N,schemeTableau10 as T,interpolateTurbo as H,interpolateCividis as I,interpolateMagma as F,interpolateInferno as z,interpolateGreys as W}from"d3-scale-chromatic";import{bin as $}from"d3-array";import{packEnclose as D}from"d3-hierarchy";import{area as R,curveCatmullRom as E,curveCardinal as Y,curveBasis as G,curveStepBefore as q,curveStepAfter as X,curveStep as V,curveMonotoneY as U,curveMonotoneX as Q,curveLinear as K,line as J,curveNatural as Z}from"d3-shape";import ee from"regression";function te(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 ne(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 oe({width:t,height:n,totalWidth:o,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:p,snapDuring:b,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const O=i(u);O.current=u;const S=r(()=>p?[...p].sort((e,t)=>e-t):void 0,[p]),j=i(S);j.current=S;const C=i(!1),M=i(null);return s(()=>{if(!k.current)return;const e=f(k.current).select(".brush-g"),o="x"===c?y():"y"===c?m():v();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(C.current)return;const r=O.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],a=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&b)){const t=j.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[te(e[0],t),ne(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),a=r.x(s[1]);if(C.current=!0,"x"===c)e.call(o.move,[n,a]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[a,t[1][1]]])}C.current=!1}const l={x:s,y:a};M.current=l,A.current(l)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,g,h,b]),s(()=>{if(!(x&&u&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],n=f(k.current).select(".brush-g");if(t>=e.x[1])return C.current=!0,n.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=j.current;e&&e.length>0?o=ne(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return C.current=!0,n.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);i=!0}const r=u.x(o),s=u.x(e.x[1]);if(C.current=!0,"x"===c)n.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[s,o]])}if(C.current=!1,i){const t={x:[o,e.x[1]],y:e.y};M.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:o,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class ie{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(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(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){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function re(t){const n=a(null),o=se(t);return[function({children:o}){const i=r(()=>se(t),[]);return e(n.Provider,{value:i,children:o})},e=>{var t;const r=null!==(t=l(n))&&void 0!==t?t:o,s=i(e);s.current=e;const a=c(()=>s.current(r.getState()),[r]),d=c(()=>s.current(r.getState()),[r]);return u(r.subscribe,a,d)}]}function se(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function ae(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 le(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:ce})})),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 ce=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ue={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}},de={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}},he={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ce,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"},[ge,pe]=re(e=>({theme:ue,setTheme(t){e(e=>{if("light"===t)return{theme:ue};if("dark"===t)return{theme:de};if("high-contrast"===t)return{theme:he};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?de:ue;return{theme:le(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{theme:le(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));class fe{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 ye{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(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.isNaN(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 me(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function ve(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function be(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function xe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ke(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const we={category10:S,tableau10:T,set3:N,blues:B,reds:L,greens:P,oranges:_,purples:M,viridis:C,plasma:j},Ae=S,Oe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Se=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 je(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")||Se.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Ae[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+""))%Ae.length]}function Ce(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return b().domain(o).range(n).unknown("#999");const r=we[n]||we.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Ae;return b().domain(o).range(e).unknown("#999")}}function Me(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,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function _e(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}function Pe(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 Le(e,t,n){return e+(t-e)*n}function Be(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 Ne(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);null==e||null==r||Number.isNaN(e)||Number.isNaN(r)||s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function Te(e,t,n,o,i,r,s,a){const l=[];for(const r of e){const e=n(r),s=o(r);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[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 He(e,t,n,o,i,r,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function Ie(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 Fe(e,t,n,o,i,r,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function ze(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),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);o.push([a,t]),i.push([a,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 We(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 a=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=He(s,e.scales,e.getX,r,a,o,l);c&&n.push(c)}}}const $e={blues:B,reds:L,greens:P,viridis:C,oranges:_,purples:M,greys:W,plasma:j,inferno:z,magma:F,cividis:I,turbo:H},De=new Map;class Re{constructor(e){if(this.xExtent=new ye,this.yExtent=new ye,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.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new fe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=be(e.timeAccessor||e.xAccessor,"time"),this.getY=be(e.valueAccessor||e.yAccessor,"value")):(this.getX=be(e.xAccessor,"x"),this.getY=be(e.yAccessor,"y")),this.getGroup=ke(e.groupAccessor),this.getCategory=ke(e.categoryAccessor),this.getSize=e.sizeAccessor?be(e.sizeAccessor,"size"):void 0,this.getColor=ke(e.colorAccessor),this.getBounds=e.boundsAccessor?be(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?be(e.y0Accessor,"y0"):void 0,this.getPointId=ke(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?be(e.openAccessor,"open"):void 0,this.getHigh=be(e.highAccessor,"high"),this.getLow=be(e.lowAccessor,"low"),this.getClose=n?be(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new fe(e.windowSize))}ingest(e){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.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?be(this.config.timeAccessor||this.config.xAccessor,"time"):be(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)))}return!0}computeScene(e){var t,n,o,i,r,s,a;const{config:l,buffer:c}=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);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,p=l.yExtent?[null!==(i=l.yExtent[0])&&void 0!==i?i:h[0],null!==(r=l.yExtent[1])&&void 0!==r?r:h[1]]:h;const f=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!f&&c.size>0)if(l.normalize)p=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)p=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;let o=0;for(const e of t)for(const t of e.data){const e=this.getX(t),i=this.getY(t);if(null==e||null==i||Number.isNaN(e)||Number.isNaN(i))continue;const r=(n.get(e)||0)+i;n.set(e,r),r>o&&(o=r)}p=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:p}}}else if("bar"===l.chartType&&l.binSize&&!f&&c.size>0){const[,e]=function(e,t,n,o,i){const r=me(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]}(c,this.getX,this.getY,l.binSize,this.getCategory);p=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!f&&c.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]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;p=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!f&&p[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>p[1]&&(p[1]=t+n),p[0]>t-n&&(p[0]=t-n))}const e=p[1]-p[0],t=e>0?e*l.extentPadding:1,n=null===(s=l.yExtent)||void 0===s?void 0:s[0],o=null===(a=l.yExtent)||void 0===a?void 0:a[1];p=[null!=n?p[0]:p[0]-t,null!=o?p[1]:p[1]+t],"log"===l.yScaleType&&0>=p[0]&&h[0]>0&&(p[0]=null!=n?p[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];p[0]!==1/0&&p[1]!==-1/0||(p=[0,1]);const y="streaming"===l.runtimeMode,m=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(v=l.arrowOfTime)||"down"===v?"y":"x")){const t="right"===l.arrowOfTime?[m,e.width-m]:[e.width-m,m];this.scales={x:x().domain(g).range(t),y:x().domain(p).range([e.height-m,m])}}else{const t="down"===l.arrowOfTime?[m,e.height-m]:[e.height-m,m];this.scales={x:x().domain(p).range([m,e.width-m]),y:x().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(n):x().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[m,e.width-m]),y:t(l.yScaleType,p,[e.height-m,m])}}var v;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),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,Re.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=O().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;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(n):x().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:i}=this;if(!i||0===t.length)return[];const r={scales:i,config:o,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(o.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=ze(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ne(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 We(e,o,i),i}(r,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=Te(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 We(e,n,o),o}(r,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=Te(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=Ne(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 We(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:i,stackedTops:r}=function(e,t,n,o,i,r,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);null==t||null==r||Number.isNaN(t)||Number.isNaN(r)||e.set(t,(e.get(t)||0)+r)}u.set(t.key,e)}let d;if(r){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let i=e.get(n)||0;const s=p.get(n);r&&(i/=d.get(n));const c=s+i,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const f={type:"area",topPath:o,bottomPath:a,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(f.curve=s),h.push(f)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=i;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=r.get(o.key);if(n)for(const i of o.data){const o=e.getX(i),r=e.getY(i);null==o||Number.isNaN(o)||null==r||Number.isNaN(r)||!n.has(o)||t.set(i,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};We(e,n,s,o)}return s}(r,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 a=e.getColor?e.resolveColorMap(t):null,l=(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:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t=Object.assign(Object.assign({},t),{fill:a.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=He(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(r,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)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=be(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),p=(d-u||1)/s,f=(g-h||1)/a,y=s*a;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 l=Math.min(Math.floor((i-u)/p),s-1),d=Math.min(Math.floor((r-h)/f),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(o);v[g]+=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(l){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,A=n.height/a,O=e.config.showValues,S=e.config.heatmapValueFormat,j=[];for(let e=0;a>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(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;j.push(Fe(n*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o]},O?{value:i,showValues:!0,valueFormat:S}:void 0))}}return j}(e,t,n);if(0===t.length)return[];const o=be(e.config.valueAccessor,"value"),i=xe(e.config.xAccessor,"x"),r=xe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=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);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),f=g.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(f){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[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(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,g=b.get(h);let p;void 0!==g?p=g:(p=x++,b.set(h,p)),y[p]=h,m[p]=d,v[p]=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 A=function(e){const t=e in $e?e:"blues";let n=De.get(t);if(n)return n;n=Array(256);const o=$e[t]||B;for(let e=0;256>e;e++)n[e]=o(e/255);return De.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(w-k||1),S=n.width/u,j=n.height/d,C=e.config.showValues,M=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(Fe(o*S,(d-1-(n-o)/u)*j,S,j,A[Math.min((t-k)*O+.5|0,255)],v[e],C?{value:t,showValues:!0,valueFormat:M}:void 0))}return _}(r,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=me(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(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,p={};(null==u?void 0:u.stroke)&&(p.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(p.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(p.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=a.x(n),f=a.x(i),y=Math.abs(f-h),m=y>g+1?g:0,v=Math.min(h,f)+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 l=a.y(n),c=a.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(Ie(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},p),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=a.y(0),n=a.y(t.total);s.push(Ie(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},p),{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of i.values())f.add(e.start),f.add(e.end);return{nodes:s,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=null!==(n=r.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,p=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:p},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(r,t);case"waterfall":return function(e,t,n){var o,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return u;const p=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",f=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),O=d.y(s),S=Math.min(A,O),j=Math.abs(A-O),C={fill:0>r?f:p,stroke:m,strokeWidth:v};null!=b&&(C.opacity=b),u.push(Ie(k,S,w,j,C,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(r,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||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=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 a=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const p=h>=a,f={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:p,datum:n};i&&(f.isRange=!0),r.push(f)}return r}(r,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?_e(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 a=s.get(t[n]);null!=a?(o[n]=_e(e,a,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 a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=_e(e,o,r),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=_e(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 a=_e(e,t,r);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;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*a})}}}(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(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=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 a=Pe(e,r,s);a>i&&(i=a)}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Pe(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=a,n._pulseGlowRadius=l)}}(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,a;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Be(e,c,l);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===(a=c.style)||void 0===a?void 0:a.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=Be(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,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,C,M,_,P,L,B,N,T,H,I,F,z,W,$,D,R,E,Y,G;if(0===o.size&&0===i.size)return n;const q=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 X=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=Be(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]];X=!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]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l: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}),X=!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!==(d=L.r)&&void 0!==d?d:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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!==(g=r.style.opacity)&&void 0!==g?g: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!==(p=L.w)&&void 0!==p?p:r.w,r.h=null!==(f=L.h)&&void 0!==f?f:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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,X=!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}),X=!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!==(O=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==O?O:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(j=L.highY)&&void 0!==j?j:r.highY,r.lowY=null!==(C=L.lowY)&&void 0!==C?C:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(M=r.style)||void 0===M?void 0:M.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!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),X=!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),X=!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!==(N=t.opacity)&&void 0!==N?N: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!==(T=t.w)&&void 0!==T?T:0,h:null!==(H=t.h)&&void 0!==H?H:0,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I: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!==(F=t.w)&&void 0!==F?F:0,h:null!==(z=t.h)&&void 0!==z?z:0,fill:"#999",datum:null,style:{opacity:null!==(W=t.opacity)&&void 0!==W?W:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==($=t.openY)&&void 0!==$?$:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(D=t.closeY)&&void 0!==D?D:o,highY:null!==(R=t.highY)&&void 0!==R?R: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)}X=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),X&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:q}),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,a,l,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Le(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Le(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Le(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Le(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Le(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Le(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Le(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Le(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Le(t[o][0],n[o][0],d),e.path[o][1]=Le(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Le(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Le(t[n][0],o[n][0],d),e.topPath[n][1]=Le(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Le(n[t][0],i[t][0],d),e.bottomPath[t][1]=Le(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}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||Oe,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)||Oe;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Re.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.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||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!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 l=a||!ve(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),c=a||!ve(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=be(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=be(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=be(this.config.xAccessor,"x"),this.getY=be(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!ve(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ke(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!ve(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ke(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!ve(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?be(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!ve(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ke(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!ve(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?be(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!ve(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ke(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!ve(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!ve(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!ve(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!ve(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?be(this.config.openAccessor,"open"):void 0,this.getHigh=be(this.config.highAccessor,"high"),this.getLow=be(this.config.lowAccessor,"low"),this.getClose=t?be(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!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&&(this.needsFullRebuild=!0)}}function Ee(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 Ye(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ge(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function qe(e,t){const n=Ge(e);if(!n)return!1;const o=Ge(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function Xe(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,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);Ye(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}: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=Ue(r,t,n,o);break;case"line":e=Qe(r,t,n,o);break;case"rect":e=Je(r,t,n);break;case"heatcell":e=Ze(r,t,n);break;case"area":if(!1===r.interactive)break;e=tt(r,t,n);break;case"candlestick":e=et(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ve(e,t,n){if(0===e.length)return null;const o=nt(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,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Ue(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Ye(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Qe(e,t,n,o=30){var i,r,s,a;if(0===e.path.length)return null;const l=nt(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const i=Math.max(0,l-1),r=Math.min(e.path.length-2,l);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=Ke(t,n,i,r,a,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(a=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!==a?a:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function Ke(e,t,n,o,i,r){const s=i-n,a=r-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Je(e,t,n){const o=Ee(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ze(e,t,n){const o=Ee(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function et(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 tt(e,t,n){if(0===e.topPath.length)return null;const o=nt(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,a=n-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function nt(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 ot(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 it(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}Re.GROUP_COLOR_MAP_CAP=1e3,Re.QUADTREE_THRESHOLD=500;const rt={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function st(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,rt[n])(o(e,t)),i}function at(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function lt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ct=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,f=[];let y=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=st(n,d,h,g),x=lt(n,r,s),k=s&&s.size>0&&s.has(n.label);f.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?k||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(at,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),f};function ut({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function dt(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,f]=o.useState(0),[y,m]=o.useState(0),v=o.useCallback((e,t)=>{f(e),m(t)},[]),b="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:ct(t,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let f=0;n.label&&(f+=16);const y=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:f}=n,y=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;f.forEach((n,d)=>{const k=st(n,d,g,p),w=lt(n,r,s),A=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),y.push(t("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+f.length)%f.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(at,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let k=0,w=0;for(const e of f){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const A=v+1;return{items:y,offset:k,totalRows:A,totalHeight:22*A}})(n,r,s,a,l,c,u,o,d,h,i);f+=y.offset+5,p.push(Object.assign(Object.assign({label:n.label},y),{offset:f,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=f+12});let f=g>i?0:Math.max(0,(i-g)/2);const y=[];return p.forEach((t,i)=>{const r=n[i];r.label&&(y.push(e("text",{transform:`translate(${f},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)),f+=16),y.push(e("g",{className:"legend-item",transform:`translate(${f},0)`,children:t.items},"legend-group-"+i)),f+=t.offset+5,n[i+1]&&y.push(e("line",{stroke:"gray",x1:f,y1:-8,x2:f,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),f+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function ht(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function gt(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,f;return"left"===s?(p=4,f=r.top):"top"===s?(p=0,f=a?32:8):"bottom"===s?(p=0,f=i-r.bottom+50):(p=o-r.right+10,f=r.top),e("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(ut,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):ht(n)?e(dt,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function pt(e){return"string"==typeof e?{type:e}:e}function ft({orient:n,config:o,values:i,scale:s,size:a,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=s.domain(),r=a-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=o,p=Math.min(.5*r,20),f=(r-p)/2+4;if(u){const o=s(a),i=s(d),r=s(l),u=s(h),y=s(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(f+p/2),x2:y,y2:v+m*(f+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*f,x2:u,y2:v+m*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*f,x2:y,y2:v+m*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-f-p:v+f,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-f-p:v+f,x2:r,y2:"top"===n?v-f:v+f+p,stroke:c.fill,strokeWidth:2})]})}{const o=s(a),i=s(d),r=s(l),u=s(h),y=s(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(f+p/2),y1:u,x2:v+m*(f+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*f,y1:u,x2:v+m*(f+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*f,y1:y,x2:v+m*(f+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-f-p:v+f,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-f-p:v+f,y1:r,x2:"left"===n?v-f:v+f+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=$().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);o.push(u?`${a},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${a}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);o.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function yt(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 mt(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 vt(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const f=16,y=a?d?[a]:yt(a,u):[],m=s?d?[s]:yt(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:f,children:t},n))},"annotation-note-title")),b=y.length*f),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:f,children:t},n))},"annotation-note-label"));let w=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*f+(m.length>0?f:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*f;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+f+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function bt(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.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;a.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:mt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function xt(t,n,o,i,r,s){const a=[];let l=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,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=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);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e("line",{x1:l,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-l);a.push(e("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+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("g",{className:"annotation-connector",children:a})}function kt(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=e,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"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 t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&xt(v,b,c,h,x,u),!m.has("subject")&&bt(x,u,h,n,o),!m.has("note")&&vt(l,v,b,h)]}))}function wt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e(kt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(kt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function At(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 Ot(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 St(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){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 a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=At(e,n),c=Ot(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function jt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ct={linear:K,monotoneX:Q,monotoneY:U,step:V,stepAfter:X,stepBefore:q,basis:G,cardinal:Y,catmullRom:E};let Mt={positions:new Map};const _t=new Set;function Pt(){for(const e of _t)e()}function Lt(e,t){const n=Mt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Mt.positions);o.delete(e),Mt={positions:o},Pt()}function Bt(e,t){const n=Mt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Mt.positions);o.delete(e),Mt={positions:o},Pt()}function Nt(){return Mt}function Tt(e){return _t.add(e),()=>_t.delete(e)}const Ht={positions:new Map};function It(){return()=>{}}function Ft(){return Ht}function zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Wt(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 $t(n){const{width:o,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:p}=n,f=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||g||Dt,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=c.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:c.x(e),label:n(e,t,s)})),l=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Rt(a,Math.max(55,l+8))},[c,d,g,o]),y=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||p||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Rt(c.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:c.y(e),label:n(e)})),22)},[c,d,p,i]),m=h&&c,v=u&&c;if(!m&&!v)return null;const b=null==d?void 0:d.find(e=>"bottom"===e.orient),x=null==d?void 0:d.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,O=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[m&&(()=>{var n,r;const s=zt(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),a=zt(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[f.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),y.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+n))]})})(),k&&!A&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:S,strokeWidth:1}),A&&e("path",{d:Wt("bottom",o,i),fill:"none",stroke:S,strokeWidth:1}),w&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),O&&e("path",{d:Wt("left",o,i),fill:"none",stroke:S,strokeWidth:1})]})})}function Dt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Rt(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 Et(o){var a,l;const{width:c,height:d,totalWidth:h,totalHeight:g,margin:p,scales:f,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:A,title:O,legend:S,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,legendPosition:P="right",foregroundGraphics:L,marginalGraphics:B,xValues:N,yValues:T,annotations:H,svgAnnotationRules:I,xAccessor:F,yAccessor:z,annotationData:W,pointNodes:$,curve:E,underlayRendered:Y,linkedCrosshairName:G,linkedCrosshairSourceId:q,children:X}=o,V=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||k||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=f.x.ticks(Math.min(o,Math.max(2,Math.floor(c/70)))),r=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:f.x(e),label:n(e,t,r)})),a=s.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),l=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Rt(s,l);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=f.x.domain()[1],t=f.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,r);l>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[y,f,m,k,c]),U=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||w||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=Rt(f.y.ticks(Math.min(o,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:f.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=f.y.domain()[1],t=f.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},[y,f,m,w,d]),Q=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||w||Dt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Rt(f.y.ticks(Math.min(o,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:f.y(e),label:n(e)})),22)},[y,f,m,w,d]),J=i(new Map),Z=i(null!==(a=null==H?void 0:H.length)&&void 0!==a?a:0),te=null!==(l=null==H?void 0:H.length)&&void 0!==l?l:0;Z.current!==te&&(Z.current=te,J.current=new Map);const ne=r(()=>{if(!H||0===H.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,C,M,_,P,L,B,N,T,H,I,F,z,W,$,E,Y,G,q,X,V,U,Q,J,Z,te,ne;switch(n.type){case"label":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return jt(r,s,i)?e(wt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return jt(r,s,i)?e(wt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=At(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ot(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:At(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ot(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=D(r),a=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:At(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ot(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=At(t,i),a=Ot(t,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=At(n,i),r=Ot(n,i);return e(wt,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",f=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const v=n.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)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=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===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?ee.polynomial(f,{order:n.order||2}):ee.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(f=null==r?void 0:r(n.y0))&&void 0!==f?f:0,a=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ct[i.curve||"linear"]||K,p=R().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const f=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:f,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(j=i.scales)||void 0===j?void 0:j.time,l=null!==(M=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==M?M:null===(_=i.scales)||void 0===_?void 0:_.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,f=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(B=n.anomalyRadius)&&void 0!==B?B:6,x=l(u+g*h),k=l(p),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[f&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=At(t,i),r=Ot(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(T=null===(N=i.scales)||void 0===N?void 0:N.x)&&void 0!==T?T:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(F=null===(I=i.scales)||void 0===I?void 0:I.y)&&void 0!==F?F:null===(z=i.scales)||void 0===z?void 0:z.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=ee.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),f=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(W=n.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==($=n.steps)&&void 0!==$?$:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-f,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(d(x))}`,C=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e("polyline",{points:`${j} ${S}`,fill:"none",stroke:C,strokeWidth:null!==(Y=n.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:C,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=St(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!jt(t,r,i))return null;const s=null!==(q=n.dx)&&void 0!==q?q:0,a=null!==(X=n.dy)&&void 0!==X?X:0,l=null!==(V=n.width)&&void 0!==V?V:32,c=null!==(U=n.height)&&void 0!==U?U:32,u=null!==(Q=n.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(Z=i.scales)||void 0===Z?void 0:Z.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:c===a)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:f?{x:f.x,y:f.y,time:f.x,value:f.y}:null,timeAxis:"x",xAccessor:F,yAccessor:z,width:c,height:d,data:W,frameType:"xy",pointNodes:$,curve:E,stickyPositionCache:J.current};return H.map((e,t)=>{if(I){const i=I(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[H,I,c,d,F,z,W,f,$,E]),oe=function(e){var t;const n=u(e?Tt:It,e?Nt:Ft,e?Nt:Ft);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(G);return s(()=>{if(!(null==oe?void 0:oe.locked)||!G)return;const e=e=>{"Escape"===e.key&&Bt(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,G]),y||O||S||L||B||ne&&ne.length>0||A||X||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[A&&f&&!Y&&(()=>{var n,o;const i=zt(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=zt(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[V.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),U.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&f&&(()=>{const o=null==m?void 0:m.find(e=>"left"===e.orient),i=null==m?void 0:m.find(e=>"bottom"===e.orient),r=!o||!1!==o.baseline,s=!i||!1!==i.baseline,a=(null==o?void 0:o.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,u=null==i?void 0:i.landmarkTicks,h=null==o?void 0:o.landmarkTicks,g="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&V.length>1&&(()=>{const e=c/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!Y&&s&&!l&&e("line",{x1:0,y1:d,x2:c,y2:d,stroke:g,strokeWidth:1}),!Y&&l&&e("path",{d:Wt("bottom",c,d),fill:"none",stroke:g,strokeWidth:1}),V.map((n,o)=>{const i=!!u&&("function"==typeof u?u(n.value,o):qe(n.value,o>0?V[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:c/2,y:d+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:v}),!Y&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:g,strokeWidth:1}),!Y&&a&&e("path",{d:Wt("left",c,d),fill:"none",stroke:g,strokeWidth:1}),U.map((n,o)=>{const i=!!h&&("function"==typeof h?h(n.value,o):qe(n.value,o>0?U[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-p.left,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${d/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o||0===Q.length)return null;const i=o.landmarkTicks,r=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:c,y1:0,x2:c,y2:d,stroke:g,strokeWidth:1}),Q.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):qe(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:f,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+p.right-15}, ${d/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),ne,B&&f&&N&&T&&t(n,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(ft,{orient:"top",config:pt(B.top),values:N,scale:f.x,size:p.top,length:c})}),B.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(ft,{orient:"bottom",config:pt(B.bottom),values:N,scale:f.x,size:p.bottom,length:c})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(ft,{orient:"left",config:pt(B.left),values:T,scale:f.y,size:p.left,length:d})}),B.right&&e("g",{transform:`translate(${c}, 0)`,children:e(ft,{orient:"right",config:pt(B.right),values:T,scale:f.y,size:p.right,length:d})})]}),L,oe&&oe.sourceId!==q&&(null==f?void 0:f.x)&&(()=>{const t=f.x(oe.xValue);if(null==t||0>t||t>c)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,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"})})(),X]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof O?O:null}),gt({legend:S,totalWidth:h,totalHeight:g,margin:p,legendPosition:P,title:O,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_})]}):null}function Yt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Gt="undefined"==typeof window||"undefined"==typeof document,qt=o.createContext(null),Xt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Vt(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 Ut=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"},Kt={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)"},Zt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},en={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)"},tn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},nn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function on({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(qt),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,f=o.useCallback(()=>{l||d||c(!0)},[l,d]),y=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Xt}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:f,style:Xt,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":j.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=C.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=C.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(p=C.cy)&&void 0!==p?p:C.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(f=C.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=C.cx)&&void 0!==m?m:C.x,y:null!==(v=C.cy)&&void 0!==v?v:C.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=C.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=C.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(n),v=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}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ut(e.min)} to ${Ut(e.max)}, mean ${Ut(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(" ")}(m.length,v),x=m.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:Qt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Jt,children:"×"}),e("div",{role:"note",style:Kt,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Zt,children:[t("caption",{style:nn,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:en,children:"type"}),w.map(t=>e("th",{style:en,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:tn,children:n.label}),w.map(t=>{return e("td",{style:tn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ut(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function rn({summary:t}){return t?e("div",{role:"note",style:Xt,children:t}):null}function sn({tableId:t}){return e("a",{href:"#"+t,style:Xt,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,Xt)},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("div",{"aria-live":"polite","aria-atomic":"true",style:Xt,children:n})}const ln="var(--semiotic-focus, #005fcc)";function cn({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:ln,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:ln,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ln,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function un({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.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})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function dn(e,t,n){const o=i(null),[r,a]=d(null);return s(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const hn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,gn=new WeakMap;let pn=0,fn=!1,yn=null,mn=null,vn=null;function bn(e,t){var n,o;if(!t)return t;const i=hn.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(fn)return;if("undefined"==typeof window||"undefined"==typeof document)return;fn=!0;const e=()=>{pn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(yn=new MutationObserver(e),yn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{mn=window.matchMedia("(prefers-color-scheme: dark)"),vn=e,"function"==typeof mn.addEventListener?mn.addEventListener("change",vn):"function"==typeof mn.addListener&&mn.addListener(vn)}catch(e){}}();let s=gn.get(r);s&&s.version===pn||(s={version:pn,map:new Map},gn.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function xn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function kn(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[a,l]=dn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=xn(e.foregroundGraphics,l,u),f=xn(e.backgroundGraphics,l,u),y=pe(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=c(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),O=i(()=>{}),S=i(null),j=i(0),C=c(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),M=c(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(C))},[C]),_=c(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);s(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return s(()=>{P&&(pn++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:_}}function wn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),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 An(e){switch(e){case"monotoneX":return Q;case"monotoneY":return U;case"cardinal":return Y;case"catmullRom":return E;case"step":return V;case"stepBefore":return q;case"stepAfter":return X;case"basis":return G;case"natural":return Z;default:return null}}function On(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 Sn(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 a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,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;l>o&&(r*=o/l),l>a-o&&(r*=(a-o)/l),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 jn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",u=bn(e,c)||c,d=a.style.strokeWidth||2,h=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 m=null!==(i=a.style.opacity)&&void 0!==i?i:1;Sn(e,a.path,u,d,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=An(a.curve),f=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!f){e.strokeStyle=u;const v=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(f){let x=null,k=null,w=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function j(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[M,_]=a.path[C],P=g[C],L=On(P,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,_);else{const B=[];for(const N of h){const T=N.value;(w>T||T>P)&&(T>w||P>T)||w===T||P===T||B.push({t:(T-w)/(P-w)})}B.sort((e,t)=>e.t-t.t);for(const H of B){const I=x+(M-x)*H.t,F=k+(_-k)*H.t,z=On(w+(P-w)*Math.min(H.t+1e-4,1),h,u);e.lineTo(I,F),j(),S(z,I,F)}e.lineTo(M,_)}x=M,k=_,w=P,A=L}else S(L,M,_),x=M,k=_,w=P,A=L}j()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=u;else{const W=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const $ of a.strokeGradient.colorStops)W.addColorStop(Math.max(0,Math.min(1,$.offset)),$.color);e.strokeStyle=W}if(p)J().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[D,R]=a.path[0];e.moveTo(D,R);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=("string"==typeof a.style.fill?bn(e,a.style.fill):a.style.fill)||a.style.fill,p&&!f)J().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][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!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Cn(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]}function Mn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function _n(e,t,n=.3){Mn(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 Pn(e,t,n=.6){var o,i,r,s,a;if(!Mn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ln(e,t,n,o=.35){Mn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Bn(e){switch(e){case"monotoneX":return Q;case"monotoneY":return U;case"cardinal":return Y;case"catmullRom":return E;case"step":return V;case"stepBefore":return q;case"stepAfter":return X;case"basis":return G;case"natural":return Z;default:return null}}function Nn(e,t){const n=Bn(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().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 Tn=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const a=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[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=bn(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*(l[n]+l[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 c=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Nn(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=e.createLinearGradient(0,n,0,o);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const[n,o,r]=Cn(e,"string"==typeof a?a:"#4e79a7");i.addColorStop(0,`rgba(${n},${o},${r},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${n},${o},${r},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=c}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*c,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Nn(e,t),Ln(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=c,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Bn(t.curve);if(e.beginPath(),n)J().x(e=>e[0]).y(e=>e[1]).curve(n).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!==n&&1>n&&e.restore(),e.globalAlpha=1}},Hn=(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=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?bn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Pn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function In(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=Cn(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const Fn=(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)zn(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||bn(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?In(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||bn(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?In(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}_n(e,t),e.globalAlpha=1}};function zn(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 Wn(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function $n(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 Dn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function En(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`${Rn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Rn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Yn={line:[Tn,jn,Hn],area:[Tn,Hn],stackedarea:[Tn,Hn],scatter:[Hn],bubble:[Hn],heatmap:[(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=bn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),_n(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):Dn(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=$n(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}}],bar:[Fn],swarm:[Hn],waterfall:[(e,t,n,o)=>{var i,r,s;Fn(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=bn(e,c)||c,e.lineWidth=null!==(i=null==l?void 0:l._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],i=a[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 l=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const a=(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!==a&&(e.globalAlpha=a);const l=bn(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,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=bn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}}],mixed:[Tn,jn,Hn]},Gn={top:20,right:20,bottom:30,left:40},qn={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 Xn(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 Vn={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 Un({hover:n}){const o=e=>Number.isInteger(e)?e+"":e.toFixed(2);return t("div",{className:"semiotic-tooltip",style:Vn,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:o(n.value)}),e("div",{style:{opacity:.7,fontSize:11},children:o(n.time)})]})}const Qn=h(function(n,a){var l,u,h,p,f,y,m,v,b,x,k;const{chartType:w,runtimeMode:A,data:O,chunkThreshold:S,chunkSize:j,xAccessor:C,yAccessor:M,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:B,curve:N,normalize:T,binSize:H,valueAccessor:I,arrowOfTime:F="right",windowMode:z="sliding",windowSize:W=200,timeAccessor:$,xExtent:D,yExtent:R,extentPadding:E=.1,scalePadding:Y,sizeRange:G,size:q=[500,300],responsiveWidth:X,responsiveHeight:V,margin:U,className:Q,background:K,lineStyle:J,pointStyle:Z,areaStyle:ee,barStyle:te,waterfallStyle:ne,swarmStyle:re,barColors:se,colorScheme:le,boundsAccessor:ce,boundsStyle:ue,y0Accessor:de,gradientFill:he,lineGradient:ge,areaGroups:pe,openAccessor:fe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:Se,yFormat:je,tickFormatTime:Ce,tickFormatValue:Me,hoverAnnotation:_e,tooltipContent:Pe,customHoverBehavior:Le,customClickBehavior:Be,enableHover:Ne,hoverRadius:Te=30,tooltipMode:He,annotations:Ie,svgAnnotationRules:Fe,showGrid:ze,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,backgroundGraphics:qe,foregroundGraphics:Ue,canvasPreRenderers:Qe,svgPreRenderers:Ke,title:Je,categoryAccessor:Ze,brush:et,onBrush:tt,decay:rt,pulse:st,transition:at,animate:lt,staleness:ct,heatmapAggregation:ut,heatmapXBins:dt,heatmapYBins:ht,showValues:gt,heatmapValueFormat:pt,marginalGraphics:ft,pointIdAccessor:yt,xScaleType:mt,yScaleType:vt,accessibleTable:bt=!0,description:xt,summary:kt,linkedCrosshairName:wt,linkedCrosshairSourceId:At}=n,Ot=i(!1),St=kn({sizeProp:q,responsiveWidth:X,responsiveHeight:V,userMargin:U,marginDefault:Gn,animate:lt,transitionProp:at,themeDirtyRef:Ot}),{reducedMotionRef:jt,responsiveRef:Ct,size:Mt,currentTheme:_t,transition:Pt,introEnabled:Lt,tableId:Bt,rafRef:Nt,renderFnRef:Tt,scheduleRender:Ht}=St;let It=St.margin;if(ft){const e=60,t=Object.assign({},St.margin);ft.top&&e>t.top&&(t.top=e),ft.bottom&&e>t.bottom&&(t.bottom=e),ft.left&&e>t.left&&(t.left=e),ft.right&&e>t.right&&(t.right=e),It=t}const Ft="function"==typeof Ue?Ue({size:Mt,margin:It}):Ue,zt="function"==typeof qe?qe({size:Mt,margin:It}):qe,Wt=Mt[0]-It.left-It.right,Dt=Mt[1]-It.top-It.bottom,Rt=null!=_e?_e:Ne,qt=i(null),Xt=i(null),[Ut,Qt]=d(0),[Kt,Jt]=d(null),Zt=i(null),en=i(null),[tn,nn]=d(null),ln=i(qn.primary),[dn,hn]=d(!1),[gn,pn]=d([]),[fn,yn]=d([]),mn="streaming"===A||["bar","swarm","waterfall"].includes(w),vn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:mn?"streaming":"bounded",windowSize:W,windowMode:z,arrowOfTime:mn?F:"right",extentPadding:E,scalePadding:Y,xAccessor:mn?void 0:C,yAccessor:mn?void 0:M,timeAccessor:mn?$:void 0,valueAccessor:I,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(B?"_lineGroup":void 0),categoryAccessor:Ze,lineDataAccessor:B,xScaleType:mt,yScaleType:vt,xExtent:D,yExtent:R,sizeRange:G,binSize:H,normalize:T,boundsAccessor:ce,boundsStyle:ue,y0Accessor:de,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:pe?new Set(pe):void 0,lineGradient:ge,openAccessor:fe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,lineStyle:J,pointStyle:Z,areaStyle:ee,swarmStyle:re,waterfallStyle:ne,colorScheme:le,barColors:se,barStyle:te,annotations:Ie,decay:rt,pulse:st,transition:Pt,introAnimation:Lt,staleness:ct,heatmapAggregation:ut,heatmapXBins:dt,heatmapYBins:ht,showValues:gt,heatmapValueFormat:pt,pointIdAccessor:yt,curve:N,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:ae(_t),themeSequential:null===(t=null==_t?void 0:_t.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==_t?void 0:_t.colors)||void 0===n?void 0:n.diverging}},[w,W,z,F,E,Y,C,M,$,I,mt,vt,_,P,L,Ze,B,D,R,G,H,T,ce,ue,de,he,ge,pe,fe,ye,me,ve,be,J,Z,ee,re,ne,te,le,se,Ie,rt,st,null==Pt?void 0:Pt.duration,null==Pt?void 0:Pt.easing,Lt,ct,ut,dt,ht,gt,pt,mn,yt,N,_t]),bn=i(null);bn.current||(bn.current=new Re(vn)),s(()=>{var e;null===(e=bn.current)||void 0===e||e.updateConfig(vn),Ot.current=!0,Ht()},[vn,Ht]);const xn=i(null);xn.current||(xn.current=new ie(e=>{const t=bn.current;t&&t.ingest(e)&&(Ot.current=!0,Ht())},{chunkThreshold:S,chunkSize:j})),s(()=>{var e;null===(e=xn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:S,chunkSize:j})},[S,j]);const An=c(e=>{var t;null===(t=xn.current)||void 0===t||t.push(e)},[]),On=c(e=>{var t;null===(t=xn.current)||void 0===t||t.pushMany(e)},[]),Sn=c(()=>{var e,t;null===(e=xn.current)||void 0===e||e.clear(),null===(t=bn.current)||void 0===t||t.clear(),Ot.current=!0,Ht()},[Ht]);g(a,()=>({push:An,pushMany:On,remove:e=>{var t,n,o;null===(t=xn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=bn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(Zt.current&&i.some(e=>{var t;return e===(null===(t=Zt.current)||void 0===t?void 0:t.data)})&&(Zt.current=null,nn(null)),Ot.current=!0,Ht()),i},update:(e,t)=>{var n,o,i;null===(n=xn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=bn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ht()),r},clear:Sn,getData:()=>{var e,t,n;return null===(e=xn.current)||void 0===e||e.flush(),null!==(n=null===(t=bn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=bn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=bn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[An,On,Sn,Ht]),s(()=>{var e,t;if(O){if(B&&O.length>0&&"object"==typeof O[0]&&null!==O[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(O[0][t])){const n=[];for(const e of O){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=xn.current)||void 0===e||e.setBoundedData(n))}}null===(t=xn.current)||void 0===t||t.setBoundedData(O)}},[O,B]);const{hoverHandlerRef:jn,hoverLeaveRef:Cn,onPointerMove:Mn,onPointerLeave:_n}=St;jn.current=e=>{if(!Rt)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-It.left,i=e.clientY-n.top-It.top;if(0>o||o>Wt||0>i||i>Dt)return void(Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&(Le(null),Ot.current=!0),Ht()));const r=bn.current;if(!r||0===r.scene.length)return;const s=Xe(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);if(!s)return void(Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&Le(null),Ht()));const a=Wn(s.datum||{},s.x,s.y);if("multi"===He&&r.scene.length>0&&r.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=Ve(e.path,t,n);if(null===r)continue;const s=nt(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=Ve(e.topPath,t,n);if(null===r)continue;const s=nt(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:r,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(r.scene,s.x,Te),t=r.scales.y.invert,n=r.scales.x.invert;if(e.length>0){const o=n?n(s.x):s.x;a.xValue=o,a.xPx=s.x;const i=ln.current;a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||i,datum:e.datum}))}}Zt.current=a,en.current=s.node,nn(a),Le&&(Le(a),Ot.current=!0),Ht()},Cn.current=()=>{Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&(Le(null),Ot.current=!0),Ht())};const Pn=i(()=>{});Pn.current=e=>{if(!Be)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-It.left,i=e.clientY-n.top-It.top;if(0>o||o>Wt||0>i||i>Dt)return void Be(null);const r=bn.current;if(!r||0===r.scene.length)return void Be(null);const s=Xe(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);Be(s?Wn(s.datum||{},s.x,s.y):null)};const Ln=c(e=>Pn.current(e),[]),Bn=i(-1),Nn=i(null),Tn=i(null),Hn=c(e=>{const t=bn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Tn.current&&Tn.current.version===n)o=Tn.current.graph;else{const e=function(e){var t,n,o,i;const r=[];for(const s of e)switch(s.type){case"point":r.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(t=s.group)&&void 0!==t?t:"_default"});break;case"line":{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.path.length>n&&t.length>n;n++)r.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=s,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)r.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":r.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!==(i=s.group)&&void 0!==i?i:"_default"});break;case"heatcell":r.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 r.sort((e,t)=>e.x-t.x||e.y-t.y),r}(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),Tn.current={version:n,graph:o}}const i=Bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Bn.current=0;const t=o.flat[0];Nn.current={shape:t.shape,w:t.w,h:t.h};const n=it(t);return Zt.current=n,nn(n),Le&&Le(n),void Ht()}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?ot(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ot(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 Bn.current=-1,Nn.current=null,Zt.current=null,en.current=null,nn(null),Le&&Le(null),void Ht();Bn.current=s;const a=o.flat[s];Nn.current={shape:a.shape,w:a.w,h:a.h};const l=it(a);Zt.current=l,nn(l),Le&&Le(l),Ht()},[Le,Ht]),In=c(e=>{Bn.current=-1,Nn.current=null,Mn(e)},[Mn]);Tt.current=()=>{var e,t;Nt.current=0;const n=qt.current,o=Xt.current;if(!n||!o)return;const i=bn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(jt.current?r+1e6:r),a=!jt.current&&s,l=Ot.current||s;l&&!a&&i.computeScene({width:Wt,height:Dt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return qn;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(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||r?{axisStroke:l||qn.axisStroke,tickText:s||qn.tickText,crosshair:s?Xn(s,"66"):qn.crosshair,hoverFill:c?Xn(c,"4D"):qn.hoverFill,hoverStroke:s?Xn(s,"99"):qn.hoverStroke,pointRing:c||qn.pointRing,primary:r||qn.primary}:qn}(n);ln.current=u.primary;const d=null!==(e=null==ct?void 0:ct.threshold)&&void 0!==e?e:5e3,h=ct&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=wn(n,Mt,It,c);if(e){if(e.clearRect(-It.left,-It.top,Mt[0],Mt[1]),h&&(e.globalAlpha=null!==(t=null==ct?void 0:ct.dimOpacity)&&void 0!==t?t:.5),"transparent"!==K&&!qe){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=K||(t&&"transparent"!==t?t:null);o&&(e.fillStyle=o,e.fillRect(-It.left,-It.top,Mt[0],Mt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Wt,Dt),e.clip()),Qe&&i.scales)for(const t of Qe)e.save(),t(e,i.scene,i.scales,{width:Wt,height:Dt}),e.restore();const o=Yn[w];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:Wt,height:Dt});e.restore(),h&&(e.globalAlpha=1)}}{const e=wn(o,Mt,It,c);if(e&&(e.clearRect(-It.left,-It.top,Mt[0],Mt[1]),Rt&&Zt.current&&i.scales&&function(e,t,n,o,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)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,Zt.current,Wt,Dt,"object"==typeof Rt?Rt:{},en.current,u),en.current&&Array.isArray(_e))){const t=_e.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?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,en.current,t,u)}}l&&n&&n.setAttribute("aria-label",Vt(i.scene,w+" chart"));const g=Ot.current;if(Ot.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Kt||e(Kt.x.domain()[0])!==e(i.scales.x.domain()[0])||e(Kt.x.domain()[1])!==e(i.scales.x.domain()[1])||e(Kt.y.domain()[0])!==e(i.scales.y.domain()[0])||e(Kt.y.domain()[1])!==e(i.scales.y.domain()[1])||Kt.x.range()[0]!==i.scales.x.range()[0]||Kt.x.range()[1]!==i.scales.x.range()[1]||Kt.y.range()[0]!==i.scales.y.range()[0]||Kt.y.range()[1]!==i.scales.y.range()[1])&&Jt(i.scales),ft){const e=i.getData(),t="function"==typeof C?C:e=>e[C||"x"],n="function"==typeof M?M:e=>e[M||"y"];pn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),yn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ie&&Ie.length>0&&Qt(e=>e+1),(null==ct?void 0:ct.showBadge)&&hn(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Tt.current()))},s(()=>(Ht(),()=>{var e;null===(e=xn.current)||void 0===e||e.clear()}),[Ht]),s(()=>{Ot.current=!0,Ht()},[w,Wt,Dt,xe,K,J,Qe,Ht]),function(e,t,n,o,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=l-a.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,i,o])}(ct,bn,Ot,Ht,dn,hn);const Fn=r(()=>{if(Se||Ce)return;const e=bn.current;return(null==e?void 0:e.xIsDate)&&Kt?En(Kt.x.domain()):void 0},[Se,Ce,Kt]),zn=Se||Ce||Fn,$n=Rt&&tn?Pe?Pe(tn):e(Un,{hover:tn}):null,Dn=$n?e(un,{x:tn.x,y:tn.y,containerWidth:Wt,containerHeight:Dt,margin:It,className:"stream-frame-tooltip",children:$n}):null,Rn=Nn.current,Vn=e(cn,{active:Bn.current>=0,hoverPoint:tn,margin:It,size:Mt,shape:null==Rn?void 0:Rn.shape,width:null==Rn?void 0:Rn.w,height:null==Rn?void 0:Rn.h}),Qn=(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},Kn=Qn(C,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),Jn=Qn(M,I,"__semiotic_resolvedY","__semiotic_resolvedValue"),Zn=Kn.key,eo=Jn.key,to=Ie&&Ie.length>0,no=e=>{if(!e||!to||!Kn.fn&&!Jn.fn)return e;let t=!1;const n=e.map(e=>{const n=Kn.fn&&Kn.key&&!(Kn.key in e),o=Jn.fn&&Jn.key&&!(Jn.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[Kn.key]=Kn.fn(e)),o&&(i[Jn.key]=Jn.fn(e)),i});return t?n:e};if(Gt){const n=bn.current;n&&O&&(n.ingest({inserts:O,bounded:!0}),n.computeScene({width:Wt,height:Dt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s=zn||(()=>{if((null==n?void 0:n.xIsDate)&&r)return En(r.x.domain())})();return t("div",{className:"stream-xy-frame"+(Q?" "+Q:""),role:"img","aria-label":xt||("string"==typeof Je?Je:"XY chart"),style:{position:"relative",width:Mt[0],height:Mt[1]},children:[e(rn,{summary:kt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${It.left},${It.top})`,children:zt}),t("g",{transform:`translate(${It.left},${It.top})`,children:[K&&e("rect",{x:0,y:0,width:Wt,height:Dt,fill:K}),Ke&&r&&Ke.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:Wt,height:Dt})},"svgpre-"+n)),i.map((n,o)=>function(n,o){var i,r,s;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const t=n;if(0===t.topPath.length)return null;const s=t.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...t.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:`M${s}L${a}Z`,fill:Yt(t.style.fill),fillOpacity:null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.7,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Yt(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Yt(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o)).filter(Boolean)]})]}),e(Et,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:r,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:s,yFormat:je||Me,showGrid:ze,title:Je,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,foregroundGraphics:Ft,marginalGraphics:ft,xValues:[],yValues:[],annotations:Ie,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:Zn,yAccessor:eo,annotationData:no(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,linkedCrosshairName:wt,linkedCrosshairSourceId:At})]})}return t("div",{ref:Ct,className:"stream-xy-frame"+(Q?" "+Q:""),role:"group","aria-label":xt||("string"==typeof Je?Je:"XY chart"),tabIndex:0,style:{position:"relative",width:X?"100%":Mt[0],height:V?"100%":Mt[1],overflow:"visible"},onKeyDown:Hn,children:[bt&&e(sn,{tableId:Bt}),bt&&e(on,{scene:null!==(p=null===(h=bn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Bt,chartTitle:"string"==typeof Je?Je:void 0}),e(rn,{summary:kt}),t("div",{role:"img","aria-label":xt||("string"==typeof Je?Je:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Rt?In:void 0,onMouseLeave:Rt?_n:void 0,onClick:Be?Ln:void 0,children:[zt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Mt[0],height:Mt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${It.left},${It.top})`,children:zt})}),e($t,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:Kt,showAxes:xe,axes:ke,showGrid:ze,xFormat:zn,yFormat:je||Me}),e("canvas",{ref:qt,"aria-label":Vt(null!==(y=null===(f=bn.current)||void 0===f?void 0:f.scene)&&void 0!==y?y:[],w+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:Xt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(an,{hoverPoint:tn}),e(Et,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:Kt,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:zn,yFormat:je||Me,showGrid:ze,title:Je,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,foregroundGraphics:Ft,marginalGraphics:ft,xValues:gn,yValues:fn,annotations:Ie,svgAnnotationRules:Fe,annotationFrame:Ut,xAccessor:Zn,yAccessor:eo,annotationData:no(null===(m=bn.current)||void 0===m?void 0:m.getData()),pointNodes:null===(v=bn.current)||void 0===v?void 0:v.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,underlayRendered:!0,linkedCrosshairName:wt,linkedCrosshairSourceId:At}),(et||tt)&&e(oe,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,dimension:null!==(b=null==et?void 0:et.dimension)&&void 0!==b?b:"xy",scales:Kt,onBrush:null!=tt?tt:()=>{},binSize:H,snap:null==et?void 0:et.snap,binBoundaries:null!==(x=null==et?void 0:et.binBoundaries)&&void 0!==x?x:"bar"===w?null===(k=bn.current)||void 0===k?void 0:k.getBinBoundaries():void 0,snapDuring:null==et?void 0:et.snapDuring,streaming:"streaming"===A}),(null==ct?void 0:ct.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ct.badgePosition?{top:4,left:4}:"bottom-left"===ct.badgePosition?{bottom:4,left:4}:"bottom-right"===ct.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:dn?"#dc3545":"#28a745",color:"white"}),children:dn?"STALE":"LIVE"}),Vn,Dn]})]})});Qn.displayName="StreamXYFrame";const Kn=a(null);function Jn(){return l(Kn)}function Zn(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 eo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[to,no]=re(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=eo(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=eo(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}})}})),[oo,io]=re(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 ro(e){const t=p(),n=e.clientId||t,{name:o}=e,i=no(e=>e.selections.get(o)),s=no(e=>e.setClause),a=no(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Zn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}function so(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=ro({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}function ao(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=ro({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}const lo=a(!1);function co({selections:e}){const t=no(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function uo({categoryColors:t,interaction:n,selectionName:o,field:a}){const l=Object.entries(t);if(0===l.length)return null;const u=l.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:l.map(([e,t])=>({label:e,color:t})),label:""}],g=so({name:o,fields:[a]}),p=ro({name:o,clientId:"__linked-legend-isolate__"}),[f,y]=d(new Set),[m,v]=d(null),b=i(p.selectPoints);b.current=p.selectPoints;const x=i(p.clear);x.current=p.clear,s(()=>{"isolate"===n&&(f.size>0?b.current({[a]:Array.from(f)}):x.current())},[n,f,a]);const k=c(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[a]:e.label})):(v(null),g.onHover(null)))},[n,a,g]),w=c(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[O]]=dn([0,0],!0,!1),S=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(l.map(([e])=>e),O),[l,O]);return e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"},children:e(dt,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:f})})})}function ho({children:n,selections:o,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Jn(),u=void 0!==i?i:!(!c||0>=Object.keys(c).length);return e(to,{children:t(oo,{children:[o&&e(co,{selections:o}),t(lo.Provider,{value:u,children:[u&&"top"===r&&c&&e(uo,{categoryColors:c,interaction:s,selectionName:a,field:l}),n,u&&"bottom"===r&&c&&e(uo,{categoryColors:c,interaction:s,selectionName:a,field:l})]})]})})}function go({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),a=s?o(s,t,n):n?n(i):Oe[r%Oe.length];return{label:i+"",color:a}}),label:""}]}}function po(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 yo(){return pe(e=>e.theme)}o.createContext(void 0);const mo="#007bff";function vo(){var e;const t=yo(),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,t,n){const o=Jn(),i=vo();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Ce(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return Ce(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=Ce(e,t,s);return e=>o[e]||n(e)}return Ce(e,t,s)}if(o&&Object.keys(o).length>0){const e=Ce([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}function xo({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=ro({name:(null==e?void 0:e.name)||"__unused__"}),v=so({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=io(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=d(null),A=g||n[0],O=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),S=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Mt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Mt={positions:new Map(Mt.positions).set(e,{xValue:t,sourceId:n})},Pt())}(y.name||"hover",Number(e),f)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Lt(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,f,i,a,l,b,h,A]),j=c(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Mt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Mt.positions);return t.delete(e),Mt={positions:t},Pt(),!1}Mt={positions:new Map(Mt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Pt()}(y.name||"hover",Number(n),f)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[u,i,b,a,l,y,f]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Bt(e,f),Lt(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}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:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(lo),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=go({data:e,colorBy:t,colorScale:n,getColor:je,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function Ao(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}const Oo={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 So(e,t,n){var o,i,r,s,a,l,c;const u=Oo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:jo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function jo(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 Co(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 Mo={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(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=_o(n,i);l=Po(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=_o(n,o);c.push({label:t,value:Po(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Po(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Po(n[e[0]],r))}}const u=Object.assign(Object.assign({},Mo),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function Bo(t){if(!0===t)return Lo();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e("div",{className:"semiotic-tooltip",style:Mo,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lo(t):Lo())}function No(e){return"string"==typeof e?e:"value"}function To(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 To(e);try{const n=t(e);return null==n?To(e):n}catch(t){return To(e)}}function Io(e,t){return"function"==typeof t?t(e):e[t]}function Fo(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?Ho(Io(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:Mo,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=Ho(Io(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function zo({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Wo extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(zo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function $o(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 Do(e,t,n=3){let o,i=n+1;for(const n of t){const t=$o(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Ro(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Eo(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=Do(e,t,3))&&void 0!==n?n:null)}function Yo({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=Ro(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=Eo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Go={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},qo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Xo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Vo=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Uo=["vertical","horizontal"],Qo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vo},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),qo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Uo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Uo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Go),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Go),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Go),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Go),Xo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Go),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Go),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Uo},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Go),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Go),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Go),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Go),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Go),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Go),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Ko(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Jo=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Zo=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),ei=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ti=new Set(["LineChart","AreaChart","StackedAreaChart"]),ni=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function oi(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function ii(e,t){const n=oi(e),o=oi(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const ri=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function si(e,t){const n=[],o=function(e,t){const n=[],o=Qo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Qo).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!Ko(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Do(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Yo({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=Ro(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Eo(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Qo[e]?(function(e,t,n){const o=Qo[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Qo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Jo.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Zo.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Qo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!ei.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ti.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=Qo[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!ni.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=ii(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=ii(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of ri)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var ai;const li="undefined"!=typeof process&&"production"!==(null===(ai=process.env)||void 0===ai?void 0:ai.NODE_ENV);function ci({componentName:t,width:n,height:o,chartProps:i,children:r}){return e(Wo,{fallback:r=>{let s="";if(li&&i)try{const e=si(t,i);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e(zo,{componentName:t,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const ui={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"},di={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function hi(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},ui),{width:n,height:o}),children:i||"No data available"}):null}function gi(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))),a=Math.floor((o-(i*(r+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},di),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function pi(e,t,n,o){if(!li)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 fi(e){const t=pe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function yi(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const mi="__forecastSegment";let vi=null;function bi(){return yi(this,void 0,void 0,function*(){return vi||(vi=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),vi})}const xi=h(function(n,o){var a,l;const u=i(null);g(o,()=>({push:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=u.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=u.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const h=So(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:p,margin:f,className:y,xFormat:m,yFormat:v,xAccessor:b="x",yAccessor:x="y",lineBy:k,lineDataAccessor:w="coordinates",colorBy:A,colorScheme:O,curve:S="linear",showPoints:j=!1,pointRadius:C=3,fillArea:M=!1,areaOpacity:_=.3,lineWidth:P=2,lineGradient:L,tooltip:B,pointIdAccessor:N,annotations:T,directLabel:H,gapStrategy:I="break",anomaly:F,forecast:z,frameProps:W={},selection:$,linkedHover:D,onObservation:R,onClick:E,hoverHighlight:Y,hoverRadius:G,chartId:q,loading:X,emptyContent:V,legendInteraction:U,legendPosition:Q,xScaleType:K,yScaleType:J,color:Z,stroke:ee,strokeWidth:te,opacity:ne}=n,oe=h.width,ie=h.height,re=h.enableHover,se=h.showGrid,ae=h.showLegend,le=h.title,ce=h.description,ue=h.summary,de=h.accessibleTable,he=h.xLabel,ge=h.yLabel,pe=gi(X,oe,ie),fe=pe?null:hi(p,oe,ie,V),ye=p||[];pi("LineChart",ye,"xAccessor",b),pi("LineChart",ye,"yAccessor",x);const me="string"==typeof b?b:"__semiotic_resolvedX",ve="string"==typeof x?x:"__semiotic_resolvedY",[be,xe]=d(null),[ke,we]=d([]),Ae=r(()=>{if(!z&&!F)return ye;const e="function"==typeof b,t="function"==typeof x;return e||t?ye.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=b(n)),t&&(o.__semiotic_resolvedY=x(n)),o}):ye},[ye,z,F,b,x]),Oe=i(z),Se=i(F);s(()=>{if(!z&&!F)return void((Oe.current||Se.current)&&(xe(null),we([]),Oe.current=z,Se.current=F));let e=!1;const t=z!==Oe.current||F!==Se.current;if(Oe.current=z,Se.current=F,t&&(xe(null),we([])),z){const t=k&&"string"==typeof k&&"object"==typeof z?Object.assign(Object.assign({},z),{_groupBy:k}):z;(function(...e){return yi(this,void 0,void 0,function*(){return(yield bi()).buildForecast(...e)})})(Ae,me,ve,t,F).then(t=>{e||(xe(t),we(t.annotations))}).catch(()=>{e||(xe(null),we([]))})}else F&&function(...e){return yi(this,void 0,void 0,function*(){return(yield bi()).buildAnomalyAnnotations(...e)})}(F).then(t=>{e||(xe(null),we(t))}).catch(()=>{e||we([])});return()=>{e=!0}},[Ae,z,F,me,ve]);const Ce=be?be.processedData:ye,Me="__compoundGroup",_e=!(!z||!k),Pe=_e?Me:z?mi:k,Le=r(()=>{if(!_e)return Ce;const e="function"==typeof k?k:e=>e[k];return Ce.map(t=>{const n=Object.assign({},t);return n[Me]=`${e(t)}__${t[mi]||"observed"}`,n})},[Ce,_e,k]),Be=_e?Le:Ce,Ne=r(()=>{if(!z)return;const e=z.upperBounds,t=z.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be?be.processedData:ye;for(const e of s){const t="function"==typeof x?x(e):+e[x];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},[z,be,ye,x]),{activeSelectionHook:Te,hoverSelectionHook:He,customHoverBehavior:Ie,customClickBehavior:Fe,crosshairSourceId:ze}=xo({selection:$,linkedHover:D,fallbackFields:A?["string"==typeof A?A:""]:[],onObservation:R,onClick:E,chartType:"LineChart",chartId:q,hoverHighlight:Y,colorByField:"string"==typeof A?A:void 0}),We=fi($),$e=ko(D,ze),De=c(e=>{const t="function"==typeof b?b(e):e[b],n="function"==typeof x?x(e):e[x];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[b,x]),Re=void 0!==(null===(a=Be[0])||void 0===a?void 0:a[w]),Ee=r(()=>{if(Re)return Be;if(Pe){const e=Be.reduce((e,t)=>{const n="function"==typeof Pe?Pe(t):t[Pe];if(!e[n]){const o={[w]:[]};"string"==typeof Pe&&(o[Pe]=n),_e&&(o[mi]=t[mi],"string"==typeof k&&(o[k]=t[k])),e[n]=o}return e[n][w].push(t),e},{});return Object.values(e)}return[{[w]:Be}]},[Be,Pe,w,Re]),{gapProcessedLineData:Ye,hasGaps:Ge}=r(()=>{if("interpolate"===I){let e=!1;const t=[];for(const n of Ee){const o=(n[w]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===I){let e=!1;const t=[];for(const n of Ee){const o=n[w]||[];let i=[],r=0;const s=Pe&&"string"==typeof Pe?n[Pe]:void 0;for(const a of o)if(De(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[w]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===I){let e=!1;const t="string"==typeof x?x:"y",n=[];for(const o of Ee){const i=o[w]||[],r=[];for(const n of i)De(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[w]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Ee,hasGaps:!1}},[Ee,I,w,De,Pe,x]),qe=bo(Ce,A,O),Xe=r(()=>{if(!A)return[];const e=new Set;for(const t of Ce){const n="function"==typeof A?A(t):t[A];null!=n&&e.add(n+"")}return Array.from(e)},[Ce,A]),Ve=Ao(U,A,Xe),Ue=r(()=>He||(Ve.legendSelectionHook?Ve.legendSelectionHook:Te),[He,Ve.legendSelectionHook,Te]),Qe=r(()=>(e,t)=>{const n={strokeWidth:P},o=!0===M||Array.isArray(M)&&null!=t&&M.includes(t);return A?qe&&(n.stroke=je(e,A,qe),o&&(n.fill=n.stroke,n.fillOpacity=_)):(n.stroke=Z||mo,o&&(n.fill=Z||mo,n.fillOpacity=_)),n},[A,qe,P,M,_,Z]),[Ke,Je]=d(null);s(()=>{if(!z)return void Je(null);let e=!1;return function(...e){return yi(this,void 0,void 0,function*(){return(yield bi()).createSegmentLineStyle(...e)})}(Qe,z).then(t=>{e||Je(()=>t)}).catch(()=>{e||Je(null)}),()=>{e=!0}},[Qe,z]);const Ze=Ke||Qe,et=r(()=>Co(Ze,{stroke:ee,strokeWidth:te,opacity:ne}),[Ze,ee,te,ne]),tt=r(()=>fo(et,Ue,We),[et,Ue,We]),nt=r(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return A?qe&&(t.fill=je(e.parentLine||e,A,qe)):t.fill=Z||mo,t}},[j,C,A,qe,Z]),ot=Array.isArray(M)?"mixed":M?"area":"line",it="object"==typeof H?H:{},rt=it.position||"end",st=it.fontSize||11,at=r(()=>{var e,t;if(!H||!A)return[];const n="function"==typeof b?b:e=>e[b],o="function"==typeof x?x:e=>e[x],i="function"==typeof A?A:e=>e[A],r=new Map;for(const n of Ye){const o=n[w]||[];if(0===o.length)continue;const s="end"===rt?o[o.length-1]:o[0],a=null!==(t=null!==(e=i(s))&&void 0!==e?e:i(n))&&void 0!==t?t:"";a&&!r.has(a+"")&&r.set(a+"",s)}const s=Array.from(r.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof b?b:"x"]:n(t),["string"==typeof x?x:"y"]:o(t),dx:"end"===rt?6:-6,dy:0,color:qe?qe(e):mo,fontSize:st}));s.sort((e,t)=>{const n="string"==typeof x?x:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof x?x:"y",n=s[e-1],o=s[e];st+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=st+2)}return s},[H,A,qe,Ye,w,b,x,rt,st]),lt=(!H||void 0!==ae)&&ae,ct=r(()=>{if(!H)return h.marginDefaults;const e=at.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*st);return Math.max(e,o)},0),t=e+10,n="end"===rt?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[H,at,st,rt,h.marginDefaults]),{legend:ut,margin:dt,legendPosition:ht}=wo({data:Ye,colorBy:A,colorScale:qe,showLegend:lt,legendPosition:Q,userMargin:f,defaults:ct}),gt=k||A,pt=r(()=>Fo([{label:he||No(b),accessor:b,role:"x",format:m},{label:ge||No(x),accessor:x,role:"y",format:v},...gt?[{label:No(gt),accessor:gt,role:"group"}]:[]]),[b,x,he,ge,gt,m,v]),ft=Yo({componentName:"LineChart",data:Re?(null===(l=Ce[0])||void 0===l?void 0:l[w])||[]:p,accessors:{xAccessor:b,yAccessor:x}}),yt=r(()=>Re||Pe||Ge?Ye.flatMap(e=>{const t=e[w]||[];return Pe&&"string"==typeof Pe?t.map(t=>Object.assign(Object.assign({},t),{[Pe]:e[Pe]})):t}):Be,[Ye,w,Re,Pe,Be,Ge]),mt=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:ot},Array.isArray(M)&&{areaGroups:M}),L&&{lineGradient:L}),null!=G&&{hoverRadius:G}),null!=p&&{data:yt}),{xAccessor:b,yAccessor:x,xScaleType:K,yScaleType:J}),Ne&&{yExtent:Ne}),{groupAccessor:"break"===I&&Ge?"_gapSegment":Pe||void 0,curve:S,lineStyle:tt}),j&&{pointStyle:nt}),{size:[oe,ie],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:dt,showAxes:h.showAxes,xLabel:he,yLabel:ge,xFormat:m,yFormat:v,enableHover:re,showGrid:se}),ut&&{legend:ut,legendPosition:ht}),U&&"none"!==U&&{legendHoverBehavior:Ve.onLegendHover,legendClickBehavior:Ve.onLegendClick,legendHighlightedCategory:Ve.highlightedCategory,legendIsolatedCategories:Ve.isolatedCategories}),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),y&&{className:y}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===B?()=>null:"multi"===B?n=>{var o,i,r,s,a,l,c,u,d,h;const g=n.allSeries;if(!g||0===g.length){const t=null!==(a=null!==(s=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y)&&void 0!==s?s:n.value)&&void 0!==a?a:n.y;return e("div",{className:"semiotic-tooltip",style:Mo,children:e("div",{children:Po(t)})})}const p=null!==(h=null!==(u=null!==(l=n.xValue)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.time)&&void 0!==u?u:null===(d=n.data)||void 0===d?void 0:d.x)&&void 0!==h?h:n.time;return t("div",{className:"semiotic-tooltip",style:Mo,children:[null!=p&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Po(p)}),g.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Po(n.value)})]},o))]})}:Bo(B)||pt}),"multi"===B&&{tooltipMode:"multi"}),(D||R||E||Y)&&{customHoverBehavior:Ie}),(R||E||D)&&{customClickBehavior:Fe}),N&&{pointIdAccessor:N}),((null==T?void 0:T.length)||ke.length||at.length)&&{annotations:[...T||[],...ke,...at]}),$e),W);return pe||fe||(ft?e(zo,{componentName:"LineChart",message:ft,width:oe,height:ie}):e(ci,{componentName:"LineChart",width:oe,height:ie,children:e(Qn,Object.assign({ref:u},mt))}))});xi.displayName="LineChart";const ki=h(function(t,n){var o;const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:O,showLine:S=!0,lineWidth:j=2,showPoints:C=!1,pointRadius:M=3,tooltip:_,annotations:P,frameProps:L={},selection:B,linkedHover:N,onObservation:T,onClick:H,hoverHighlight:I,chartId:F,loading:z,emptyContent:W,legendInteraction:$,legendPosition:D,color:R,stroke:E,strokeWidth:Y,opacity:G}=t,q=a.width,X=a.height,V=a.enableHover,U=a.showGrid,Q=a.showLegend,K=a.title,J=a.description,Z=a.summary,ee=a.accessibleTable,te=a.xLabel,ne=a.yLabel,oe=gi(z,q,X),ie=oe?null:hi(l,q,X,W),re=l||[];pi("AreaChart",re,"xAccessor",p),pi("AreaChart",re,"yAccessor",f);const{activeSelectionHook:se,hoverSelectionHook:ae,customHoverBehavior:le,customClickBehavior:ce,crosshairSourceId:ue}=xo({selection:B,linkedHover:N,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:T,onClick:H,chartType:"AreaChart",chartId:F,hoverHighlight:I,colorByField:"string"==typeof x?x:void 0}),de=fi(B),he=ko(N,ue),ge=void 0!==(null===(o=re[0])||void 0===o?void 0:o[b]),pe=r(()=>{if(ge)return re;if(y){const e=re.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:re}]},[re,y,b,ge]),fe=bo(re,x,k),ye=r(()=>{if(!x)return[];const e=new Set;for(const t of re){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[re,x]),me=Ao($,x,ye),ve=r(()=>ae||(me.legendSelectionHook?me.legendSelectionHook:se),[ae,me.legendSelectionHook,se]),be=r(()=>e=>{const t={};if(x){if(fe){const n=je(e,x,fe);t.fill=n,S?(t.stroke=n,t.strokeWidth=j):t.stroke="none"}}else{const e=R||mo;t.fill=e,S?(t.stroke=e,t.strokeWidth=j):t.stroke="none"}return t.fillOpacity=A,t},[x,fe,R,A,S,j]),xe=r(()=>Co(be,{stroke:E,strokeWidth:Y,opacity:G}),[be,E,Y,G]),ke=r(()=>fo(xe,ve,de),[xe,ve,de]),we=r(()=>{if(C)return e=>{const t={r:M,fillOpacity:1};return x?fe&&(t.fill=je(e.parentLine||e,x,fe)):t.fill=mo,t}},[C,M,x,fe]),{legend:Ae,margin:Oe,legendPosition:Se}=wo({data:pe,colorBy:x,colorScale:fe,showLegend:Q,legendPosition:D,userMargin:c,defaults:a.marginDefaults}),Ce=y||x,Me=r(()=>Fo([{label:te||No(p),accessor:p,role:"x",format:d},{label:ne||No(f),accessor:f,role:"y",format:h},...Ce?[{label:No(Ce),accessor:Ce,role:"group"}]:[]]),[p,f,te,ne,Ce,d,h]),_e=Yo({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:f}}),Pe=r(()=>ge||y?pe.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):re,[pe,b,ge,y,re]),Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Pe}),{xAccessor:p,yAccessor:f,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),O&&{lineGradient:O}),{curve:w,lineStyle:ke}),C&&we&&{pointStyle:we}),{size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Oe,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:d,yFormat:h,enableHover:V}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:U}),Ae&&{legend:Ae,legendPosition:Se}),$&&"none"!==$&&{legendHoverBehavior:me.onLegendHover,legendClickBehavior:me.onLegendClick,legendHighlightedCategory:me.highlightedCategory,legendIsolatedCategories:me.isolatedCategories}),K&&{title:K}),J&&{description:J}),Z&&{summary:Z}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===_?()=>null:Bo(_)||Me}),(N||T||H||I)&&{customHoverBehavior:le}),(T||H||N)&&{customClickBehavior:ce}),P&&P.length>0&&{annotations:P}),he),L);return oe||ie||(_e?e(zo,{componentName:"AreaChart",message:_e,width:q,height:X}):e(ci,{componentName:"AreaChart",width:q,height:X,children:e(Qn,Object.assign({ref:s},Le))}))});function wi({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:s="right"}){const a=i(new Set),l=i([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),f=c(e=>t=>{p([t]),e(t)},[p]),y=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:Oe,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return go({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:je})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:f,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}ki.displayName="AreaChart";const Ai=h(function(t,n){var o;const s=i(null),a=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:j=3,normalize:C=!1,tooltip:M,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:N,onClick:T,hoverHighlight:H,chartId:I,loading:F,emptyContent:z,legendInteraction:W,legendPosition:$,color:D,stroke:R,strokeWidth:E,opacity:Y}=t,G=a.width,q=a.height,X=a.enableHover,V=a.showGrid,U=a.showLegend,Q=a.title,K=a.description,J=a.summary,Z=a.accessibleTable,ee=a.xLabel,te=a.yLabel,ne=gi(F,G,q),oe=ne?null:hi(l,G,q,z),ie=l||[],re=wi({isPushMode:void 0===l,colorBy:b||m,colorScheme:x,showLegend:U,legendPosition:$}),se=c(re.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[re.wrapPush]),ae=c(re.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[re.wrapPushMany]);g(n,()=>({push:se,pushMany:ae,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;re.resetCategories(),null===(e=s.current)||void 0===e||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}}),[se,ae,re.resetCategories]);const{activeSelectionHook:le,hoverSelectionHook:ce,customHoverBehavior:ue,customClickBehavior:de,crosshairSourceId:he}=xo({selection:L,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:N,onClick:T,chartType:"StackedAreaChart",chartId:I,hoverHighlight:H,colorByField:"string"==typeof b?b:void 0}),ge=fi(L),pe=ko(B,he),fe=void 0!==(null===(o=ie[0])||void 0===o?void 0:o[v]),ye=r(()=>{if(fe)return ie;if(m){const e=ie.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:ie}]},[ie,m,v,fe]),me=bo(ie,b,x),ve=r(()=>{if(!b)return[];const e=new Set;for(const t of ie){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ie,b]),be=Ao(W,b,ve),xe=r(()=>ce||(be.legendSelectionHook?be.legendSelectionHook:le),[ce,be.legendSelectionHook,le]),ke=r(()=>e=>{const t={};if(b&&me){const n=je(e,b,me);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else if(!b){const e=D||mo;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=O)}return t.fillOpacity=w,t},[b,me,w,A,O,D]),we=r(()=>Co(ke,{stroke:R,strokeWidth:E,opacity:Y}),[ke,R,E,Y]),Ae=r(()=>fo(we,xe,ge),[we,xe,ge]),Oe=r(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return b?me&&(t.fill=je(e.parentLine||e,b,me)):t.fill=D||mo,t}},[S,j,b,me,D]),{legend:Se,margin:Ce,legendPosition:Me}=wo({data:ye,colorBy:b,colorScale:me,showLegend:U,legendPosition:$,userMargin:u,defaults:a.marginDefaults}),_e=re.streamingLegend||Se,Pe=$||Me,Le=r(()=>{if(re.streamingMarginAdjust){const e=Object.assign({},Ce);for(const[t,n]of Object.entries(re.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ce},[Ce,re.streamingMarginAdjust]),Be=m||b,Ne=r(()=>Fo([{label:ee||No(f),accessor:f,role:"x",format:h},{label:te||No(y),accessor:y,role:"y",format:p},...Be?[{label:No(Be),accessor:Be,role:"group"}]:[]]),[f,y,ee,te,Be,h,p]),Te=Yo({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:f,yAccessor:y}}),He=r(()=>fe||m?ye.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):ie,[ye,v,fe,m,ie]),Ie=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:"stackedarea"},null!=l&&{data:He}),{xAccessor:f,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:C,lineStyle:Ae}),S&&Oe&&{pointStyle:Oe}),{size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Le,showAxes:a.showAxes,xLabel:ee,yLabel:te,xFormat:h,yFormat:p,enableHover:X}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:V}),_e&&{legend:_e,legendPosition:Pe}),W&&"none"!==W&&{legendHoverBehavior:be.onLegendHover,legendClickBehavior:be.onLegendClick,legendHighlightedCategory:be.highlightedCategory,legendIsolatedCategories:be.isolatedCategories}),Q&&{title:Q}),K&&{description:K}),J&&{summary:J}),void 0!==Z&&{accessibleTable:Z}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===M?()=>null:Bo(M)||Ne}),(B||N||T||H)&&{customHoverBehavior:ue}),(N||T||B)&&{customClickBehavior:de}),_&&_.length>0&&{annotations:_}),pe),P);return ne||oe||(Te?e(zo,{componentName:"StackedAreaChart",message:Te,width:G,height:q}):e(ci,{componentName:"StackedAreaChart",width:G,height:q,children:e(Qn,Object.assign({ref:s},Ie))}))});function Oi(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:f,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,O="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:S,hoverSelectionHook:j,customHoverBehavior:C,customClickBehavior:M,crosshairSourceId:_}=xo({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v,hoverHighlight:b,colorByField:O}),P=ko(c,_),L=bo(t,o,i),B=r(()=>{if(!o)return[];const e=new Set;for(const n of t){const t="function"==typeof o?o(n):n[o];null!=t&&e.add(t+"")}return Array.from(e)},[t,o]),N=Ao(s,o,B),T=r(()=>j||(N.legendSelectionHook?N.legendSelectionHook:S),[j,N.legendSelectionHook,S]),H=fi(l),{legend:I,margin:F,legendPosition:z}=wo({data:t,colorBy:o,colorScale:L,showLegend:f,legendPosition:a,userMargin:y,defaults:m}),W=r(()=>{const e={};return I&&(e.legend=I,e.legendPosition=z),s&&"none"!==s&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[I,z,s,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),$=gi(x,w,A),D=$?null:hi(n,w,A,k);return{colorScale:L,allCategories:B,legendState:N,effectiveSelectionHook:T,activeSelectionHook:S,customHoverBehavior:C,customClickBehavior:M,legend:I,margin:F,legendPosition:z,earlyReturn:$||D||null,legendBehaviorProps:W,crosshairProps:P,resolvedSelection:H}}Ai.displayName="StackedAreaChart";const Si=h(function(t,n){const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",colorBy:m,colorScheme:v,sizeBy:b,sizeRange:x=[3,15],pointRadius:k=5,pointOpacity:w=.8,tooltip:A,marginalGraphics:O,pointIdAccessor:S,annotations:j,frameProps:C={},selection:M,linkedHover:_,linkedBrush:P,onObservation:L,onClick:B,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,legendInteraction:F,legendPosition:z,color:W,stroke:$,strokeWidth:D,opacity:R}=t,E=a.width,Y=a.height,G=a.enableHover,q=a.showGrid,X=a.title,V=a.description,U=a.summary,Q=a.accessibleTable,K=a.xLabel,J=a.yLabel,Z=l||[],ee=Oi({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:F,legendPosition:z,selection:M,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:L,onClick:B,hoverHighlight:N,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:u,marginDefaults:a.marginDefaults,loading:H,emptyContent:I,width:E,height:Y}),te=po(P),ne=ao({name:(null==te?void 0:te.name)||"__unused_brush__",xField:(null==te?void 0:te.xField)||("string"==typeof f?f:void 0),yField:(null==te?void 0:te.yField)||("string"==typeof y?y:void 0)}),oe=te?"xyBrush"===ne.brushInteraction.brush?"xy":"xBrush"===ne.brushInteraction.brush?"x":"y":void 0,ie=o.useRef(ne.brushInteraction);ie.current=ne.brushInteraction;const re=c(e=>{const t=ie.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(ee.earlyReturn)return ee.earlyReturn;pi("Scatterplot",Z,"xAccessor",f),pi("Scatterplot",Z,"yAccessor",y);const se=r(()=>{if(!b||0===Z.length)return;const e=Z.map(e=>"function"==typeof b?b(e):e[b]);return[Math.min(...e),Math.max(...e)]},[Z,b]),ae=r(()=>e=>{const t={fillOpacity:w};return m?ee.colorScale&&(t.fill=je(e,m,ee.colorScale)):t.fill=W||mo,t.r=b?Me(e,b,x,se):k,t},[m,ee.colorScale,b,x,se,k,w,W]),le=r(()=>Co(ae,{stroke:$,strokeWidth:D,opacity:R}),[ae,$,D,R]),ce=r(()=>fo(le,ee.effectiveSelectionHook,ee.resolvedSelection),[le,ee.effectiveSelectionHook,ee.resolvedSelection]),ue=r(()=>Fo([{label:K||No(f),accessor:f,role:"x",format:h},{label:J||No(y),accessor:y,role:"y",format:p},...m?[{label:No(m),accessor:m,role:"color"}]:[],...b?[{label:No(b),accessor:b,role:"size"}]:[]]),[f,y,K,J,m,b,h,p]),de=Yo({componentName:"Scatterplot",data:l,accessors:{xAccessor:f,yAccessor:y}});if(de)return e(zo,{componentName:"Scatterplot",message:de,width:E,height:Y});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:Z}),{xAccessor:f,yAccessor:y,colorAccessor:m||void 0,sizeAccessor:b||void 0,sizeRange:x,pointStyle:ce,colorScheme:v,size:[E,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,showAxes:a.showAxes,xLabel:K,yLabel:J,xFormat:h,yFormat:p,enableHover:G,showGrid:q}),ee.legendBehaviorProps),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:Bo(A)||ue}),(_||L||B||N)&&{customHoverBehavior:ee.customHoverBehavior}),(L||B||_)&&{customClickBehavior:ee.customClickBehavior}),O&&{marginalGraphics:O}),S&&{pointIdAccessor:S}),j&&j.length>0&&{annotations:j}),te&&{brush:{dimension:oe},onBrush:re}),ee.crosshairProps),C);return e(ci,{componentName:"Scatterplot",width:E,height:Y,children:e(Qn,Object.assign({ref:s},he))})});function ji(e,t){return C(1===t?.5:e/(t-1))}Si.displayName="Scatterplot";const Ci=h(function(t,o){var s;const a=i(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,className:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",orderAccessor:y,orderLabel:m,pointRadius:v=4,tooltip:b,pointIdAccessor:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:C,chartId:M,loading:_,emptyContent:P,legendInteraction:L,stroke:B,strokeWidth:N,opacity:T}=t,H=l.width,I=l.height,F=l.enableHover,z=l.showGrid,W=l.title,$=l.description,D=l.summary,R=l.accessibleTable,E=l.xLabel,Y=l.yLabel,G=c||[],{safeData:q,orderMap:X}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof f?f:e=>e[f];let n=G;if(y&&G.length>0){const e="function"==typeof y?y:e=>e[y];n=[...G].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),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[G,y,p,f]);pi("ConnectedScatterplot",q,"xAccessor",p),pi("ConnectedScatterplot",q,"yAccessor",f);const{activeSelectionHook:V,hoverSelectionHook:U,customHoverBehavior:Q,customClickBehavior:K,crosshairSourceId:J}=xo({selection:A,linkedHover:O,fallbackFields:[],onObservation:S,onClick:j,chartType:"ConnectedScatterplot",chartId:M,hoverHighlight:C,colorByField:void 0}),Z=fi(A),ee=ko(O,J),te=Ao(L,void 0,[]),ne=r(()=>U||(te.legendSelectionHook?te.legendSelectionHook:V),[U,te.legendSelectionHook,V]),oe=null!==(s=null==Z?void 0:Z.unselectedOpacity)&&void 0!==s?s:.5,ie=r(()=>(e,t)=>{var n,o;const i=t.filter(e=>"point"===e.type);if(2>i.length)return;const r=null==ne?void 0:ne.isActive,s=null==ne?void 0:ne.predicate,a=100>i.length,l=i.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=i[t],u=i[t+1],d=ji(t,l),h=!r||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=r?h?1:oe:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=v+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=v,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[v,ne,oe]),re=r(()=>[ie],[ie]),se=r(()=>(t,o,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const n=a[t],o=a[t+1],i=ji(t,l),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:v+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:v,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:u})},[v]),ae=r(()=>[se],[se]),le=r(()=>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?ji(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:v,fillOpacity:1}},[v,X]),ce=r(()=>Co(le,{stroke:B,strokeWidth:N,opacity:T}),[le,B,N,T]),ue=r(()=>fo(ce,ne,Z),[ce,ne,Z]),de=Object.assign({top:50,right:40,bottom:60,left:70},"number"==typeof t.margin?{top:t.margin,bottom:t.margin,left:t.margin,right:t.margin}:t.margin),he=m||("string"==typeof y?y:"Order"),ge=r(()=>Fo([{label:E||No(p),accessor:p,role:"x",format:d},{label:Y||No(f),accessor:f,role:"y",format:h},...y?[{label:he,accessor:y,role:"group"}]:[]]),[p,f,E,Y,y,he,d,h]),pe=Yo({componentName:"ConnectedScatterplot",data:c,accessors:{xAccessor:p,yAccessor:f}}),fe=gi(_,H,I),ye=fe?null:hi(c,H,I,P),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({chartType:"scatter"},null!=c&&{data:q}),{xAccessor:p,yAccessor:f,pointStyle:ue,size:[H,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de,showAxes:l.showAxes,xLabel:E,yLabel:Y,xFormat:d,yFormat:h,enableHover:F,showGrid:z}),W&&{title:W}),$&&{description:$}),D&&{summary:D}),void 0!==R&&{accessibleTable:R}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:Bo(b)||ge}),(O||S||j||C)&&{customHoverBehavior:Q}),(S||j||O)&&{customClickBehavior:K}),x&&{pointIdAccessor:x}),{canvasPreRenderers:re,svgPreRenderers:ae}),k&&k.length>0&&{annotations:k}),ee),w);return fe||ye||(pe?e(zo,{componentName:"ConnectedScatterplot",message:pe,width:H,height:I}):e(ci,{componentName:"ConnectedScatterplot",width:H,height:I,children:e(Qn,Object.assign({ref:a},me))}))});Ci.displayName="ConnectedScatterplot";const Mi=h(function(t,n){const o=i(null),s=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:u,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:C,frameProps:M={},selection:_,linkedHover:P,linkedBrush:L,onObservation:B,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:F,legendInteraction:z,legendPosition:W,color:$,stroke:D,strokeWidth:R,opacity:E}=t,Y=s.width,G=s.height,q=s.enableHover,X=s.showGrid,V=s.showLegend,U=s.title,Q=s.description,K=s.summary,J=s.accessibleTable,Z=s.xLabel,ee=s.yLabel,te=gi(I,Y,G),ne=te?null:hi(a,Y,G,F),oe=a||[],ie=void 0===a,re=i(null),[se,ae]=d(0),le=c(e=>{if(!ie)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(re.current?(re.current[0]>e&&(re.current[0]=e,t=!0),e>re.current[1]&&(re.current[1]=e,t=!0)):(re.current=[e,e],t=!0))}t&&ae(e=>e+1)},[ie,m]),ce=wi({isPushMode:ie,colorBy:b,colorScheme:x,showLegend:V,legendPosition:W}),ue=c(ce.wrapPush(e=>{var t;le([e]),null===(t=o.current)||void 0===t||t.push(e)}),[ce.wrapPush,le]),de=c(ce.wrapPushMany(e=>{var t;le(e),null===(t=o.current)||void 0===t||t.pushMany(e)}),[ce.wrapPushMany,le]);g(n,()=>({push:ue,pushMany:de,remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;ce.resetCategories(),re.current=null,ae(e=>e+1),null===(e=o.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ue,de,ce.resetCategories]);const{activeSelectionHook:he,hoverSelectionHook:ge,customHoverBehavior:pe,customClickBehavior:fe,crosshairSourceId:ye}=xo({selection:_,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:N,chartType:"BubbleChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof b?b:void 0}),me=fi(_),ve=ko(P,ye),be=po(L);ao({name:(null==be?void 0:be.name)||"__unused_brush__",xField:(null==be?void 0:be.xField)||("string"==typeof f?f:void 0),yField:(null==be?void 0:be.yField)||("string"==typeof y?y:void 0)});const xe=bo(oe,b,x),ke=r(()=>{if(!b)return[];const e=new Set;for(const t of oe){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[oe,b]),we=Ao(z,b,ke),Ae=r(()=>ge||(we.legendSelectionHook?we.legendSelectionHook:he),[ge,we.legendSelectionHook,he]),Oe=r(()=>{if(ie)return re.current||[0,1];const e=oe.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[oe,m,ie,se]),Se=r(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?xe&&(t.fill=je(e,b,xe)):t.fill=$||mo,t.r=Me(e,m,v,Oe),t},[b,xe,m,v,Oe,k,w,A,$]),Ce=r(()=>Co(Se,{stroke:D,strokeWidth:R,opacity:E}),[Se,D,R,E]),_e=r(()=>fo(Ce,Ae,me),[Ce,Ae,me]),{legend:Pe,margin:Le,legendPosition:Be}=wo({data:oe,colorBy:b,colorScale:xe,showLegend:V,legendPosition:W,userMargin:l,defaults:s.marginDefaults}),Ne=ce.streamingLegend||Pe,Te=W||Be,He=r(()=>{if(ce.streamingMarginAdjust){const e=Object.assign({},Le);for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Le},[Le,ce.streamingMarginAdjust]),Ie=r(()=>Fo([{label:Z||No(f),accessor:f,role:"x",format:h},{label:ee||No(y),accessor:y,role:"y",format:p},{label:No(m),accessor:m,role:"size"},...b?[{label:No(b),accessor:b,role:"color"}]:[]]),[f,y,Z,ee,m,b,h,p]),Fe=Yo({componentName:"BubbleChart",data:a,accessors:{xAccessor:f,yAccessor:y},requiredProps:{sizeBy:m}});if(Fe)return e(zo,{componentName:"BubbleChart",message:Fe,width:Y,height:G});const ze=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:"bubble"},null!=a&&{data:oe}),{xAccessor:f,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:_e,colorScheme:x,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:He,showAxes:s.showAxes,xLabel:Z,yLabel:ee,xFormat:h,yFormat:p,enableHover:q,showGrid:X}),Ne&&{legend:Ne,legendPosition:Te}),z&&"none"!==z&&{legendHoverBehavior:we.onLegendHover,legendClickBehavior:we.onLegendClick,legendHighlightedCategory:we.highlightedCategory,legendIsolatedCategories:we.isolatedCategories}),U&&{title:U}),Q&&{description:Q}),K&&{summary:K}),void 0!==J&&{accessibleTable:J}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===O?()=>null:Bo(O)||Ie}),(P||B||N||T)&&{customHoverBehavior:pe}),(B||N||P)&&{customClickBehavior:fe}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),C&&C.length>0&&{annotations:C}),ve),M);return te||ne||e(ci,{componentName:"BubbleChart",width:Y,height:G,children:e(Qn,Object.assign({ref:o},ze))})});Mi.displayName="BubbleChart";const _i=h(function(t,n){var o;const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=So(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:p="value",xFormat:f,yFormat:y,colorScheme:m,customColorScale:v,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:O={},selection:S,linkedHover:N,onObservation:T,onClick:$,hoverHighlight:D,chartId:R,loading:E,emptyContent:Y,showLegend:G,legendPosition:q,legendInteraction:X}=t,V=a.width,U=a.height,Q=a.enableHover,K=a.title,J=a.description,Z=a.summary,ee=a.accessibleTable,te=a.xLabel,ne=a.yLabel,oe=gi(E,V,U),ie=oe?null:hi(l,V,U,Y),re=l||[],se=function(){var e;const t=yo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ae=null!==(o=null!=m?m:se)&&void 0!==o?o:"blues",le=null!=G&&G,ce=null!=q?q:"right",{margin:ue}=wo({data:re,colorBy:le?"value":void 0,colorScale:void 0,showLegend:le,legendPosition:ce,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=xo({selection:S,linkedHover:N,fallbackFields:[],onObservation:T,onClick:$,chartType:"Heatmap",chartId:R,hoverHighlight:D,colorByField:void 0});fi(S);const pe=ko(N,ge);Ao(X,void 0,[]);const fe=r(()=>"function"==typeof p?e=>p(e):e=>e[p],[p]),ye=r(()=>{const e=re.map(fe);return[Math.min(...e),Math.max(...e)]},[re,fe]),me=r(()=>"custom"===ae&&v?v:A({blues:B,reds:L,greens:P,viridis:C,oranges:_,purples:M,greys:W,plasma:j,inferno:z,magma:F,cividis:I,turbo:H}[ae]||B).domain(ye),[ae,v,ye]),ve=r(()=>Fo([{label:te||No(d),accessor:d,role:"x",format:f},{label:ne||No(h),accessor:h,role:"y",format:y},{label:No(p),accessor:p,role:"value",format:x}]),[d,h,te,ne,p,f,y,x]),be=Yo({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:p}}),xe=r(()=>{if(le)return{gradient:{colorFn:e=>me(e),domain:ye,label:"string"==typeof p?p:"value",format:x}}},[le,me,ye,p,x]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=l&&{data:re}),{xAccessor:d,yAccessor:h,valueAccessor:p,colorScheme:"custom"!==ae?ae:void 0,showValues:b,heatmapValueFormat:x,size:[V,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:f,yFormat:y,enableHover:Q}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),xe&&{legend:xe,legendPosition:ce}),K&&{title:K}),J&&{description:J}),Z&&{summary:Z}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:Bo(k)||ve}),(N||T||$||D)&&{customHoverBehavior:de}),(T||$||N)&&{customClickBehavior:he}),w&&w.length>0&&{annotations:w}),pe),O);return oe||ie||(be?e(zo,{componentName:"Heatmap",message:be,width:V,height:U}):e(ci,{componentName:"Heatmap",width:V,height:U,children:e(Qn,Object.assign({ref:s},ke))}))});_i.displayName="Heatmap";const Pi="__splomIdx",Li={top:4,bottom:4,left:4,right:4};function Bi({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),a=n-Li.left-Li.right,l=n-Li.top-Li.bottom;return s(()=>{if(!r.current)return;const e=f(r.current).select(".brush-g"),n=v().extent([[0,0],[a,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[a,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${Li.left},${Li.top})`})})}function Ni({data:n,xField:o,yField:r,cellSize:s,pointRadius:a,pointOpacity:l,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:p,mode:f,onPointHover:y}){const m=i(null),v=ro({name:h,clientId:`splom-${o}-${r}`}),b=ao({name:h,xField:o,yField:r}),x=ro({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=c(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=c(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Pi];void 0!==n&&(k({[Pi]:[n]}),null==y||y(t,e.x+Li.left,e.y+Li.top))},[k,y]),O=c(e=>{const t={opacity:l,r:a};return t.fill=u?je(e,u,d):mo,"hover"===f?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*l):v.isActive&&!v.predicate(e)&&(t.opacity=p),t},[u,d,l,a,f,v.isActive,v.predicate,x.isActive,x.predicate,p]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Qn,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:O,margin:Li,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?A:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e(Bi,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:w})]})}function Ti({data:n,field:o,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=ro({name:u,clientId:"splom-diag-"+o}),p=ro({name:d,clientId:`splom-diag-${o}-hover`}),f="hover"===h?p:g,y=f.isActive,m=f.predicate,v=r(()=>{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)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),p=Array.from({length:a},()=>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),a-1);if(d[s]++,y&&!m(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!m(e)||p[s][t]++)}}const f=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/f*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/f*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/f*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/f*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:f,categories:c}},[n,o,a,s,y,m,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):mo,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:mo,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):mo,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:mo,opacity:.7},"sel-"+n)))]})}function Hi({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Ii(n){const{data:i,fields:s,fieldLabels:a={},colorBy:l,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:p=2,pointOpacity:f=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:O,className:S,onObservation:j,chartId:C}=n,M="splom",_="splom-hover",P=b?"hover":v?"brush":"hover",L=no(e=>e.clearSelection),[B,N]=d(null),T=c(()=>{L(_),N(null)},[L,_]),H=r(()=>(i||[]).map((e,t)=>void 0!==e[Pi]?e:Object.assign(Object.assign({},e),{[Pi]:t})),[i]),I=bo(H,l,u),F=void 0!==A?A:!!l,z=r(()=>{if(!F||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(H.map(t=>t[e]))].map(e=>({label:e+"",color:I?I(e+""):mo})):null},[F,l,H,I]),W=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:S,style:{position:"relative"},children:[z&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:z.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:W,onMouseLeave:"hover"===P?T:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[n]||n}),s.map((t,o)=>i===o?"label"===y?e(Hi,{label:a[n]||n,cellSize:h},"diag-"+n):e(Ti,{data:H,field:n,label:a[n]||n,cellSize:h,bins:m,colorBy:l,colorScale:I,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,mode:P},"diag-"+n):e(Ni,{data:H,xField:t,yField:n,fieldLabels:a,cellSize:h,pointRadius:p,pointOpacity:f,colorBy:l,colorScale:I,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(N({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,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:C})):(N(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),B&&"hover"===P&&(()=>{const n=B.datum,o=a[B.xField]||B.xField,i=a[B.yField]||B.yField,r=l?"function"==typeof l?l(n):n[l]:null,s=O?"function"==typeof O?O(n):n[O]:"Row "+n[Pi];return t("div",{style:{position:"absolute",left:40+B.colIndex*(h+g)+B.px,top:B.rowIndex*(h+g)+B.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[B.xField]?Number(n[B.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[B.yField]?Number(n[B.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof l?l:"group",": ",r+""]})]})})()]})}function Fi(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(ho,{selections:i,children:e(Ii,Object.assign({},t))})}function zi({width:t,height:n,margin:o,scales:r,brushDirection:a,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+o.left+o.right,p=n+o.top+o.bottom;return s(()=>{if(!u.current||!r)return;const e=f(u.current).select(".brush-group"),o="x"===a?y().extent([[0,0],[t,n]]):m().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,a,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=f(u.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:u,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Wi(n){var o,a;const{data:l,width:u=600,height:h=400,margin:g,className:p,title:f,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:O,lineDataAccessor:S="coordinates",colorBy:j,colorScheme:C,curve:M="linear",lineWidth:_=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:B=!1,pointRadius:N=3,enableHover:T=!0,showGrid:H=!1,showLegend:I,legendPosition:F,tooltip:z,minimap:W={},renderBefore:$=!1,onBrush:D,brushExtent:R,frameProps:E={},loading:Y,emptyContent:G}=n,q=gi(Y,u,h),X=q?null:hi(l,u,h,G),V=l||[],[U,Q]=d(null),K=null!=R?R:U,J=c(e=>{R||Q(e),null==D||D(e)},[R,D]),Z=i(null),[ee,te]=d(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=Z.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?te(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[l]);const ne=void 0!==(null===(o=V[0])||void 0===o?void 0:o[S]),oe=r(()=>{if(ne)return V;if(O){const e=V.reduce((e,t)=>{const n="function"==typeof O?O(t):t[O];if(!e[n]){const t={[S]:[]};"string"==typeof O&&(t[O]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:V}]},[V,O,S,ne]),ie=r(()=>ne||O?oe.flatMap(e=>{const t=e[S]||[];return O&&"string"==typeof O?t.map(t=>Object.assign(Object.assign({},t),{[O]:e[O]})):t}):V,[oe,S,ne,O,V]),re=bo(V,j,C),se=r(()=>e=>{const t={strokeWidth:_};return t.stroke=j?je(e,j,re):mo,P&&(t.fill=t.stroke,t.fillOpacity=L),t},[j,re,_,P,L]),ae=r(()=>W.lineStyle?W.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=j?je(e,j,re):mo,t},[j,re,W.lineStyle]),le=r(()=>{if(B)return e=>{const t={r:N,fillOpacity:1};return t.fill=j?je(e.parentLine||e,j,re):mo,t}},[B,N,j,re]),{legend:ce,margin:ue,legendPosition:de}=wo({data:oe,colorBy:j,colorScale:re,showLegend:I,legendPosition:F,userMargin:g}),he=W.height||60,ge=r(()=>{var e,t,n,o,i,r,s,a;return{top:null!==(t=null===(e=W.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=W.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=W.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=W.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[W.margin,ue]),pe=W.brushDirection||"x",fe=Yo({componentName:"MinimapChart",data:l,accessors:{xAccessor:w,yAccessor:A}});if(fe)return e(zo,{componentName:"MinimapChart",message:fe,width:u,height:h});const ye=P?"area":"line",me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:M,lineStyle:se},B&&{pointStyle:le}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ue,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:T,showGrid:H}),ce&&{legend:ce,legendPosition:de}),f&&{title:f}),y&&{description:y}),m&&{summary:m}),z&&{tooltipContent:Bo(z)||void 0}),K&&{xExtent:K}),E),ve={chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:M,lineStyle:ae,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(a=W.showAxes)&&void 0!==a&&a,background:W.background,enableHover:!1},be=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Qn,Object.assign({ref:Z},ve)),e(zi,{width:u-ge.left-ge.right,height:he,margin:ge,scales:ee,brushDirection:pe,extent:K,onBrush:J})]},"minimap"),xe=e("div",{style:{overflow:"hidden"},children:e(Qn,Object.assign({},me))},"main");return q||X||e(ci,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(p?" "+p:""),children:[$?be:xe,$?xe:be]})})}Fi.displayName="ScatterplotMatrix",Wi.displayName="MinimapChart";const $i=h(function(o,s){const a=i(null);g(s,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=So(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",xCenter:m,yCenter:v,quadrants:b,centerlineStyle:x={},showQuadrantLabels:k=!0,quadrantLabelSize:w=12,colorBy:A,colorScheme:O,sizeBy:S,sizeRange:j=[3,15],pointRadius:C=5,pointOpacity:M=.8,tooltip:_,pointIdAccessor:P,annotations:L,frameProps:B={},selection:N,linkedHover:T,onObservation:H,onClick:I,hoverHighlight:F,chartId:z,loading:W,emptyContent:$,legendInteraction:D,legendPosition:R,color:E,stroke:Y,strokeWidth:G,opacity:q}=o,X=l.width,V=l.height,U=l.enableHover,Q=l.showGrid,K=l.showLegend,J=l.title,Z=l.description,ee=l.summary,te=l.accessibleTable,ne=l.xLabel,oe=l.yLabel,ie=gi(W,X,V),re=ie?null:hi(c,X,V,$),se=c||[];pi("QuadrantChart",se,"xAccessor",f),pi("QuadrantChart",se,"yAccessor",y);const{activeSelectionHook:ae,hoverSelectionHook:le,customHoverBehavior:ce,customClickBehavior:ue,crosshairSourceId:de}=xo({selection:N,linkedHover:T,fallbackFields:"string"==typeof A?[A]:[],onObservation:H,onClick:I,chartType:"QuadrantChart",chartId:z,hoverHighlight:F,colorByField:"string"==typeof A?A:void 0}),he=fi(N),ge=ko(T,de),pe=bo(se,A,O),fe=r(()=>{if(!A)return[];const e=new Set;for(const t of se){const n="function"==typeof A?A(t):t[A];null!=n&&e.add(n+"")}return Array.from(e)},[se,A]),ye=Ao(D,A,fe),me=r(()=>le||(ye.legendSelectionHook?ye.legendSelectionHook:ae),[le,ye.legendSelectionHook,ae]),ve=r(()=>{if(!se.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof y?y:e=>+e[y];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of se){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=m&&isFinite(m)&&(n>m&&(n=m),m>o&&(o=m)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-a,r+a]}},[se,f,y,m,v]),be=r(()=>{if(!S||0===se.length)return;const e=se.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[se,S]),xe=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ke=r(()=>"function"==typeof y?y:e=>+e[y],[y]),we=r(()=>e=>{const t={fillOpacity:M};if(A)pe&&(t.fill=je(e,A,pe));else{const n=xe(e),o=ke(e),i=null!=m?n>=m:void 0,r=null!=v?o>=v:void 0;t.fill=void 0===r||void 0===i?E||mo:r&&i?b.topRight.color:r&&!i?b.topLeft.color:!r&&i?b.bottomRight.color:b.bottomLeft.color}return t.r=S?Me(e,S,j,be):C,t},[A,pe,S,j,be,C,M,xe,ke,m,v,b,E]),Ae=r(()=>Co(we,{stroke:Y,strokeWidth:G,opacity:q}),[we,Y,G,q]),Oe=r(()=>fo(Ae,me,he),[Ae,me,he]),{legend:Se,margin:Ce,legendPosition:_e}=wo({data:se,colorBy:A,colorScale:pe,showLegend:K,legendPosition:R,userMargin:u,defaults:l.marginDefaults}),Pe=r(()=>{if(!se.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof y&&e.add(y),"string"==typeof A&&e.add(A),"string"==typeof S&&e.add(S);const t=se[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[se,f,y,A,S]),Le=r(()=>Fo([...Pe?[{label:Pe,accessor:Pe,role:"title"}]:[],{label:ne||No(f),accessor:f,role:"x",format:h},{label:oe||No(y),accessor:y,role:"y",format:p},...A?[{label:No(A),accessor:A,role:"color"}]:[],...S?[{label:No(S),accessor:S,role:"size"}]:[]]),[Pe,f,y,ne,oe,A,S,h,p]),Be=Yo({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:y}}),Ne=r(()=>{var e;const t={stroke:x.stroke||"#999",strokeWidth:null!==(e=x.strokeWidth)&&void 0!==e?e:1,dashArray:x.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,a=i.height,l=null!=m?o.x(m):s/2,c=null!=v?o.y(v):a/2;if(null!=m&&!isFinite(l))return;if(null!=v&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:b.topLeft,x:0,y:0,w:u,h:d},{config:b.topRight,x:u,y:0,w:s-u,h:d},{config:b.bottomLeft,x:0,y:d,w:u,h:a-d},{config:b.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[m,v,b,x]),Te=r(()=>k?[...Ne,(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!=m?n.x(m):i/2,a=null!=v?n.y(v):r/2;(null==m||isFinite(s))&&(null==v||isFinite(a))&&(e.font=`600 ${w}px sans-serif`,e.globalAlpha=.5,e.fillStyle=b.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(b.topLeft.label,8,8),e.fillStyle=b.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(b.topRight.label,i-8,8),e.fillStyle=b.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(b.bottomLeft.label,8,r-8),e.fillStyle=b.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(b.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:Ne,[Ne,k,w,b,m,v]),He=r(()=>{const e=B.canvasPreRenderers||[];return[...Te,...e]},[Te,B.canvasPreRenderers]),Ie=r(()=>{var o;const i={stroke:x.stroke||"#999",strokeWidth:null!==(o=x.strokeWidth)&&void 0!==o?o:1,dashArray:x.strokeDasharray?Array.isArray(x.strokeDasharray)?x.strokeDasharray.join(","):x.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=m?r.x(m):a/2,u=null!=v?r.y(v):l/2;if(null!=m&&!isFinite(c))return null;if(null!=v&&!isFinite(u))return null;const d=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,u));return t(n,{children:[[{config:b.topLeft,x:0,y:0,w:d,h:h},{config:b.topRight,x:d,y:0,w:a-d,h:h},{config:b.bottomLeft,x:0,y:h,w:d,h:l-h},{config:b.bottomRight,x:d,y:h,w:a-d,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),k&&t(n,{children:[e("text",{x:8,y:8+w,fill:b.topLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.topLeft.label}),e("text",{x:a-8,y:8+w,fill:b.topRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.topRight.label}),e("text",{x:8,y:l-8,fill:b.bottomLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:b.bottomRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.bottomRight.label})]})]})}]},[m,v,b,x,k,w]),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({chartType:"scatter"},null!=c&&{data:se}),{xAccessor:f,yAccessor:y,colorAccessor:A||void 0,sizeAccessor:S||void 0,sizeRange:j,pointStyle:Oe,colorScheme:O,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:p,enableHover:U,showGrid:Q}),ve&&{xExtent:ve.xExtent,yExtent:ve.yExtent}),Se&&{legend:Se,legendPosition:_e}),D&&"none"!==D&&{legendHoverBehavior:ye.onLegendHover,legendClickBehavior:ye.onLegendClick,legendHighlightedCategory:ye.highlightedCategory,legendIsolatedCategories:ye.isolatedCategories}),J&&{title:J}),Z&&{description:Z}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?Le:Bo(_)||Le}),(T||H||I||F)&&{customHoverBehavior:ce}),(H||I||T)&&{customClickBehavior:ue}),P&&{pointIdAccessor:P}),L&&L.length>0&&{annotations:L}),{canvasPreRenderers:He}),ge),B),He.length>0&&{canvasPreRenderers:He}),{svgPreRenderers:Ie});return ie||re||(Be?e(zo,{componentName:"QuadrantChart",message:Be,width:X,height:V}):e(ci,{componentName:"QuadrantChart",width:X,height:V,children:e(Qn,Object.assign({ref:a},Fe))}))});$i.displayName="QuadrantChart";const Di="__ma_unitized",Ri="__ma_series";function Ei(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Yi(e,t){return t[0]+e*(t[1]-t[0])}const Gi=h(function(t,n){var s,a;const l=i(null),c=i([]);g(n,()=>({push:e=>{if(!l.current)return;const n=e;for(let e=0;t.series.length>e&&2>e;e++){const o=t.series[e],i=o.extent||c.current[e];if(!i)continue;const r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(n);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},n),{[Di]:Ei(r,i),[Ri]:o.label||"Series "+(e+1)}))}},pushMany:e=>{if(!l.current)return;const n=[];for(const o of e)for(let e=0;t.series.length>e&&2>e;e++){const i=t.series[e],r=i.extent||c.current[e];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},o),{[Di]:Ei(s,r),[Ri]:i.label||"Series "+(e+1)}))}l.current.pushMany(n)},remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const u=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:p,xFormat:f,xAccessor:y="x",series:m,colorScheme:v,curve:b="monotoneX",lineWidth:x=2,tooltip:k,annotations:w,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:C,hoverHighlight:M,chartId:_,loading:P,emptyContent:L,legendInteraction:B,legendPosition:N,stroke:T,strokeWidth:H,opacity:I}=t,F=u.width,z=u.height,W=u.enableHover,$=u.showGrid,D=null===(s=u.showLegend)||void 0===s||s,R=u.title,E=u.description,Y=u.summary,G=u.accessibleTable,q=u.xLabel,X=2===m.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||X||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${m.length}. Rendering as a standard multi-line chart.`);const V=gi(P,F,z),U=V?null:hi(d,F,z,L),Q=d||[],K=vo(),J=r(()=>{let e;if(Array.isArray(v))e=v;else if(K&&K.length>0)e=K;else{const t=we[v];e=Array.isArray(t)?t:Ae}return m.map((t,n)=>t.color||e[n%e.length])},[m,v,K]),Z=r(()=>m.map((e,t)=>e.label||"Series "+(t+1)),[m]),{unitizedData:ee,extents:te}=r(()=>{if(0===Q.length){const e=m.map(e=>e.extent||null).filter(Boolean);return e.length===m.length&&(c.current=e),{unitizedData:[],extents:e.length===m.length?e:[]}}const e=m.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]}(Q,e.yAccessor));if(c.current=e,!X){const t=[];for(const e of Q)for(let n=0;m.length>n;n++){const o=m[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Di]:i,[Ri]:Z[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of Q)for(let o=0;2>o;o++){const i=m[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Di]:Ei(r,e[o]),[Ri]:Z[o]}))}return{unitizedData:t,extents:e}},[Q,m,X,Z]),ne=r(()=>{if(X&&te.length>=2)return[{orient:"left",label:Z[0],tickFormat:m[0].format||(e=>{const t=Yi(e,te[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Z[1],tickFormat:m[1].format||(e=>{const t=Yi(e,te[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[X,te,m,Z]),oe=Oi({data:r(()=>ee.length>0?ee:Z.map(e=>({[Ri]:e})),[ee,Z]),rawData:d,colorBy:Ri,colorScheme:J,legendInteraction:B,legendPosition:N,selection:O,linkedHover:S,fallbackFields:[Ri],unwrapData:!1,onObservation:j,onClick:C,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:_,showLegend:D,userMargin:h,marginDefaults:X?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:P,emptyContent:L,width:F,height:z});if(oe.earlyReturn)return oe.earlyReturn;const ie=r(()=>{const e=new Map;return Z.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[Ri])||J[0],strokeWidth:x,fill:"none"})},[Z,J,x]),re=r(()=>Co(ie,{stroke:T,strokeWidth:H,opacity:I}),[ie,T,H,I]),se=r(()=>fo(re,oe.effectiveSelectionHook,oe.resolvedSelection),[re,oe.effectiveSelectionHook,oe.resolvedSelection]),ae=r(()=>{if(!1===k)return()=>null;return Bo(k)||(e=>{var t;const n=e.data||e,i=n[Ri],r=Z.indexOf(i),s=n[Di],a=X&&r>=0&&te[r]?Yi(s,te[r]):s,l=r>=0&&(null===(t=m[r])||void 0===t?void 0:t.format)?m[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(n):n[y];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(a)}`))})},[k,Z,J,te,X,m,y]),le=Yo({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),ce=X?[0,1]:void 0,ue=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!=d&&{data:ee}),{xAccessor:y,yAccessor:Di,groupAccessor:Ri,lineStyle:se,colorScheme:J,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,showAxes:u.showAxes}),ne&&{axes:ne}),{xLabel:q}),X?{}:{yLabel:Z[0]}),{xFormat:f}),X&&ce&&{yExtent:ce}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:$,curve:b}),oe.legendBehaviorProps),R&&{title:R}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),p&&{className:p}),null!=t.animate&&{animate:t.animate}),{tooltipContent:ae}),w&&{annotations:w}),(S||j||C||M)&&{customHoverBehavior:oe.customHoverBehavior}),(j||C||S)&&{customClickBehavior:oe.customClickBehavior}),oe.crosshairProps),A);return V||U||(le?e(zo,{componentName:"MultiAxisLineChart",message:le,width:F,height:z}):e(ci,{componentName:"MultiAxisLineChart",width:F,height:z,children:e(Qn,Object.assign({ref:l},ue))}))});Gi.displayName="MultiAxisLineChart";const qi=h(function(t,n){const o=i(null);g(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=So(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:p="high",lowAccessor:f="low",openAccessor:y,closeAccessor:m,candlestickStyle:v,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:O,onClick:S,chartId:j,loading:C,emptyContent:M}=t,_=s.width,P=s.height,L=s.enableHover,B=s.showGrid,N=s.title,T=s.description,H=s.summary,I=s.accessibleTable,F=s.xLabel,z=s.yLabel,W=gi(C,_,P),$=W?null:hi(a,_,P,M),D=a||[],R=null==y||null==m;pi("CandlestickChart",D,"xAccessor",h),pi("CandlestickChart",D,"highAccessor",p),pi("CandlestickChart",D,"lowAccessor",f),R||(pi("CandlestickChart",D,"openAccessor",y),pi("CandlestickChart",D,"closeAccessor",m));const{customHoverBehavior:E,customClickBehavior:Y,crosshairSourceId:G}=xo({selection:w,linkedHover:A,onObservation:O,onClick:S,chartType:"CandlestickChart",chartId:j}),q=ko(A,G),X=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},n),l)},[l,s.marginDefaults,t.mode]),V=r(()=>{const e=[{label:F||No(h),accessor:h,role:"x",format:u}];return R?(e.push({label:"High",accessor:p,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:y,format:d}),e.push({label:"High",accessor:p,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:m,format:d})),Fo(e)},[h,F,u,d,p,f,y,m,R]),U=Yo({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:p,lowAccessor:f},!R&&{openAccessor:y,closeAccessor:m})}),Q=Math.max(2,Math.min(12,Math.round(_/40))),K=_>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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=a&&{data:D}),{xAccessor:h,yAccessor:p,highAccessor:p,lowAccessor:f}),!R&&{openAccessor:y,closeAccessor:m}),v&&{candlestickStyle:v}),{scalePadding:Q,extentPadding:K,size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,showAxes:s.showAxes,xLabel:F,yLabel:z,xFormat:u,yFormat:d,enableHover:L,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),N&&{title:N}),T&&{description:T}),H&&{summary:H}),void 0!==I&&{accessibleTable:I}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:Bo(b)||V}),(A||O||S)&&{customHoverBehavior:E}),(O||S||A)&&{customClickBehavior:Y}),x&&x.length>0&&{annotations:x}),q),k);return W||$||(U?e(zo,{componentName:"CandlestickChart",message:U,width:_,height:P}):e(ci,{componentName:"CandlestickChart",width:_,height:P,children:e(Qn,Object.assign({ref:o},J))}))});qi.displayName="CandlestickChart";export{ki as AreaChart,Mi as BubbleChart,qi as CandlestickChart,Ci as ConnectedScatterplot,_i as Heatmap,xi as LineChart,Wi as MinimapChart,Gi as MultiAxisLineChart,$i as QuadrantChart,Si as Scatterplot,Fi as ScatterplotMatrix,Ai as StackedAreaChart,Qn as StreamXYFrame};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{select as f}from"d3-selection";import{brushX as y,brushY as m,brush as v}from"d3-brush";import{scaleOrdinal as b,scaleLinear as x,scaleLog as k,scaleTime as w,scaleSequential as A}from"d3-scale";import{quadtree as O}from"d3-quadtree";import{schemeCategory10 as S,interpolatePlasma as j,interpolateViridis as C,interpolatePurples as M,interpolateOranges as _,interpolateGreens as P,interpolateReds as L,interpolateBlues as B,schemeSet3 as N,schemeTableau10 as T,interpolateTurbo as H,interpolateCividis as I,interpolateMagma as F,interpolateInferno as z,interpolateGreys as W}from"d3-scale-chromatic";import{bin as $}from"d3-array";import{packEnclose as D}from"d3-hierarchy";import{area as R,curveCatmullRom as E,curveCardinal as Y,curveBasis as G,curveStepBefore as q,curveStepAfter as X,curveStep as V,curveMonotoneY as U,curveMonotoneX as Q,curveLinear as K,line as J,curveNatural as Z}from"d3-shape";import ee from"regression";function te(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 ne(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 oe({width:t,height:n,totalWidth:o,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:p,snapDuring:b,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const O=i(u);O.current=u;const S=r(()=>p?[...p].sort((e,t)=>e-t):void 0,[p]),j=i(S);j.current=S;const C=i(!1),M=i(null);return s(()=>{if(!k.current)return;const e=f(k.current).select(".brush-g"),o="x"===c?y():"y"===c?m():v();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(C.current)return;const r=O.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],a=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&b)){const t=j.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[te(e[0],t),ne(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),a=r.x(s[1]);if(C.current=!0,"x"===c)e.call(o.move,[n,a]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[a,t[1][1]]])}C.current=!1}const l={x:s,y:a};M.current=l,A.current(l)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,g,h,b]),s(()=>{if(!(x&&u&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],n=f(k.current).select(".brush-g");if(t>=e.x[1])return C.current=!0,n.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=j.current;e&&e.length>0?o=ne(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return C.current=!0,n.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);i=!0}const r=u.x(o),s=u.x(e.x[1]);if(C.current=!0,"x"===c)n.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[s,o]])}if(C.current=!1,i){const t={x:[o,e.x[1]],y:e.y};M.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:o,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class ie{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(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(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){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function re(t){const n=a(null),o=se(t);return[function({children:o}){const i=r(()=>se(t),[]);return e(n.Provider,{value:i,children:o})},e=>{var t;const r=null!==(t=l(n))&&void 0!==t?t:o,s=i(e);s.current=e;const a=c(()=>s.current(r.getState()),[r]),d=c(()=>s.current(r.getState()),[r]);return u(r.subscribe,a,d)}]}function se(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function ae(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 le(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:ce})})),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 ce=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ue={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}},de={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}},he={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ce,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"},[ge,pe]=re(e=>({theme:ue,setTheme(t){e(e=>{if("light"===t)return{theme:ue};if("dark"===t)return{theme:de};if("high-contrast"===t)return{theme:he};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?de:ue;return{theme:le(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{theme:le(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));class fe{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 ye{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(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.isNaN(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 me(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function ve(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function be(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function xe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ke(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const we={category10:S,tableau10:T,set3:N,blues:B,reds:L,greens:P,oranges:_,purples:M,viridis:C,plasma:j},Ae=S,Oe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Se=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 je(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")||Se.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Ae[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+""))%Ae.length]}function Ce(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return b().domain(o).range(n).unknown("#999");const r=we[n]||we.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Ae;return b().domain(o).range(e).unknown("#999")}}function Me(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,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function _e(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}function Pe(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 Le(e,t,n){return e+(t-e)*n}function Be(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 Ne(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);null==e||null==r||Number.isNaN(e)||Number.isNaN(r)||s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function Te(e,t,n,o,i,r,s,a){const l=[];for(const r of e){const e=n(r),s=o(r);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[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 He(e,t,n,o,i,r,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function Ie(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 Fe(e,t,n,o,i,r,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function ze(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),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);o.push([a,t]),i.push([a,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 We(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 a=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=He(s,e.scales,e.getX,r,a,o,l);c&&n.push(c)}}}const $e={blues:B,reds:L,greens:P,viridis:C,oranges:_,purples:M,greys:W,plasma:j,inferno:z,magma:F,cividis:I,turbo:H},De=new Map;class Re{constructor(e){if(this.xExtent=new ye,this.yExtent=new ye,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.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new fe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=be(e.timeAccessor||e.xAccessor,"time"),this.getY=be(e.valueAccessor||e.yAccessor,"value")):(this.getX=be(e.xAccessor,"x"),this.getY=be(e.yAccessor,"y")),this.getGroup=ke(e.groupAccessor),this.getCategory=ke(e.categoryAccessor),this.getSize=e.sizeAccessor?be(e.sizeAccessor,"size"):void 0,this.getColor=ke(e.colorAccessor),this.getBounds=e.boundsAccessor?be(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?be(e.y0Accessor,"y0"):void 0,this.getPointId=ke(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?be(e.openAccessor,"open"):void 0,this.getHigh=be(e.highAccessor,"high"),this.getLow=be(e.lowAccessor,"low"),this.getClose=n?be(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new fe(e.windowSize))}ingest(e){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.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?be(this.config.timeAccessor||this.config.xAccessor,"time"):be(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)))}return!0}computeScene(e){var t,n,o,i,r,s,a;const{config:l,buffer:c}=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);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,p=l.yExtent?[null!==(i=l.yExtent[0])&&void 0!==i?i:h[0],null!==(r=l.yExtent[1])&&void 0!==r?r:h[1]]:h;const f=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!f&&c.size>0)if(l.normalize)p=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)p=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;let o=0;for(const e of t)for(const t of e.data){const e=this.getX(t),i=this.getY(t);if(null==e||null==i||Number.isNaN(e)||Number.isNaN(i))continue;const r=(n.get(e)||0)+i;n.set(e,r),r>o&&(o=r)}p=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:p}}}else if("bar"===l.chartType&&l.binSize&&!f&&c.size>0){const[,e]=function(e,t,n,o,i){const r=me(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]}(c,this.getX,this.getY,l.binSize,this.getCategory);p=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!f&&c.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]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;p=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!f&&p[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>p[1]&&(p[1]=t+n),p[0]>t-n&&(p[0]=t-n))}const e=p[1]-p[0],t=e>0?e*l.extentPadding:1,n=null===(s=l.yExtent)||void 0===s?void 0:s[0],o=null===(a=l.yExtent)||void 0===a?void 0:a[1];p=[null!=n?p[0]:p[0]-t,null!=o?p[1]:p[1]+t],"log"===l.yScaleType&&0>=p[0]&&h[0]>0&&(p[0]=null!=n?p[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];p[0]!==1/0&&p[1]!==-1/0||(p=[0,1]);const y="streaming"===l.runtimeMode,m=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(v=l.arrowOfTime)||"down"===v?"y":"x")){const t="right"===l.arrowOfTime?[m,e.width-m]:[e.width-m,m];this.scales={x:x().domain(g).range(t),y:x().domain(p).range([e.height-m,m])}}else{const t="down"===l.arrowOfTime?[m,e.height-m]:[e.height-m,m];this.scales={x:x().domain(p).range([m,e.width-m]),y:x().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(n):x().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[m,e.width-m]),y:t(l.yScaleType,p,[e.height-m,m])}}var v;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),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,Re.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=O().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;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(n):x().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:i}=this;if(!i||0===t.length)return[];const r={scales:i,config:o,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(o.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=ze(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ne(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 We(e,o,i),i}(r,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=Te(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 We(e,n,o),o}(r,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=Te(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=Ne(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 We(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:i,stackedTops:r}=function(e,t,n,o,i,r,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);null==t||null==r||Number.isNaN(t)||Number.isNaN(r)||e.set(t,(e.get(t)||0)+r)}u.set(t.key,e)}let d;if(r){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let i=e.get(n)||0;const s=p.get(n);r&&(i/=d.get(n));const c=s+i,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const f={type:"area",topPath:o,bottomPath:a,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(f.curve=s),h.push(f)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=i;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=r.get(o.key);if(n)for(const i of o.data){const o=e.getX(i),r=e.getY(i);null==o||Number.isNaN(o)||null==r||Number.isNaN(r)||!n.has(o)||t.set(i,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};We(e,n,s,o)}return s}(r,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 a=e.getColor?e.resolveColorMap(t):null,l=(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:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t=Object.assign(Object.assign({},t),{fill:a.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=He(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(r,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)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=be(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),p=(d-u||1)/s,f=(g-h||1)/a,y=s*a;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 l=Math.min(Math.floor((i-u)/p),s-1),d=Math.min(Math.floor((r-h)/f),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(o);v[g]+=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(l){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,A=n.height/a,O=e.config.showValues,S=e.config.heatmapValueFormat,j=[];for(let e=0;a>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(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;j.push(Fe(n*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o]},O?{value:i,showValues:!0,valueFormat:S}:void 0))}}return j}(e,t,n);if(0===t.length)return[];const o=be(e.config.valueAccessor,"value"),i=xe(e.config.xAccessor,"x"),r=xe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=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);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),f=g.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(f){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[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(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,g=b.get(h);let p;void 0!==g?p=g:(p=x++,b.set(h,p)),y[p]=h,m[p]=d,v[p]=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 A=function(e){const t=e in $e?e:"blues";let n=De.get(t);if(n)return n;n=Array(256);const o=$e[t]||B;for(let e=0;256>e;e++)n[e]=o(e/255);return De.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(w-k||1),S=n.width/u,j=n.height/d,C=e.config.showValues,M=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(Fe(o*S,(d-1-(n-o)/u)*j,S,j,A[Math.min((t-k)*O+.5|0,255)],v[e],C?{value:t,showValues:!0,valueFormat:M}:void 0))}return _}(r,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=me(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(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,p={};(null==u?void 0:u.stroke)&&(p.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(p.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(p.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=a.x(n),f=a.x(i),y=Math.abs(f-h),m=y>g+1?g:0,v=Math.min(h,f)+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 l=a.y(n),c=a.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(Ie(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},p),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=a.y(0),n=a.y(t.total);s.push(Ie(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},p),{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of i.values())f.add(e.start),f.add(e.end);return{nodes:s,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=null!==(n=r.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,p=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:p},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(r,t);case"waterfall":return function(e,t,n){var o,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return u;const p=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",f=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),O=d.y(s),S=Math.min(A,O),j=Math.abs(A-O),C={fill:0>r?f:p,stroke:m,strokeWidth:v};null!=b&&(C.opacity=b),u.push(Ie(k,S,w,j,C,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(r,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||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=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 a=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const p=h>=a,f={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:p,datum:n};i&&(f.isRange=!0),r.push(f)}return r}(r,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?_e(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 a=s.get(t[n]);null!=a?(o[n]=_e(e,a,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 a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=_e(e,o,r),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=_e(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 a=_e(e,t,r);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;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*a})}}}(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(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=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 a=Pe(e,r,s);a>i&&(i=a)}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Pe(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=a,n._pulseGlowRadius=l)}}(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,a;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Be(e,c,l);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===(a=c.style)||void 0===a?void 0:a.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=Be(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,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,C,M,_,P,L,B,N,T,H,I,F,z,W,$,D,R,E,Y,G;if(0===o.size&&0===i.size)return n;const q=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 X=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=Be(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]];X=!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]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l: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}),X=!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!==(d=L.r)&&void 0!==d?d:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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!==(g=r.style.opacity)&&void 0!==g?g: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!==(p=L.w)&&void 0!==p?p:r.w,r.h=null!==(f=L.h)&&void 0!==f?f:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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,X=!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}),X=!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!==(O=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==O?O:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(j=L.highY)&&void 0!==j?j:r.highY,r.lowY=null!==(C=L.lowY)&&void 0!==C?C:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(M=r.style)||void 0===M?void 0:M.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!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),X=!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),X=!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!==(N=t.opacity)&&void 0!==N?N: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!==(T=t.w)&&void 0!==T?T:0,h:null!==(H=t.h)&&void 0!==H?H:0,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I: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!==(F=t.w)&&void 0!==F?F:0,h:null!==(z=t.h)&&void 0!==z?z:0,fill:"#999",datum:null,style:{opacity:null!==(W=t.opacity)&&void 0!==W?W:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==($=t.openY)&&void 0!==$?$:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(D=t.closeY)&&void 0!==D?D:o,highY:null!==(R=t.highY)&&void 0!==R?R: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)}X=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),X&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:q}),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,a,l,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Le(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Le(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Le(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Le(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Le(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Le(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Le(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Le(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Le(t[o][0],n[o][0],d),e.path[o][1]=Le(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Le(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Le(t[n][0],o[n][0],d),e.topPath[n][1]=Le(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Le(n[t][0],i[t][0],d),e.bottomPath[t][1]=Le(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}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||Oe,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)||Oe;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Re.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.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||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!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 l=a||!ve(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),c=a||!ve(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=be(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=be(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=be(this.config.xAccessor,"x"),this.getY=be(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!ve(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ke(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!ve(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ke(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!ve(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?be(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!ve(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ke(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!ve(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?be(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!ve(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ke(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!ve(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!ve(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!ve(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!ve(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?be(this.config.openAccessor,"open"):void 0,this.getHigh=be(this.config.highAccessor,"high"),this.getLow=be(this.config.lowAccessor,"low"),this.getClose=t?be(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!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&&(this.needsFullRebuild=!0)}}function Ee(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 Ye(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ge(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function qe(e,t){const n=Ge(e);if(!n)return!1;const o=Ge(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function Xe(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,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);Ye(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}: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=Ue(r,t,n,o);break;case"line":e=Qe(r,t,n,o);break;case"rect":e=Je(r,t,n);break;case"heatcell":e=Ze(r,t,n);break;case"area":if(!1===r.interactive)break;e=tt(r,t,n);break;case"candlestick":e=et(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ve(e,t,n){if(0===e.length)return null;const o=nt(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,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Ue(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Ye(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Qe(e,t,n,o=30){var i,r,s,a;if(0===e.path.length)return null;const l=nt(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const i=Math.max(0,l-1),r=Math.min(e.path.length-2,l);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=Ke(t,n,i,r,a,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(a=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!==a?a:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function Ke(e,t,n,o,i,r){const s=i-n,a=r-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Je(e,t,n){const o=Ee(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ze(e,t,n){const o=Ee(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function et(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 tt(e,t,n){if(0===e.topPath.length)return null;const o=nt(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,a=n-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function nt(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 ot(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 it(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}Re.GROUP_COLOR_MAP_CAP=1e3,Re.QUADTREE_THRESHOLD=500;const rt={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function st(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,rt[n])(o(e,t)),i}function at(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function lt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ct=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,f=[];let y=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=st(n,d,h,g),x=lt(n,r,s),k=s&&s.size>0&&s.has(n.label);f.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?k||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(at,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),f};function ut({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function dt(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,f]=o.useState(0),[y,m]=o.useState(0),v=o.useCallback((e,t)=>{f(e),m(t)},[]),b="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:ct(t,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let f=0;n.label&&(f+=16);const y=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:f}=n,y=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;f.forEach((n,d)=>{const k=st(n,d,g,p),w=lt(n,r,s),A=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),y.push(t("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+f.length)%f.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(at,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let k=0,w=0;for(const e of f){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const A=v+1;return{items:y,offset:k,totalRows:A,totalHeight:22*A}})(n,r,s,a,l,c,u,o,d,h,i);f+=y.offset+5,p.push(Object.assign(Object.assign({label:n.label},y),{offset:f,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=f+12});let f=g>i?0:Math.max(0,(i-g)/2);const y=[];return p.forEach((t,i)=>{const r=n[i];r.label&&(y.push(e("text",{transform:`translate(${f},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)),f+=16),y.push(e("g",{className:"legend-item",transform:`translate(${f},0)`,children:t.items},"legend-group-"+i)),f+=t.offset+5,n[i+1]&&y.push(e("line",{stroke:"gray",x1:f,y1:-8,x2:f,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),f+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function ht(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function gt(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,f;return"left"===s?(p=4,f=r.top):"top"===s?(p=0,f=a?32:8):"bottom"===s?(p=0,f=i-r.bottom+50):(p=o-r.right+10,f=r.top),e("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(ut,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):ht(n)?e(dt,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function pt(e){return"string"==typeof e?{type:e}:e}function ft({orient:n,config:o,values:i,scale:s,size:a,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=s.domain(),r=a-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=o,p=Math.min(.5*r,20),f=(r-p)/2+4;if(u){const o=s(a),i=s(d),r=s(l),u=s(h),y=s(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(f+p/2),x2:y,y2:v+m*(f+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*f,x2:u,y2:v+m*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*f,x2:y,y2:v+m*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-f-p:v+f,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-f-p:v+f,x2:r,y2:"top"===n?v-f:v+f+p,stroke:c.fill,strokeWidth:2})]})}{const o=s(a),i=s(d),r=s(l),u=s(h),y=s(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(f+p/2),y1:u,x2:v+m*(f+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*f,y1:u,x2:v+m*(f+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*f,y1:y,x2:v+m*(f+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-f-p:v+f,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-f-p:v+f,y1:r,x2:"left"===n?v-f:v+f+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=$().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);o.push(u?`${a},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${a}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);o.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function yt(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 mt(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 vt(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const f=16,y=a?d?[a]:yt(a,u):[],m=s?d?[s]:yt(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:f,children:t},n))},"annotation-note-title")),b=y.length*f),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:f,children:t},n))},"annotation-note-label"));let w=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*f+(m.length>0?f:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*f;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+f+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function bt(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.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;a.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:mt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function xt(t,n,o,i,r,s){const a=[];let l=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,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=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);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e("line",{x1:l,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-l);a.push(e("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+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("g",{className:"annotation-connector",children:a})}function kt(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=e,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"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 t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&xt(v,b,c,h,x,u),!m.has("subject")&&bt(x,u,h,n,o),!m.has("note")&&vt(l,v,b,h)]}))}function wt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e(kt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(kt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function At(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 Ot(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 St(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){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 a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=At(e,n),c=Ot(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function jt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ct={linear:K,monotoneX:Q,monotoneY:U,step:V,stepAfter:X,stepBefore:q,basis:G,cardinal:Y,catmullRom:E};let Mt={positions:new Map};const _t=new Set;function Pt(){for(const e of _t)e()}function Lt(e,t){const n=Mt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Mt.positions);o.delete(e),Mt={positions:o},Pt()}function Bt(e,t){const n=Mt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Mt.positions);o.delete(e),Mt={positions:o},Pt()}function Nt(){return Mt}function Tt(e){return _t.add(e),()=>_t.delete(e)}const Ht={positions:new Map};function It(){return()=>{}}function Ft(){return Ht}function zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Wt(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 $t(n){const{width:o,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:p}=n,f=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||g||Dt,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=c.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:c.x(e),label:n(e,t,s)})),l=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Rt(a,Math.max(55,l+8))},[c,d,g,o]),y=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||p||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Rt(c.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:c.y(e),label:n(e)})),22)},[c,d,p,i]),m=h&&c,v=u&&c;if(!m&&!v)return null;const b=null==d?void 0:d.find(e=>"bottom"===e.orient),x=null==d?void 0:d.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,O=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[m&&(()=>{var n,r;const s=zt(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),a=zt(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[f.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),y.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+n))]})})(),k&&!A&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:S,strokeWidth:1}),A&&e("path",{d:Wt("bottom",o,i),fill:"none",stroke:S,strokeWidth:1}),w&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),O&&e("path",{d:Wt("left",o,i),fill:"none",stroke:S,strokeWidth:1})]})})}function Dt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Rt(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 Et(o){var a,l;const{width:c,height:d,totalWidth:h,totalHeight:g,margin:p,scales:f,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:A,title:O,legend:S,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,legendPosition:P="right",foregroundGraphics:L,marginalGraphics:B,xValues:N,yValues:T,annotations:H,svgAnnotationRules:I,xAccessor:F,yAccessor:z,annotationData:W,pointNodes:$,curve:E,underlayRendered:Y,linkedCrosshairName:G,linkedCrosshairSourceId:q,children:X}=o,V=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||k||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=f.x.ticks(Math.min(o,Math.max(2,Math.floor(c/70)))),r=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:f.x(e),label:n(e,t,r)})),a=s.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),l=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Rt(s,l);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=f.x.domain()[1],t=f.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,r);l>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[y,f,m,k,c]),U=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||w||Dt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=Rt(f.y.ticks(Math.min(o,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:f.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=f.y.domain()[1],t=f.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},[y,f,m,w,d]),Q=r(()=>{var e;if(!y||!f)return[];const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||w||Dt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Rt(f.y.ticks(Math.min(o,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:f.y(e),label:n(e)})),22)},[y,f,m,w,d]),J=i(new Map),Z=i(null!==(a=null==H?void 0:H.length)&&void 0!==a?a:0),te=null!==(l=null==H?void 0:H.length)&&void 0!==l?l:0;Z.current!==te&&(Z.current=te,J.current=new Map);const ne=r(()=>{if(!H||0===H.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,C,M,_,P,L,B,N,T,H,I,F,z,W,$,E,Y,G,q,X,V,U,Q,J,Z,te,ne;switch(n.type){case"label":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return jt(r,s,i)?e(wt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return jt(r,s,i)?e(wt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=At(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ot(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:At(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ot(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=D(r),a=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:At(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ot(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=At(t,i),a=Ot(t,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=At(n,i),r=Ot(n,i);return e(wt,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",f=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const v=n.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)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=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===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?ee.polynomial(f,{order:n.order||2}):ee.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(f=null==r?void 0:r(n.y0))&&void 0!==f?f:0,a=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ct[i.curve||"linear"]||K,p=R().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const f=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:f,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(j=i.scales)||void 0===j?void 0:j.time,l=null!==(M=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==M?M:null===(_=i.scales)||void 0===_?void 0:_.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,f=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(B=n.anomalyRadius)&&void 0!==B?B:6,x=l(u+g*h),k=l(p),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[f&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=At(t,i),r=Ot(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(T=null===(N=i.scales)||void 0===N?void 0:N.x)&&void 0!==T?T:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(F=null===(I=i.scales)||void 0===I?void 0:I.y)&&void 0!==F?F:null===(z=i.scales)||void 0===z?void 0:z.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=ee.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),f=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(W=n.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==($=n.steps)&&void 0!==$?$:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-f,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(d(x))}`,C=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e("polyline",{points:`${j} ${S}`,fill:"none",stroke:C,strokeWidth:null!==(Y=n.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:C,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=St(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!jt(t,r,i))return null;const s=null!==(q=n.dx)&&void 0!==q?q:0,a=null!==(X=n.dy)&&void 0!==X?X:0,l=null!==(V=n.width)&&void 0!==V?V:32,c=null!==(U=n.height)&&void 0!==U?U:32,u=null!==(Q=n.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=St(n,o,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(Z=i.scales)||void 0===Z?void 0:Z.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:c===a)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:f?{x:f.x,y:f.y,time:f.x,value:f.y}:null,timeAxis:"x",xAccessor:F,yAccessor:z,width:c,height:d,data:W,frameType:"xy",pointNodes:$,curve:E,stickyPositionCache:J.current};return H.map((e,t)=>{if(I){const i=I(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[H,I,c,d,F,z,W,f,$,E]),oe=function(e){var t;const n=u(e?Tt:It,e?Nt:Ft,e?Nt:Ft);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(G);return s(()=>{if(!(null==oe?void 0:oe.locked)||!G)return;const e=e=>{"Escape"===e.key&&Bt(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,G]),y||O||S||L||B||ne&&ne.length>0||A||X||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[A&&f&&!Y&&(()=>{var n,o;const i=zt(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=zt(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[V.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),U.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&f&&(()=>{const o=null==m?void 0:m.find(e=>"left"===e.orient),i=null==m?void 0:m.find(e=>"bottom"===e.orient),r=!o||!1!==o.baseline,s=!i||!1!==i.baseline,a=(null==o?void 0:o.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,u=null==i?void 0:i.landmarkTicks,h=null==o?void 0:o.landmarkTicks,g="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&V.length>1&&(()=>{const e=c/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!Y&&s&&!l&&e("line",{x1:0,y1:d,x2:c,y2:d,stroke:g,strokeWidth:1}),!Y&&l&&e("path",{d:Wt("bottom",c,d),fill:"none",stroke:g,strokeWidth:1}),V.map((n,o)=>{const i=!!u&&("function"==typeof u?u(n.value,o):qe(n.value,o>0?V[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:c/2,y:d+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:v}),!Y&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:g,strokeWidth:1}),!Y&&a&&e("path",{d:Wt("left",c,d),fill:"none",stroke:g,strokeWidth:1}),U.map((n,o)=>{const i=!!h&&("function"==typeof h?h(n.value,o):qe(n.value,o>0?U[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-p.left,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${d/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o||0===Q.length)return null;const i=o.landmarkTicks,r=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:c,y1:0,x2:c,y2:d,stroke:g,strokeWidth:1}),Q.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):qe(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:f,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+p.right-15}, ${d/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),ne,B&&f&&N&&T&&t(n,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(ft,{orient:"top",config:pt(B.top),values:N,scale:f.x,size:p.top,length:c})}),B.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(ft,{orient:"bottom",config:pt(B.bottom),values:N,scale:f.x,size:p.bottom,length:c})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(ft,{orient:"left",config:pt(B.left),values:T,scale:f.y,size:p.left,length:d})}),B.right&&e("g",{transform:`translate(${c}, 0)`,children:e(ft,{orient:"right",config:pt(B.right),values:T,scale:f.y,size:p.right,length:d})})]}),L,oe&&oe.sourceId!==q&&(null==f?void 0:f.x)&&(()=>{const t=f.x(oe.xValue);if(null==t||0>t||t>c)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,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"})})(),X]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof O?O:null}),gt({legend:S,totalWidth:h,totalHeight:g,margin:p,legendPosition:P,title:O,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_})]}):null}function Yt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Gt="undefined"==typeof window||"undefined"==typeof document,qt=o.createContext(null),Xt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Vt(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 Ut=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"},Kt={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)"},Zt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},en={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)"},tn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},nn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function on({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(qt),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,f=o.useCallback(()=>{l||d||c(!0)},[l,d]),y=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Xt}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:f,style:Xt,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":j.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=C.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=C.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(p=C.cy)&&void 0!==p?p:C.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(f=C.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=C.cx)&&void 0!==m?m:C.x,y:null!==(v=C.cy)&&void 0!==v?v:C.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=C.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=C.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(n),v=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}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ut(e.min)} to ${Ut(e.max)}, mean ${Ut(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(" ")}(m.length,v),x=m.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:Qt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Jt,children:"×"}),e("div",{role:"note",style:Kt,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Zt,children:[t("caption",{style:nn,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:en,children:"type"}),w.map(t=>e("th",{style:en,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:tn,children:n.label}),w.map(t=>{return e("td",{style:tn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ut(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function rn({summary:t}){return t?e("div",{role:"note",style:Xt,children:t}):null}function sn({tableId:t}){return e("a",{href:"#"+t,style:Xt,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,Xt)},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("div",{"aria-live":"polite","aria-atomic":"true",style:Xt,children:n})}const ln="var(--semiotic-focus, #005fcc)";function cn({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:ln,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:ln,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ln,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function un({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.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})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function dn(e,t,n){const o=i(null),[r,a]=d(null);return s(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const hn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,gn=new WeakMap;let pn=0,fn=!1,yn=null,mn=null,vn=null;function bn(e,t){var n,o;if(!t)return t;const i=hn.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(fn)return;if("undefined"==typeof window||"undefined"==typeof document)return;fn=!0;const e=()=>{pn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(yn=new MutationObserver(e),yn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{mn=window.matchMedia("(prefers-color-scheme: dark)"),vn=e,"function"==typeof mn.addEventListener?mn.addEventListener("change",vn):"function"==typeof mn.addListener&&mn.addListener(vn)}catch(e){}}();let s=gn.get(r);s&&s.version===pn||(s={version:pn,map:new Map},gn.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function xn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function kn(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[a,l]=dn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=xn(e.foregroundGraphics,l,u),f=xn(e.backgroundGraphics,l,u),y=pe(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=c(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),O=i(()=>{}),S=i(null),j=i(0),C=c(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),M=c(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(C))},[C]),_=c(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);s(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return s(()=>{P&&(pn++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:_}}function wn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),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 An(e){switch(e){case"monotoneX":return Q;case"monotoneY":return U;case"cardinal":return Y;case"catmullRom":return E;case"step":return V;case"stepBefore":return q;case"stepAfter":return X;case"basis":return G;case"natural":return Z;default:return null}}function On(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 Sn(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 a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,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;l>o&&(r*=o/l),l>a-o&&(r*=(a-o)/l),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 jn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",u=bn(e,c)||c,d=a.style.strokeWidth||2,h=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 m=null!==(i=a.style.opacity)&&void 0!==i?i:1;Sn(e,a.path,u,d,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=An(a.curve),f=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!f){e.strokeStyle=u;const v=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(f){let x=null,k=null,w=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function j(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[M,_]=a.path[C],P=g[C],L=On(P,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,_);else{const B=[];for(const N of h){const T=N.value;(w>T||T>P)&&(T>w||P>T)||w===T||P===T||B.push({t:(T-w)/(P-w)})}B.sort((e,t)=>e.t-t.t);for(const H of B){const I=x+(M-x)*H.t,F=k+(_-k)*H.t,z=On(w+(P-w)*Math.min(H.t+1e-4,1),h,u);e.lineTo(I,F),j(),S(z,I,F)}e.lineTo(M,_)}x=M,k=_,w=P,A=L}else S(L,M,_),x=M,k=_,w=P,A=L}j()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=u;else{const W=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const $ of a.strokeGradient.colorStops)W.addColorStop(Math.max(0,Math.min(1,$.offset)),$.color);e.strokeStyle=W}if(p)J().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[D,R]=a.path[0];e.moveTo(D,R);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=("string"==typeof a.style.fill?bn(e,a.style.fill):a.style.fill)||a.style.fill,p&&!f)J().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][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!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Cn(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]}function Mn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function _n(e,t,n=.3){Mn(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 Pn(e,t,n=.6){var o,i,r,s,a;if(!Mn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ln(e,t,n,o=.35){Mn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Bn(e){switch(e){case"monotoneX":return Q;case"monotoneY":return U;case"cardinal":return Y;case"catmullRom":return E;case"step":return V;case"stepBefore":return q;case"stepAfter":return X;case"basis":return G;case"natural":return Z;default:return null}}function Nn(e,t){const n=Bn(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().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 Tn=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const a=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[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=bn(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*(l[n]+l[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 c=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Nn(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=e.createLinearGradient(0,n,0,o);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const[n,o,r]=Cn(e,"string"==typeof a?a:"#4e79a7");i.addColorStop(0,`rgba(${n},${o},${r},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${n},${o},${r},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=c}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*c,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Nn(e,t),Ln(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=c,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Bn(t.curve);if(e.beginPath(),n)J().x(e=>e[0]).y(e=>e[1]).curve(n).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!==n&&1>n&&e.restore(),e.globalAlpha=1}},Hn=(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=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?bn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Pn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function In(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=Cn(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const Fn=(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)zn(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||bn(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?In(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?bn(e,t.style.fill):t.style.fill)||bn(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?In(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=bn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}_n(e,t),e.globalAlpha=1}};function zn(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 Wn(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function $n(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 Dn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function En(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`${Rn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Rn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Yn={line:[Tn,jn,Hn],area:[Tn,Hn],stackedarea:[Tn,Hn],scatter:[Hn],bubble:[Hn],heatmap:[(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=bn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),_n(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):Dn(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=$n(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}}],bar:[Fn],swarm:[Hn],waterfall:[(e,t,n,o)=>{var i,r,s;Fn(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=bn(e,c)||c,e.lineWidth=null!==(i=null==l?void 0:l._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],i=a[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 l=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const a=(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!==a&&(e.globalAlpha=a);const l=bn(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,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=bn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}}],mixed:[Tn,jn,Hn]},Gn={top:20,right:20,bottom:30,left:40},qn={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 Xn(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 Vn={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 Un({hover:n}){const o=e=>Number.isInteger(e)?e+"":e.toFixed(2);return t("div",{className:"semiotic-tooltip",style:Vn,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:o(n.value)}),e("div",{style:{opacity:.7,fontSize:11},children:o(n.time)})]})}const Qn=h(function(n,a){var l,u,h,p,f,y,m,v,b,x,k;const{chartType:w,runtimeMode:A,data:O,chunkThreshold:S,chunkSize:j,xAccessor:C,yAccessor:M,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:B,curve:N,normalize:T,binSize:H,valueAccessor:I,arrowOfTime:F="right",windowMode:z="sliding",windowSize:W=200,timeAccessor:$,xExtent:D,yExtent:R,extentPadding:E=.1,scalePadding:Y,sizeRange:G,size:q=[500,300],responsiveWidth:X,responsiveHeight:V,margin:U,className:Q,background:K,lineStyle:J,pointStyle:Z,areaStyle:ee,barStyle:te,waterfallStyle:ne,swarmStyle:re,barColors:se,colorScheme:le,boundsAccessor:ce,boundsStyle:ue,y0Accessor:de,gradientFill:he,lineGradient:ge,areaGroups:pe,openAccessor:fe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:Se,yFormat:je,tickFormatTime:Ce,tickFormatValue:Me,hoverAnnotation:_e,tooltipContent:Pe,customHoverBehavior:Le,customClickBehavior:Be,enableHover:Ne,hoverRadius:Te=30,tooltipMode:He,annotations:Ie,svgAnnotationRules:Fe,showGrid:ze,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,backgroundGraphics:qe,foregroundGraphics:Ue,canvasPreRenderers:Qe,svgPreRenderers:Ke,title:Je,categoryAccessor:Ze,brush:et,onBrush:tt,decay:rt,pulse:st,transition:at,animate:lt,staleness:ct,heatmapAggregation:ut,heatmapXBins:dt,heatmapYBins:ht,showValues:gt,heatmapValueFormat:pt,marginalGraphics:ft,pointIdAccessor:yt,xScaleType:mt,yScaleType:vt,accessibleTable:bt=!0,description:xt,summary:kt,linkedCrosshairName:wt,linkedCrosshairSourceId:At}=n,Ot=i(!1),St=kn({sizeProp:q,responsiveWidth:X,responsiveHeight:V,userMargin:U,marginDefault:Gn,animate:lt,transitionProp:at,themeDirtyRef:Ot}),{reducedMotionRef:jt,responsiveRef:Ct,size:Mt,currentTheme:_t,transition:Pt,introEnabled:Lt,tableId:Bt,rafRef:Nt,renderFnRef:Tt,scheduleRender:Ht}=St;let It=St.margin;if(ft){const e=60,t=Object.assign({},St.margin);ft.top&&e>t.top&&(t.top=e),ft.bottom&&e>t.bottom&&(t.bottom=e),ft.left&&e>t.left&&(t.left=e),ft.right&&e>t.right&&(t.right=e),It=t}const Ft="function"==typeof Ue?Ue({size:Mt,margin:It}):Ue,zt="function"==typeof qe?qe({size:Mt,margin:It}):qe,Wt=Mt[0]-It.left-It.right,Dt=Mt[1]-It.top-It.bottom,Rt=null!=_e?_e:Ne,qt=i(null),Xt=i(null),[Ut,Qt]=d(0),[Kt,Jt]=d(null),Zt=i(null),en=i(null),[tn,nn]=d(null),ln=i(qn.primary),[dn,hn]=d(!1),[gn,pn]=d([]),[fn,yn]=d([]),mn="streaming"===A||["bar","swarm","waterfall"].includes(w),vn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:mn?"streaming":"bounded",windowSize:W,windowMode:z,arrowOfTime:mn?F:"right",extentPadding:E,scalePadding:Y,xAccessor:mn?void 0:C,yAccessor:mn?void 0:M,timeAccessor:mn?$:void 0,valueAccessor:I,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(B?"_lineGroup":void 0),categoryAccessor:Ze,lineDataAccessor:B,xScaleType:mt,yScaleType:vt,xExtent:D,yExtent:R,sizeRange:G,binSize:H,normalize:T,boundsAccessor:ce,boundsStyle:ue,y0Accessor:de,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:pe?new Set(pe):void 0,lineGradient:ge,openAccessor:fe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,lineStyle:J,pointStyle:Z,areaStyle:ee,swarmStyle:re,waterfallStyle:ne,colorScheme:le,barColors:se,barStyle:te,annotations:Ie,decay:rt,pulse:st,transition:Pt,introAnimation:Lt,staleness:ct,heatmapAggregation:ut,heatmapXBins:dt,heatmapYBins:ht,showValues:gt,heatmapValueFormat:pt,pointIdAccessor:yt,curve:N,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:ae(_t),themeSequential:null===(t=null==_t?void 0:_t.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==_t?void 0:_t.colors)||void 0===n?void 0:n.diverging}},[w,W,z,F,E,Y,C,M,$,I,mt,vt,_,P,L,Ze,B,D,R,G,H,T,ce,ue,de,he,ge,pe,fe,ye,me,ve,be,J,Z,ee,re,ne,te,le,se,Ie,rt,st,null==Pt?void 0:Pt.duration,null==Pt?void 0:Pt.easing,Lt,ct,ut,dt,ht,gt,pt,mn,yt,N,_t]),bn=i(null);bn.current||(bn.current=new Re(vn)),s(()=>{var e;null===(e=bn.current)||void 0===e||e.updateConfig(vn),Ot.current=!0,Ht()},[vn,Ht]);const xn=i(null);xn.current||(xn.current=new ie(e=>{const t=bn.current;t&&t.ingest(e)&&(Ot.current=!0,Ht())},{chunkThreshold:S,chunkSize:j})),s(()=>{var e;null===(e=xn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:S,chunkSize:j})},[S,j]);const An=c(e=>{var t;null===(t=xn.current)||void 0===t||t.push(e)},[]),On=c(e=>{var t;null===(t=xn.current)||void 0===t||t.pushMany(e)},[]),Sn=c(()=>{var e,t;null===(e=xn.current)||void 0===e||e.clear(),null===(t=bn.current)||void 0===t||t.clear(),Ot.current=!0,Ht()},[Ht]);g(a,()=>({push:An,pushMany:On,remove:e=>{var t,n,o;null===(t=xn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=bn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(Zt.current&&i.some(e=>{var t;return e===(null===(t=Zt.current)||void 0===t?void 0:t.data)})&&(Zt.current=null,nn(null)),Ot.current=!0,Ht()),i},update:(e,t)=>{var n,o,i;null===(n=xn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=bn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ht()),r},clear:Sn,getData:()=>{var e,t,n;return null===(e=xn.current)||void 0===e||e.flush(),null!==(n=null===(t=bn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=bn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=bn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[An,On,Sn,Ht]),s(()=>{var e,t;if(O){if(B&&O.length>0&&"object"==typeof O[0]&&null!==O[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(O[0][t])){const n=[];for(const e of O){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=xn.current)||void 0===e||e.setBoundedData(n))}}null===(t=xn.current)||void 0===t||t.setBoundedData(O)}},[O,B]);const{hoverHandlerRef:jn,hoverLeaveRef:Cn,onPointerMove:Mn,onPointerLeave:_n}=St;jn.current=e=>{if(!Rt)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-It.left,i=e.clientY-n.top-It.top;if(0>o||o>Wt||0>i||i>Dt)return void(Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&(Le(null),Ot.current=!0),Ht()));const r=bn.current;if(!r||0===r.scene.length)return;const s=Xe(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);if(!s)return void(Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&Le(null),Ht()));const a=Wn(s.datum||{},s.x,s.y);if("multi"===He&&r.scene.length>0&&r.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=Ve(e.path,t,n);if(null===r)continue;const s=nt(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=Ve(e.topPath,t,n);if(null===r)continue;const s=nt(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:r,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(r.scene,s.x,Te),t=r.scales.y.invert,n=r.scales.x.invert;if(e.length>0){const o=n?n(s.x):s.x;a.xValue=o,a.xPx=s.x;const i=ln.current;a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||i,datum:e.datum}))}}Zt.current=a,en.current=s.node,nn(a),Le&&(Le(a),Ot.current=!0),Ht()},Cn.current=()=>{Zt.current&&(Zt.current=null,en.current=null,nn(null),Le&&(Le(null),Ot.current=!0),Ht())};const Pn=i(()=>{});Pn.current=e=>{if(!Be)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-It.left,i=e.clientY-n.top-It.top;if(0>o||o>Wt||0>i||i>Dt)return void Be(null);const r=bn.current;if(!r||0===r.scene.length)return void Be(null);const s=Xe(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);Be(s?Wn(s.datum||{},s.x,s.y):null)};const Ln=c(e=>Pn.current(e),[]),Bn=i(-1),Nn=i(null),Tn=i(null),Hn=c(e=>{const t=bn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Tn.current&&Tn.current.version===n)o=Tn.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),Tn.current={version:n,graph:o}}const i=Bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Bn.current=0;const t=o.flat[0];Nn.current={shape:t.shape,w:t.w,h:t.h};const n=it(t);return Zt.current=n,nn(n),Le&&Le(n),void Ht()}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?ot(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ot(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 Bn.current=-1,Nn.current=null,Zt.current=null,en.current=null,nn(null),Le&&Le(null),void Ht();Bn.current=s;const a=o.flat[s];Nn.current={shape:a.shape,w:a.w,h:a.h};const l=it(a);Zt.current=l,nn(l),Le&&Le(l),Ht()},[Le,Ht]),In=c(e=>{Bn.current=-1,Nn.current=null,Mn(e)},[Mn]);Tt.current=()=>{var e,t;Nt.current=0;const n=qt.current,o=Xt.current;if(!n||!o)return;const i=bn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(jt.current?r+1e6:r),a=!jt.current&&s,l=Ot.current||s;l&&!a&&i.computeScene({width:Wt,height:Dt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return qn;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(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||r?{axisStroke:l||qn.axisStroke,tickText:s||qn.tickText,crosshair:s?Xn(s,"66"):qn.crosshair,hoverFill:c?Xn(c,"4D"):qn.hoverFill,hoverStroke:s?Xn(s,"99"):qn.hoverStroke,pointRing:c||qn.pointRing,primary:r||qn.primary}:qn}(n);ln.current=u.primary;const d=null!==(e=null==ct?void 0:ct.threshold)&&void 0!==e?e:5e3,h=ct&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=wn(n,Mt,It,c);if(e){if(e.clearRect(-It.left,-It.top,Mt[0],Mt[1]),h&&(e.globalAlpha=null!==(t=null==ct?void 0:ct.dimOpacity)&&void 0!==t?t:.5),"transparent"!==K&&!qe){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=K||(t&&"transparent"!==t?t:null);o&&(e.fillStyle=o,e.fillRect(-It.left,-It.top,Mt[0],Mt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Wt,Dt),e.clip()),Qe&&i.scales)for(const t of Qe)e.save(),t(e,i.scene,i.scales,{width:Wt,height:Dt}),e.restore();const o=Yn[w];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:Wt,height:Dt});e.restore(),h&&(e.globalAlpha=1)}}{const e=wn(o,Mt,It,c);if(e&&(e.clearRect(-It.left,-It.top,Mt[0],Mt[1]),Rt&&Zt.current&&i.scales&&function(e,t,n,o,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)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,Zt.current,Wt,Dt,"object"==typeof Rt?Rt:{},en.current,u),en.current&&Array.isArray(_e))){const t=_e.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,en.current,t,u)}}l&&n&&n.setAttribute("aria-label",Vt(i.scene,w+" chart"));const g=Ot.current;if(Ot.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Kt||e(Kt.x.domain()[0])!==e(i.scales.x.domain()[0])||e(Kt.x.domain()[1])!==e(i.scales.x.domain()[1])||e(Kt.y.domain()[0])!==e(i.scales.y.domain()[0])||e(Kt.y.domain()[1])!==e(i.scales.y.domain()[1])||Kt.x.range()[0]!==i.scales.x.range()[0]||Kt.x.range()[1]!==i.scales.x.range()[1]||Kt.y.range()[0]!==i.scales.y.range()[0]||Kt.y.range()[1]!==i.scales.y.range()[1])&&Jt(i.scales),ft){const e=i.getData(),t="function"==typeof C?C:e=>e[C||"x"],n="function"==typeof M?M:e=>e[M||"y"];pn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),yn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ie&&Ie.length>0&&Qt(e=>e+1),(null==ct?void 0:ct.showBadge)&&hn(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Tt.current()))},s(()=>(Ht(),()=>{var e;null===(e=xn.current)||void 0===e||e.clear()}),[Ht]),s(()=>{Ot.current=!0,Ht()},[w,Wt,Dt,xe,K,J,Qe,Ht]),function(e,t,n,o,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=l-a.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,i,o])}(ct,bn,Ot,Ht,dn,hn);const Fn=r(()=>{if(Se||Ce)return;const e=bn.current;return(null==e?void 0:e.xIsDate)&&Kt?En(Kt.x.domain()):void 0},[Se,Ce,Kt]),zn=Se||Ce||Fn,$n=Rt&&tn?Pe?Pe(tn):e(Un,{hover:tn}):null,Dn=$n?e(un,{x:tn.x,y:tn.y,containerWidth:Wt,containerHeight:Dt,margin:It,className:"stream-frame-tooltip",children:$n}):null,Rn=Nn.current,Vn=e(cn,{active:Bn.current>=0,hoverPoint:tn,margin:It,size:Mt,shape:null==Rn?void 0:Rn.shape,width:null==Rn?void 0:Rn.w,height:null==Rn?void 0:Rn.h}),Qn=(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},Kn=Qn(C,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),Jn=Qn(M,I,"__semiotic_resolvedY","__semiotic_resolvedValue"),Zn=Kn.key,eo=Jn.key,to=Ie&&Ie.length>0,no=e=>{if(!e||!to||!Kn.fn&&!Jn.fn)return e;let t=!1;const n=e.map(e=>{const n=Kn.fn&&Kn.key&&!(Kn.key in e),o=Jn.fn&&Jn.key&&!(Jn.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[Kn.key]=Kn.fn(e)),o&&(i[Jn.key]=Jn.fn(e)),i});return t?n:e};if(Gt){const n=bn.current;n&&O&&(n.ingest({inserts:O,bounded:!0}),n.computeScene({width:Wt,height:Dt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s=zn||(()=>{if((null==n?void 0:n.xIsDate)&&r)return En(r.x.domain())})();return t("div",{className:"stream-xy-frame"+(Q?" "+Q:""),role:"img","aria-label":xt||("string"==typeof Je?Je:"XY chart"),style:{position:"relative",width:Mt[0],height:Mt[1]},children:[e(rn,{summary:kt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${It.left},${It.top})`,children:zt}),t("g",{transform:`translate(${It.left},${It.top})`,children:[K&&e("rect",{x:0,y:0,width:Wt,height:Dt,fill:K}),Ke&&r&&Ke.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:Wt,height:Dt})},"svgpre-"+n)),i.map((n,o)=>function(n,o){var i,r,s;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const t=n;if(0===t.topPath.length)return null;const s=t.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...t.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:`M${s}L${a}Z`,fill:Yt(t.style.fill),fillOpacity:null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.7,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Yt(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Yt(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o)).filter(Boolean)]})]}),e(Et,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:r,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:s,yFormat:je||Me,showGrid:ze,title:Je,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,foregroundGraphics:Ft,marginalGraphics:ft,xValues:[],yValues:[],annotations:Ie,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:Zn,yAccessor:eo,annotationData:no(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,linkedCrosshairName:wt,linkedCrosshairSourceId:At})]})}return t("div",{ref:Ct,className:"stream-xy-frame"+(Q?" "+Q:""),role:"group","aria-label":xt||("string"==typeof Je?Je:"XY chart"),tabIndex:0,style:{position:"relative",width:X?"100%":Mt[0],height:V?"100%":Mt[1],overflow:"visible"},onKeyDown:Hn,children:[bt&&e(sn,{tableId:Bt}),bt&&e(on,{scene:null!==(p=null===(h=bn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Bt,chartTitle:"string"==typeof Je?Je:void 0}),e(rn,{summary:kt}),t("div",{role:"img","aria-label":xt||("string"==typeof Je?Je:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Rt?In:void 0,onMouseLeave:Rt?_n:void 0,onClick:Be?Ln:void 0,children:[zt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Mt[0],height:Mt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${It.left},${It.top})`,children:zt})}),e($t,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:Kt,showAxes:xe,axes:ke,showGrid:ze,xFormat:zn,yFormat:je||Me}),e("canvas",{ref:qt,"aria-label":Vt(null!==(y=null===(f=bn.current)||void 0===f?void 0:f.scene)&&void 0!==y?y:[],w+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:Xt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(an,{hoverPoint:tn}),e(Et,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,scales:Kt,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:Oe,xFormat:zn,yFormat:je||Me,showGrid:ze,title:Je,legend:We,legendHoverBehavior:$e,legendClickBehavior:De,legendHighlightedCategory:Ee,legendIsolatedCategories:Ye,legendPosition:Ge,foregroundGraphics:Ft,marginalGraphics:ft,xValues:gn,yValues:fn,annotations:Ie,svgAnnotationRules:Fe,annotationFrame:Ut,xAccessor:Zn,yAccessor:eo,annotationData:no(null===(m=bn.current)||void 0===m?void 0:m.getData()),pointNodes:null===(v=bn.current)||void 0===v?void 0:v.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,underlayRendered:!0,linkedCrosshairName:wt,linkedCrosshairSourceId:At}),(et||tt)&&e(oe,{width:Wt,height:Dt,totalWidth:Mt[0],totalHeight:Mt[1],margin:It,dimension:null!==(b=null==et?void 0:et.dimension)&&void 0!==b?b:"xy",scales:Kt,onBrush:null!=tt?tt:()=>{},binSize:H,snap:null==et?void 0:et.snap,binBoundaries:null!==(x=null==et?void 0:et.binBoundaries)&&void 0!==x?x:"bar"===w?null===(k=bn.current)||void 0===k?void 0:k.getBinBoundaries():void 0,snapDuring:null==et?void 0:et.snapDuring,streaming:"streaming"===A}),(null==ct?void 0:ct.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ct.badgePosition?{top:4,left:4}:"bottom-left"===ct.badgePosition?{bottom:4,left:4}:"bottom-right"===ct.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:dn?"#dc3545":"#28a745",color:"white"}),children:dn?"STALE":"LIVE"}),Vn,Dn]})]})});Qn.displayName="StreamXYFrame";const Kn=a(null);function Jn(){return l(Kn)}function Zn(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 eo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[to,no]=re(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=eo(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=eo(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}})}})),[oo,io]=re(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 ro(e){const t=p(),n=e.clientId||t,{name:o}=e,i=no(e=>e.selections.get(o)),s=no(e=>e.setClause),a=no(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Zn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}function so(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=ro({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}function ao(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function lo(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=ro({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&ao(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&ao(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}const co=a(!1);function uo({selections:e}){const t=no(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function ho({categoryColors:t,interaction:n,selectionName:o,field:a}){const l=Object.entries(t);if(0===l.length)return null;const u=l.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:l.map(([e,t])=>({label:e,color:t})),label:""}],g=so({name:o,fields:[a]}),p=ro({name:o,clientId:"__linked-legend-isolate__"}),[f,y]=d(new Set),[m,v]=d(null),b=i(p.selectPoints);b.current=p.selectPoints;const x=i(p.clear);x.current=p.clear,s(()=>{"isolate"===n&&(f.size>0?b.current({[a]:Array.from(f)}):x.current())},[n,f,a]);const k=c(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[a]:e.label})):(v(null),g.onHover(null)))},[n,a,g]),w=c(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[O]]=dn([0,0],!0,!1),S=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(l.map(([e])=>e),O),[l,O]);return e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"},children:e(dt,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:f})})})}function go({children:n,selections:o,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Jn(),u=void 0!==i?i:!(!c||0>=Object.keys(c).length);return e(to,{children:t(oo,{children:[o&&e(uo,{selections:o}),t(co.Provider,{value:u,children:[u&&"top"===r&&c&&e(ho,{categoryColors:c,interaction:s,selectionName:a,field:l}),n,u&&"bottom"===r&&c&&e(ho,{categoryColors:c,interaction:s,selectionName:a,field:l})]})]})})}function po({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),a=s?o(s,t,n):n?n(i):Oe[r%Oe.length];return{label:i+"",color:a}}),label:""}]}}function fo(e){return e?"string"==typeof e?{name:e}:e:null}function yo(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 mo(){return pe(e=>e.theme)}o.createContext(void 0);const vo="#007bff";function bo(){var e;const t=mo(),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 xo(e,t,n){const o=Jn(),i=bo();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Ce(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return Ce(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=Ce(e,t,s);return e=>o[e]||n(e)}return Ce(e,t,s)}if(o&&Object.keys(o).length>0){const e=Ce([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}function ko({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=ro({name:(null==e?void 0:e.name)||"__unused__"}),v=so({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=io(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=d(null),A=g||n[0],O=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),S=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Mt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Mt={positions:new Map(Mt.positions).set(e,{xValue:t,sourceId:n})},Pt())}(y.name||"hover",Number(e),f)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Lt(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,f,i,a,l,b,h,A]),j=c(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Mt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Mt.positions);return t.delete(e),Mt={positions:t},Pt(),!1}Mt={positions:new Map(Mt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Pt()}(y.name||"hover",Number(n),f)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[u,i,b,a,l,y,f]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Bt(e,f),Lt(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}function wo(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 Ao({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(co),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=po({data:e,colorBy:t,colorScale:n,getColor:je,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function Oo(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}const So={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 jo(e,t,n){var o,i,r,s,a,l,c;const u=So[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Co(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Co(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 Mo(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 _o={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 Po(e,t){return"function"==typeof t?t(e):e[t]}function Lo(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 Bo(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Po(n,i);l=Lo(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Po(n,o);c.push({label:t,value:Lo(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Lo(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Lo(n[e[0]],r))}}const u=Object.assign(Object.assign({},_o),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function No(t){if(!0===t)return Bo();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e("div",{className:"semiotic-tooltip",style:_o,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Bo(t):Bo())}function To(e){return"string"==typeof e?e:"value"}function Ho(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Io(e,t){if(!t)return Ho(e);try{const n=t(e);return null==n?Ho(e):n}catch(t){return Ho(e)}}function Fo(e,t){return"function"==typeof t?t(e):e[t]}function zo(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?Io(Fo(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:_o,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=Io(Fo(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function Wo({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class $o extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Wo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Do(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 Ro(e,t,n=3){let o,i=n+1;for(const n of t){const t=Do(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Eo(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Yo(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=Ro(e,t,3))&&void 0!==n?n:null)}function Go({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=Eo(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=Yo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const qo={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Xo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Vo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Uo=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Qo=["vertical","horizontal"],Ko={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Uo},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Uo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Uo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Xo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Qo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},qo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},qo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qo),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qo),Vo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},qo),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},qo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Qo},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},qo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qo),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},qo),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},qo),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qo),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qo),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Jo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Zo=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ei=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),ti=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ni=new Set(["LineChart","AreaChart","StackedAreaChart"]),oi=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function ii(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function ri(e,t){const n=ii(e),o=ii(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const si=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function ai(e,t){const n=[],o=function(e,t){const n=[],o=Ko[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Ko).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!Jo(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Ro(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Go({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=Eo(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Yo(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Ko[e]?(function(e,t,n){const o=Ko[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Ko[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Zo.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){ei.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Ko[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!ti.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ni.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=Ko[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!oi.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=ri(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=ri(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of si)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var li;const ci="undefined"!=typeof process&&"production"!==(null===(li=process.env)||void 0===li?void 0:li.NODE_ENV);function ui({componentName:t,width:n,height:o,chartProps:i,children:r}){return e($o,{fallback:r=>{let s="";if(ci&&i)try{const e=ai(t,i);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e(Wo,{componentName:t,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const di={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"},hi={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function gi(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},di),{width:n,height:o}),children:i||"No data available"}):null}function pi(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))),a=Math.floor((o-(i*(r+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},hi),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function fi(e,t,n,o){if(!ci)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 yi(e){const t=pe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function mi(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const vi="__forecastSegment";let bi=null;function xi(){return mi(this,void 0,void 0,function*(){return bi||(bi=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),bi})}const ki=h(function(n,o){var a,l;const u=i(null);g(o,()=>({push:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=u.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=u.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const h=jo(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:p,margin:f,className:y,xFormat:m,yFormat:v,xAccessor:b="x",yAccessor:x="y",lineBy:k,lineDataAccessor:w="coordinates",colorBy:A,colorScheme:O,curve:S="linear",showPoints:j=!1,pointRadius:C=3,fillArea:M=!1,areaOpacity:_=.3,lineWidth:P=2,lineGradient:L,tooltip:B,pointIdAccessor:N,annotations:T,directLabel:H,gapStrategy:I="break",anomaly:F,forecast:z,frameProps:W={},selection:$,linkedHover:D,onObservation:R,onClick:E,hoverHighlight:Y,hoverRadius:G,chartId:q,loading:X,emptyContent:V,legendInteraction:U,legendPosition:Q,xScaleType:K,yScaleType:J,color:Z,stroke:ee,strokeWidth:te,opacity:ne}=n,oe=h.width,ie=h.height,re=h.enableHover,se=h.showGrid,ae=h.showLegend,le=h.title,ce=h.description,ue=h.summary,de=h.accessibleTable,he=h.xLabel,ge=h.yLabel,pe=pi(X,oe,ie),fe=pe?null:gi(p,oe,ie,V),ye=p||[];fi("LineChart",ye,"xAccessor",b),fi("LineChart",ye,"yAccessor",x);const me="string"==typeof b?b:"__semiotic_resolvedX",ve="string"==typeof x?x:"__semiotic_resolvedY",[be,xe]=d(null),[ke,we]=d([]),Ae=r(()=>{if(!z&&!F)return ye;const e="function"==typeof b,t="function"==typeof x;return e||t?ye.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=b(n)),t&&(o.__semiotic_resolvedY=x(n)),o}):ye},[ye,z,F,b,x]),Oe=i(z),Se=i(F);s(()=>{if(!z&&!F)return void((Oe.current||Se.current)&&(xe(null),we([]),Oe.current=z,Se.current=F));let e=!1;const t=z!==Oe.current||F!==Se.current;if(Oe.current=z,Se.current=F,t&&(xe(null),we([])),z){const t=k&&"string"==typeof k&&"object"==typeof z?Object.assign(Object.assign({},z),{_groupBy:k}):z;(function(...e){return mi(this,void 0,void 0,function*(){return(yield xi()).buildForecast(...e)})})(Ae,me,ve,t,F).then(t=>{e||(xe(t),we(t.annotations))}).catch(()=>{e||(xe(null),we([]))})}else F&&function(...e){return mi(this,void 0,void 0,function*(){return(yield xi()).buildAnomalyAnnotations(...e)})}(F).then(t=>{e||(xe(null),we(t))}).catch(()=>{e||we([])});return()=>{e=!0}},[Ae,z,F,me,ve]);const Ce=be?be.processedData:ye,Me="__compoundGroup",_e=!(!z||!k),Pe=_e?Me:z?vi:k,Le=r(()=>{if(!_e)return Ce;const e="function"==typeof k?k:e=>e[k];return Ce.map(t=>{const n=Object.assign({},t);return n[Me]=`${e(t)}__${t[vi]||"observed"}`,n})},[Ce,_e,k]),Be=_e?Le:Ce,Ne=r(()=>{if(!z)return;const e=z.upperBounds,t=z.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be?be.processedData:ye;for(const e of s){const t="function"==typeof x?x(e):+e[x];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},[z,be,ye,x]),{activeSelectionHook:Te,hoverSelectionHook:He,customHoverBehavior:Ie,customClickBehavior:Fe,crosshairSourceId:ze}=ko({selection:$,linkedHover:D,fallbackFields:A?["string"==typeof A?A:""]:[],onObservation:R,onClick:E,chartType:"LineChart",chartId:q,hoverHighlight:Y,colorByField:"string"==typeof A?A:void 0}),We=yi($),$e=wo(D,ze),De=c(e=>{const t="function"==typeof b?b(e):e[b],n="function"==typeof x?x(e):e[x];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[b,x]),Re=void 0!==(null===(a=Be[0])||void 0===a?void 0:a[w]),Ee=r(()=>{if(Re)return Be;if(Pe){const e=Be.reduce((e,t)=>{const n="function"==typeof Pe?Pe(t):t[Pe];if(!e[n]){const o={[w]:[]};"string"==typeof Pe&&(o[Pe]=n),_e&&(o[vi]=t[vi],"string"==typeof k&&(o[k]=t[k])),e[n]=o}return e[n][w].push(t),e},{});return Object.values(e)}return[{[w]:Be}]},[Be,Pe,w,Re]),{gapProcessedLineData:Ye,hasGaps:Ge}=r(()=>{if("interpolate"===I){let e=!1;const t=[];for(const n of Ee){const o=(n[w]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===I){let e=!1;const t=[];for(const n of Ee){const o=n[w]||[];let i=[],r=0;const s=Pe&&"string"==typeof Pe?n[Pe]:void 0;for(const a of o)if(De(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[w]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===I){let e=!1;const t="string"==typeof x?x:"y",n=[];for(const o of Ee){const i=o[w]||[],r=[];for(const n of i)De(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[w]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Ee,hasGaps:!1}},[Ee,I,w,De,Pe,x]),qe=xo(Ce,A,O),Xe=r(()=>{if(!A)return[];const e=new Set;for(const t of Ce){const n="function"==typeof A?A(t):t[A];null!=n&&e.add(n+"")}return Array.from(e)},[Ce,A]),Ve=Oo(U,A,Xe),Ue=r(()=>He||(Ve.legendSelectionHook?Ve.legendSelectionHook:Te),[He,Ve.legendSelectionHook,Te]),Qe=r(()=>(e,t)=>{const n={strokeWidth:P},o=!0===M||Array.isArray(M)&&null!=t&&M.includes(t);return A?qe&&(n.stroke=je(e,A,qe),o&&(n.fill=n.stroke,n.fillOpacity=_)):(n.stroke=Z||vo,o&&(n.fill=Z||vo,n.fillOpacity=_)),n},[A,qe,P,M,_,Z]),[Ke,Je]=d(null);s(()=>{if(!z)return void Je(null);let e=!1;return function(...e){return mi(this,void 0,void 0,function*(){return(yield xi()).createSegmentLineStyle(...e)})}(Qe,z).then(t=>{e||Je(()=>t)}).catch(()=>{e||Je(null)}),()=>{e=!0}},[Qe,z]);const Ze=Ke||Qe,et=r(()=>Mo(Ze,{stroke:ee,strokeWidth:te,opacity:ne}),[Ze,ee,te,ne]),tt=r(()=>yo(et,Ue,We),[et,Ue,We]),nt=r(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return A?qe&&(t.fill=je(e.parentLine||e,A,qe)):t.fill=Z||vo,t}},[j,C,A,qe,Z]),ot=Array.isArray(M)?"mixed":M?"area":"line",it="object"==typeof H?H:{},rt=it.position||"end",st=it.fontSize||11,at=r(()=>{var e,t;if(!H||!A)return[];const n="function"==typeof b?b:e=>e[b],o="function"==typeof x?x:e=>e[x],i="function"==typeof A?A:e=>e[A],r=new Map;for(const n of Ye){const o=n[w]||[];if(0===o.length)continue;const s="end"===rt?o[o.length-1]:o[0],a=null!==(t=null!==(e=i(s))&&void 0!==e?e:i(n))&&void 0!==t?t:"";a&&!r.has(a+"")&&r.set(a+"",s)}const s=Array.from(r.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof b?b:"x"]:n(t),["string"==typeof x?x:"y"]:o(t),dx:"end"===rt?6:-6,dy:0,color:qe?qe(e):vo,fontSize:st}));s.sort((e,t)=>{const n="string"==typeof x?x:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof x?x:"y",n=s[e-1],o=s[e];st+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=st+2)}return s},[H,A,qe,Ye,w,b,x,rt,st]),lt=(!H||void 0!==ae)&&ae,ct=r(()=>{if(!H)return h.marginDefaults;const e=at.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*st);return Math.max(e,o)},0),t=e+10,n="end"===rt?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[H,at,st,rt,h.marginDefaults]),{legend:ut,margin:dt,legendPosition:ht}=Ao({data:Ye,colorBy:A,colorScale:qe,showLegend:lt,legendPosition:Q,userMargin:f,defaults:ct}),gt=k||A,pt=r(()=>zo([{label:he||To(b),accessor:b,role:"x",format:m},{label:ge||To(x),accessor:x,role:"y",format:v},...gt?[{label:To(gt),accessor:gt,role:"group"}]:[]]),[b,x,he,ge,gt,m,v]),ft=Go({componentName:"LineChart",data:Re?(null===(l=Ce[0])||void 0===l?void 0:l[w])||[]:p,accessors:{xAccessor:b,yAccessor:x}}),yt=r(()=>Re||Pe||Ge?Ye.flatMap(e=>{const t=e[w]||[];return Pe&&"string"==typeof Pe?t.map(t=>Object.assign(Object.assign({},t),{[Pe]:e[Pe]})):t}):Be,[Ye,w,Re,Pe,Be,Ge]),mt=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:ot},Array.isArray(M)&&{areaGroups:M}),L&&{lineGradient:L}),null!=G&&{hoverRadius:G}),null!=p&&{data:yt}),{xAccessor:b,yAccessor:x,xScaleType:K,yScaleType:J}),Ne&&{yExtent:Ne}),{groupAccessor:"break"===I&&Ge?"_gapSegment":Pe||void 0,curve:S,lineStyle:tt}),j&&{pointStyle:nt}),{size:[oe,ie],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:dt,showAxes:h.showAxes,xLabel:he,yLabel:ge,xFormat:m,yFormat:v,enableHover:re,showGrid:se}),ut&&{legend:ut,legendPosition:ht}),U&&"none"!==U&&{legendHoverBehavior:Ve.onLegendHover,legendClickBehavior:Ve.onLegendClick,legendHighlightedCategory:Ve.highlightedCategory,legendIsolatedCategories:Ve.isolatedCategories}),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),y&&{className:y}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===B?()=>null:"multi"===B?n=>{var o,i,r,s,a,l,c,u,d,h;const g=n.allSeries;if(!g||0===g.length){const t=null!==(a=null!==(s=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y)&&void 0!==s?s:n.value)&&void 0!==a?a:n.y;return e("div",{className:"semiotic-tooltip",style:_o,children:e("div",{children:Lo(t)})})}const p=null!==(h=null!==(u=null!==(l=n.xValue)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.time)&&void 0!==u?u:null===(d=n.data)||void 0===d?void 0:d.x)&&void 0!==h?h:n.time;return t("div",{className:"semiotic-tooltip",style:_o,children:[null!=p&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Lo(p)}),g.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Lo(n.value)})]},o))]})}:No(B)||pt}),"multi"===B&&{tooltipMode:"multi"}),(D||R||E||Y)&&{customHoverBehavior:Ie}),(R||E||D)&&{customClickBehavior:Fe}),N&&{pointIdAccessor:N}),((null==T?void 0:T.length)||ke.length||at.length)&&{annotations:[...T||[],...ke,...at]}),$e),W);return pe||fe||(ft?e(Wo,{componentName:"LineChart",message:ft,width:oe,height:ie}):e(ui,{componentName:"LineChart",width:oe,height:ie,children:e(Qn,Object.assign({ref:u},mt))}))});ki.displayName="LineChart";const wi=h(function(t,n){var o;const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:O,showLine:S=!0,lineWidth:j=2,showPoints:C=!1,pointRadius:M=3,tooltip:_,annotations:P,frameProps:L={},selection:B,linkedHover:N,onObservation:T,onClick:H,hoverHighlight:I,chartId:F,loading:z,emptyContent:W,legendInteraction:$,legendPosition:D,color:R,stroke:E,strokeWidth:Y,opacity:G}=t,q=a.width,X=a.height,V=a.enableHover,U=a.showGrid,Q=a.showLegend,K=a.title,J=a.description,Z=a.summary,ee=a.accessibleTable,te=a.xLabel,ne=a.yLabel,oe=pi(z,q,X),ie=oe?null:gi(l,q,X,W),re=l||[];fi("AreaChart",re,"xAccessor",p),fi("AreaChart",re,"yAccessor",f);const{activeSelectionHook:se,hoverSelectionHook:ae,customHoverBehavior:le,customClickBehavior:ce,crosshairSourceId:ue}=ko({selection:B,linkedHover:N,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:T,onClick:H,chartType:"AreaChart",chartId:F,hoverHighlight:I,colorByField:"string"==typeof x?x:void 0}),de=yi(B),he=wo(N,ue),ge=void 0!==(null===(o=re[0])||void 0===o?void 0:o[b]),pe=r(()=>{if(ge)return re;if(y){const e=re.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:re}]},[re,y,b,ge]),fe=xo(re,x,k),ye=r(()=>{if(!x)return[];const e=new Set;for(const t of re){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[re,x]),me=Oo($,x,ye),ve=r(()=>ae||(me.legendSelectionHook?me.legendSelectionHook:se),[ae,me.legendSelectionHook,se]),be=r(()=>e=>{const t={};if(x){if(fe){const n=je(e,x,fe);t.fill=n,S?(t.stroke=n,t.strokeWidth=j):t.stroke="none"}}else{const e=R||vo;t.fill=e,S?(t.stroke=e,t.strokeWidth=j):t.stroke="none"}return t.fillOpacity=A,t},[x,fe,R,A,S,j]),xe=r(()=>Mo(be,{stroke:E,strokeWidth:Y,opacity:G}),[be,E,Y,G]),ke=r(()=>yo(xe,ve,de),[xe,ve,de]),we=r(()=>{if(C)return e=>{const t={r:M,fillOpacity:1};return x?fe&&(t.fill=je(e.parentLine||e,x,fe)):t.fill=vo,t}},[C,M,x,fe]),{legend:Ae,margin:Oe,legendPosition:Se}=Ao({data:pe,colorBy:x,colorScale:fe,showLegend:Q,legendPosition:D,userMargin:c,defaults:a.marginDefaults}),Ce=y||x,Me=r(()=>zo([{label:te||To(p),accessor:p,role:"x",format:d},{label:ne||To(f),accessor:f,role:"y",format:h},...Ce?[{label:To(Ce),accessor:Ce,role:"group"}]:[]]),[p,f,te,ne,Ce,d,h]),_e=Go({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:f}}),Pe=r(()=>ge||y?pe.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):re,[pe,b,ge,y,re]),Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Pe}),{xAccessor:p,yAccessor:f,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),O&&{lineGradient:O}),{curve:w,lineStyle:ke}),C&&we&&{pointStyle:we}),{size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Oe,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:d,yFormat:h,enableHover:V}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:U}),Ae&&{legend:Ae,legendPosition:Se}),$&&"none"!==$&&{legendHoverBehavior:me.onLegendHover,legendClickBehavior:me.onLegendClick,legendHighlightedCategory:me.highlightedCategory,legendIsolatedCategories:me.isolatedCategories}),K&&{title:K}),J&&{description:J}),Z&&{summary:Z}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===_?()=>null:No(_)||Me}),(N||T||H||I)&&{customHoverBehavior:le}),(T||H||N)&&{customClickBehavior:ce}),P&&P.length>0&&{annotations:P}),he),L);return oe||ie||(_e?e(Wo,{componentName:"AreaChart",message:_e,width:q,height:X}):e(ui,{componentName:"AreaChart",width:q,height:X,children:e(Qn,Object.assign({ref:s},Le))}))});function Ai({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:s="right"}){const a=i(new Set),l=i([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),f=c(e=>t=>{p([t]),e(t)},[p]),y=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:Oe,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return po({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:je})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:f,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}wi.displayName="AreaChart";const Oi=h(function(t,n){var o;const s=i(null),a=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:j=3,normalize:C=!1,tooltip:M,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:N,onClick:T,hoverHighlight:H,chartId:I,loading:F,emptyContent:z,legendInteraction:W,legendPosition:$,color:D,stroke:R,strokeWidth:E,opacity:Y}=t,G=a.width,q=a.height,X=a.enableHover,V=a.showGrid,U=a.showLegend,Q=a.title,K=a.description,J=a.summary,Z=a.accessibleTable,ee=a.xLabel,te=a.yLabel,ne=pi(F,G,q),oe=ne?null:gi(l,G,q,z),ie=l||[],re=Ai({isPushMode:void 0===l,colorBy:b||m,colorScheme:x,showLegend:U,legendPosition:$}),se=c(re.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[re.wrapPush]),ae=c(re.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[re.wrapPushMany]);g(n,()=>({push:se,pushMany:ae,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;re.resetCategories(),null===(e=s.current)||void 0===e||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}}),[se,ae,re.resetCategories]);const{activeSelectionHook:le,hoverSelectionHook:ce,customHoverBehavior:ue,customClickBehavior:de,crosshairSourceId:he}=ko({selection:L,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:N,onClick:T,chartType:"StackedAreaChart",chartId:I,hoverHighlight:H,colorByField:"string"==typeof b?b:void 0}),ge=yi(L),pe=wo(B,he),fe=void 0!==(null===(o=ie[0])||void 0===o?void 0:o[v]),ye=r(()=>{if(fe)return ie;if(m){const e=ie.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:ie}]},[ie,m,v,fe]),me=xo(ie,b,x),ve=r(()=>{if(!b)return[];const e=new Set;for(const t of ie){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ie,b]),be=Oo(W,b,ve),xe=r(()=>ce||(be.legendSelectionHook?be.legendSelectionHook:le),[ce,be.legendSelectionHook,le]),ke=r(()=>e=>{const t={};if(b&&me){const n=je(e,b,me);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else if(!b){const e=D||vo;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=O)}return t.fillOpacity=w,t},[b,me,w,A,O,D]),we=r(()=>Mo(ke,{stroke:R,strokeWidth:E,opacity:Y}),[ke,R,E,Y]),Ae=r(()=>yo(we,xe,ge),[we,xe,ge]),Oe=r(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return b?me&&(t.fill=je(e.parentLine||e,b,me)):t.fill=D||vo,t}},[S,j,b,me,D]),{legend:Se,margin:Ce,legendPosition:Me}=Ao({data:ye,colorBy:b,colorScale:me,showLegend:U,legendPosition:$,userMargin:u,defaults:a.marginDefaults}),_e=re.streamingLegend||Se,Pe=$||Me,Le=r(()=>{if(re.streamingMarginAdjust){const e=Object.assign({},Ce);for(const[t,n]of Object.entries(re.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ce},[Ce,re.streamingMarginAdjust]),Be=m||b,Ne=r(()=>zo([{label:ee||To(f),accessor:f,role:"x",format:h},{label:te||To(y),accessor:y,role:"y",format:p},...Be?[{label:To(Be),accessor:Be,role:"group"}]:[]]),[f,y,ee,te,Be,h,p]),Te=Go({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:f,yAccessor:y}}),He=r(()=>fe||m?ye.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):ie,[ye,v,fe,m,ie]),Ie=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:"stackedarea"},null!=l&&{data:He}),{xAccessor:f,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:C,lineStyle:Ae}),S&&Oe&&{pointStyle:Oe}),{size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Le,showAxes:a.showAxes,xLabel:ee,yLabel:te,xFormat:h,yFormat:p,enableHover:X}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:V}),_e&&{legend:_e,legendPosition:Pe}),W&&"none"!==W&&{legendHoverBehavior:be.onLegendHover,legendClickBehavior:be.onLegendClick,legendHighlightedCategory:be.highlightedCategory,legendIsolatedCategories:be.isolatedCategories}),Q&&{title:Q}),K&&{description:K}),J&&{summary:J}),void 0!==Z&&{accessibleTable:Z}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===M?()=>null:No(M)||Ne}),(B||N||T||H)&&{customHoverBehavior:ue}),(N||T||B)&&{customClickBehavior:de}),_&&_.length>0&&{annotations:_}),pe),P);return ne||oe||(Te?e(Wo,{componentName:"StackedAreaChart",message:Te,width:G,height:q}):e(ui,{componentName:"StackedAreaChart",width:G,height:q,children:e(Qn,Object.assign({ref:s},Ie))}))});function Si(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:f,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,O="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:S,hoverSelectionHook:j,customHoverBehavior:C,customClickBehavior:M,crosshairSourceId:_}=ko({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v,hoverHighlight:b,colorByField:O}),P=wo(c,_),L=xo(t,o,i),B=r(()=>{if(!o)return[];const e=new Set;for(const n of t){const t="function"==typeof o?o(n):n[o];null!=t&&e.add(t+"")}return Array.from(e)},[t,o]),N=Oo(s,o,B),T=r(()=>j||(N.legendSelectionHook?N.legendSelectionHook:S),[j,N.legendSelectionHook,S]),H=yi(l),{legend:I,margin:F,legendPosition:z}=Ao({data:t,colorBy:o,colorScale:L,showLegend:f,legendPosition:a,userMargin:y,defaults:m}),W=r(()=>{const e={};return I&&(e.legend=I,e.legendPosition=z),s&&"none"!==s&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[I,z,s,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),$=pi(x,w,A),D=$?null:gi(n,w,A,k);return{colorScale:L,allCategories:B,legendState:N,effectiveSelectionHook:T,activeSelectionHook:S,customHoverBehavior:C,customClickBehavior:M,legend:I,margin:F,legendPosition:z,earlyReturn:$||D||null,legendBehaviorProps:W,crosshairProps:P,resolvedSelection:H}}Oi.displayName="StackedAreaChart";const ji=h(function(t,n){const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",colorBy:m,colorScheme:v,sizeBy:b,sizeRange:x=[3,15],pointRadius:k=5,pointOpacity:w=.8,tooltip:A,marginalGraphics:O,pointIdAccessor:S,annotations:j,frameProps:C={},selection:M,linkedHover:_,linkedBrush:P,onObservation:L,onClick:B,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,legendInteraction:F,legendPosition:z,color:W,stroke:$,strokeWidth:D,opacity:R}=t,E=a.width,Y=a.height,G=a.enableHover,q=a.showGrid,X=a.title,V=a.description,U=a.summary,Q=a.accessibleTable,K=a.xLabel,J=a.yLabel,Z=l||[],ee=Si({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:F,legendPosition:z,selection:M,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:L,onClick:B,hoverHighlight:N,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:u,marginDefaults:a.marginDefaults,loading:H,emptyContent:I,width:E,height:Y}),te=fo(P),ne=lo({name:(null==te?void 0:te.name)||"__unused_brush__",xField:(null==te?void 0:te.xField)||("string"==typeof f?f:void 0),yField:(null==te?void 0:te.yField)||("string"==typeof y?y:void 0)}),oe=te?"xyBrush"===ne.brushInteraction.brush?"xy":"xBrush"===ne.brushInteraction.brush?"x":"y":void 0,ie=o.useRef(ne.brushInteraction);ie.current=ne.brushInteraction;const re=c(e=>{const t=ie.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(ee.earlyReturn)return ee.earlyReturn;fi("Scatterplot",Z,"xAccessor",f),fi("Scatterplot",Z,"yAccessor",y);const se=r(()=>{if(!b||0===Z.length)return;const e=Z.map(e=>"function"==typeof b?b(e):e[b]);return[Math.min(...e),Math.max(...e)]},[Z,b]),ae=r(()=>e=>{const t={fillOpacity:w};return m?ee.colorScale&&(t.fill=je(e,m,ee.colorScale)):t.fill=W||vo,t.r=b?Me(e,b,x,se):k,t},[m,ee.colorScale,b,x,se,k,w,W]),le=r(()=>Mo(ae,{stroke:$,strokeWidth:D,opacity:R}),[ae,$,D,R]),ce=r(()=>yo(le,ee.effectiveSelectionHook,ee.resolvedSelection),[le,ee.effectiveSelectionHook,ee.resolvedSelection]),ue=r(()=>zo([{label:K||To(f),accessor:f,role:"x",format:h},{label:J||To(y),accessor:y,role:"y",format:p},...m?[{label:To(m),accessor:m,role:"color"}]:[],...b?[{label:To(b),accessor:b,role:"size"}]:[]]),[f,y,K,J,m,b,h,p]),de=Go({componentName:"Scatterplot",data:l,accessors:{xAccessor:f,yAccessor:y}});if(de)return e(Wo,{componentName:"Scatterplot",message:de,width:E,height:Y});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:Z}),{xAccessor:f,yAccessor:y,colorAccessor:m||void 0,sizeAccessor:b||void 0,sizeRange:x,pointStyle:ce,colorScheme:v,size:[E,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,showAxes:a.showAxes,xLabel:K,yLabel:J,xFormat:h,yFormat:p,enableHover:G,showGrid:q}),ee.legendBehaviorProps),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:No(A)||ue}),(_||L||B||N)&&{customHoverBehavior:ee.customHoverBehavior}),(L||B||_)&&{customClickBehavior:ee.customClickBehavior}),O&&{marginalGraphics:O}),S&&{pointIdAccessor:S}),j&&j.length>0&&{annotations:j}),te&&{brush:{dimension:oe},onBrush:re}),ee.crosshairProps),C);return e(ui,{componentName:"Scatterplot",width:E,height:Y,children:e(Qn,Object.assign({ref:s},he))})});function Ci(e,t){return C(1===t?.5:e/(t-1))}ji.displayName="Scatterplot";const Mi=h(function(t,o){var s;const a=i(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,className:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",orderAccessor:y,orderLabel:m,pointRadius:v=4,tooltip:b,pointIdAccessor:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:C,chartId:M,loading:_,emptyContent:P,legendInteraction:L,stroke:B,strokeWidth:N,opacity:T}=t,H=l.width,I=l.height,F=l.enableHover,z=l.showGrid,W=l.title,$=l.description,D=l.summary,R=l.accessibleTable,E=l.xLabel,Y=l.yLabel,G=c||[],{safeData:q,orderMap:X}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof f?f:e=>e[f];let n=G;if(y&&G.length>0){const e="function"==typeof y?y:e=>e[y];n=[...G].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),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[G,y,p,f]);fi("ConnectedScatterplot",q,"xAccessor",p),fi("ConnectedScatterplot",q,"yAccessor",f);const{activeSelectionHook:V,hoverSelectionHook:U,customHoverBehavior:Q,customClickBehavior:K,crosshairSourceId:J}=ko({selection:A,linkedHover:O,fallbackFields:[],onObservation:S,onClick:j,chartType:"ConnectedScatterplot",chartId:M,hoverHighlight:C,colorByField:void 0}),Z=yi(A),ee=wo(O,J),te=Oo(L,void 0,[]),ne=r(()=>U||(te.legendSelectionHook?te.legendSelectionHook:V),[U,te.legendSelectionHook,V]),oe=null!==(s=null==Z?void 0:Z.unselectedOpacity)&&void 0!==s?s:.5,ie=r(()=>(e,t)=>{var n,o;const i=t.filter(e=>"point"===e.type);if(2>i.length)return;const r=null==ne?void 0:ne.isActive,s=null==ne?void 0:ne.predicate,a=100>i.length,l=i.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=i[t],u=i[t+1],d=Ci(t,l),h=!r||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=r?h?1:oe:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=v+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=v,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[v,ne,oe]),re=r(()=>[ie],[ie]),se=r(()=>(t,o,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const n=a[t],o=a[t+1],i=Ci(t,l),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:v+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:v,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:u})},[v]),ae=r(()=>[se],[se]),le=r(()=>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?Ci(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:v,fillOpacity:1}},[v,X]),ce=r(()=>Mo(le,{stroke:B,strokeWidth:N,opacity:T}),[le,B,N,T]),ue=r(()=>yo(ce,ne,Z),[ce,ne,Z]),de=Object.assign({top:50,right:40,bottom:60,left:70},"number"==typeof t.margin?{top:t.margin,bottom:t.margin,left:t.margin,right:t.margin}:t.margin),he=m||("string"==typeof y?y:"Order"),ge=r(()=>zo([{label:E||To(p),accessor:p,role:"x",format:d},{label:Y||To(f),accessor:f,role:"y",format:h},...y?[{label:he,accessor:y,role:"group"}]:[]]),[p,f,E,Y,y,he,d,h]),pe=Go({componentName:"ConnectedScatterplot",data:c,accessors:{xAccessor:p,yAccessor:f}}),fe=pi(_,H,I),ye=fe?null:gi(c,H,I,P),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({chartType:"scatter"},null!=c&&{data:q}),{xAccessor:p,yAccessor:f,pointStyle:ue,size:[H,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de,showAxes:l.showAxes,xLabel:E,yLabel:Y,xFormat:d,yFormat:h,enableHover:F,showGrid:z}),W&&{title:W}),$&&{description:$}),D&&{summary:D}),void 0!==R&&{accessibleTable:R}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:No(b)||ge}),(O||S||j||C)&&{customHoverBehavior:Q}),(S||j||O)&&{customClickBehavior:K}),x&&{pointIdAccessor:x}),{canvasPreRenderers:re,svgPreRenderers:ae}),k&&k.length>0&&{annotations:k}),ee),w);return fe||ye||(pe?e(Wo,{componentName:"ConnectedScatterplot",message:pe,width:H,height:I}):e(ui,{componentName:"ConnectedScatterplot",width:H,height:I,children:e(Qn,Object.assign({ref:a},me))}))});Mi.displayName="ConnectedScatterplot";const _i=h(function(t,n){const o=i(null),s=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:u,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:C,frameProps:M={},selection:_,linkedHover:P,linkedBrush:L,onObservation:B,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:F,legendInteraction:z,legendPosition:W,color:$,stroke:D,strokeWidth:R,opacity:E}=t,Y=s.width,G=s.height,q=s.enableHover,X=s.showGrid,V=s.showLegend,U=s.title,Q=s.description,K=s.summary,J=s.accessibleTable,Z=s.xLabel,ee=s.yLabel,te=pi(I,Y,G),ne=te?null:gi(a,Y,G,F),oe=a||[],ie=void 0===a,re=i(null),[se,ae]=d(0),le=c(e=>{if(!ie)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(re.current?(re.current[0]>e&&(re.current[0]=e,t=!0),e>re.current[1]&&(re.current[1]=e,t=!0)):(re.current=[e,e],t=!0))}t&&ae(e=>e+1)},[ie,m]),ce=Ai({isPushMode:ie,colorBy:b,colorScheme:x,showLegend:V,legendPosition:W}),ue=c(ce.wrapPush(e=>{var t;le([e]),null===(t=o.current)||void 0===t||t.push(e)}),[ce.wrapPush,le]),de=c(ce.wrapPushMany(e=>{var t;le(e),null===(t=o.current)||void 0===t||t.pushMany(e)}),[ce.wrapPushMany,le]);g(n,()=>({push:ue,pushMany:de,remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;ce.resetCategories(),re.current=null,ae(e=>e+1),null===(e=o.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ue,de,ce.resetCategories]);const{activeSelectionHook:he,hoverSelectionHook:ge,customHoverBehavior:pe,customClickBehavior:fe,crosshairSourceId:ye}=ko({selection:_,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:N,chartType:"BubbleChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof b?b:void 0}),me=yi(_),ve=wo(P,ye),be=fo(L);lo({name:(null==be?void 0:be.name)||"__unused_brush__",xField:(null==be?void 0:be.xField)||("string"==typeof f?f:void 0),yField:(null==be?void 0:be.yField)||("string"==typeof y?y:void 0)});const xe=xo(oe,b,x),ke=r(()=>{if(!b)return[];const e=new Set;for(const t of oe){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[oe,b]),we=Oo(z,b,ke),Ae=r(()=>ge||(we.legendSelectionHook?we.legendSelectionHook:he),[ge,we.legendSelectionHook,he]),Oe=r(()=>{if(ie)return re.current||[0,1];const e=oe.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[oe,m,ie,se]),Se=r(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?xe&&(t.fill=je(e,b,xe)):t.fill=$||vo,t.r=Me(e,m,v,Oe),t},[b,xe,m,v,Oe,k,w,A,$]),Ce=r(()=>Mo(Se,{stroke:D,strokeWidth:R,opacity:E}),[Se,D,R,E]),_e=r(()=>yo(Ce,Ae,me),[Ce,Ae,me]),{legend:Pe,margin:Le,legendPosition:Be}=Ao({data:oe,colorBy:b,colorScale:xe,showLegend:V,legendPosition:W,userMargin:l,defaults:s.marginDefaults}),Ne=ce.streamingLegend||Pe,Te=W||Be,He=r(()=>{if(ce.streamingMarginAdjust){const e=Object.assign({},Le);for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Le},[Le,ce.streamingMarginAdjust]),Ie=r(()=>zo([{label:Z||To(f),accessor:f,role:"x",format:h},{label:ee||To(y),accessor:y,role:"y",format:p},{label:To(m),accessor:m,role:"size"},...b?[{label:To(b),accessor:b,role:"color"}]:[]]),[f,y,Z,ee,m,b,h,p]),Fe=Go({componentName:"BubbleChart",data:a,accessors:{xAccessor:f,yAccessor:y},requiredProps:{sizeBy:m}});if(Fe)return e(Wo,{componentName:"BubbleChart",message:Fe,width:Y,height:G});const ze=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:"bubble"},null!=a&&{data:oe}),{xAccessor:f,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:_e,colorScheme:x,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:He,showAxes:s.showAxes,xLabel:Z,yLabel:ee,xFormat:h,yFormat:p,enableHover:q,showGrid:X}),Ne&&{legend:Ne,legendPosition:Te}),z&&"none"!==z&&{legendHoverBehavior:we.onLegendHover,legendClickBehavior:we.onLegendClick,legendHighlightedCategory:we.highlightedCategory,legendIsolatedCategories:we.isolatedCategories}),U&&{title:U}),Q&&{description:Q}),K&&{summary:K}),void 0!==J&&{accessibleTable:J}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===O?()=>null:No(O)||Ie}),(P||B||N||T)&&{customHoverBehavior:pe}),(B||N||P)&&{customClickBehavior:fe}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),C&&C.length>0&&{annotations:C}),ve),M);return te||ne||e(ui,{componentName:"BubbleChart",width:Y,height:G,children:e(Qn,Object.assign({ref:o},ze))})});_i.displayName="BubbleChart";const Pi=h(function(t,n){var o;const s=i(null);g(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},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=jo(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:p="value",xFormat:f,yFormat:y,colorScheme:m,customColorScale:v,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:O={},selection:S,linkedHover:N,onObservation:T,onClick:$,hoverHighlight:D,chartId:R,loading:E,emptyContent:Y,showLegend:G,legendPosition:q,legendInteraction:X}=t,V=a.width,U=a.height,Q=a.enableHover,K=a.title,J=a.description,Z=a.summary,ee=a.accessibleTable,te=a.xLabel,ne=a.yLabel,oe=pi(E,V,U),ie=oe?null:gi(l,V,U,Y),re=l||[],se=function(){var e;const t=mo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ae=null!==(o=null!=m?m:se)&&void 0!==o?o:"blues",le=null!=G&&G,ce=null!=q?q:"right",{margin:ue}=Ao({data:re,colorBy:le?"value":void 0,colorScale:void 0,showLegend:le,legendPosition:ce,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=ko({selection:S,linkedHover:N,fallbackFields:[],onObservation:T,onClick:$,chartType:"Heatmap",chartId:R,hoverHighlight:D,colorByField:void 0});yi(S);const pe=wo(N,ge);Oo(X,void 0,[]);const fe=r(()=>"function"==typeof p?e=>p(e):e=>e[p],[p]),ye=r(()=>{const e=re.map(fe);return[Math.min(...e),Math.max(...e)]},[re,fe]),me=r(()=>"custom"===ae&&v?v:A({blues:B,reds:L,greens:P,viridis:C,oranges:_,purples:M,greys:W,plasma:j,inferno:z,magma:F,cividis:I,turbo:H}[ae]||B).domain(ye),[ae,v,ye]),ve=r(()=>zo([{label:te||To(d),accessor:d,role:"x",format:f},{label:ne||To(h),accessor:h,role:"y",format:y},{label:To(p),accessor:p,role:"value",format:x}]),[d,h,te,ne,p,f,y,x]),be=Go({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:p}}),xe=r(()=>{if(le)return{gradient:{colorFn:e=>me(e),domain:ye,label:"string"==typeof p?p:"value",format:x}}},[le,me,ye,p,x]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=l&&{data:re}),{xAccessor:d,yAccessor:h,valueAccessor:p,colorScheme:"custom"!==ae?ae:void 0,showValues:b,heatmapValueFormat:x,size:[V,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:f,yFormat:y,enableHover:Q}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),xe&&{legend:xe,legendPosition:ce}),K&&{title:K}),J&&{description:J}),Z&&{summary:Z}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:No(k)||ve}),(N||T||$||D)&&{customHoverBehavior:de}),(T||$||N)&&{customClickBehavior:he}),w&&w.length>0&&{annotations:w}),pe),O);return oe||ie||(be?e(Wo,{componentName:"Heatmap",message:be,width:V,height:U}):e(ui,{componentName:"Heatmap",width:V,height:U,children:e(Qn,Object.assign({ref:s},ke))}))});Pi.displayName="Heatmap";const Li="__splomIdx",Bi={top:4,bottom:4,left:4,right:4};function Ni({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),a=n-Bi.left-Bi.right,l=n-Bi.top-Bi.bottom;return s(()=>{if(!r.current)return;const e=f(r.current).select(".brush-g"),n=v().extent([[0,0],[a,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[a,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${Bi.left},${Bi.top})`})})}function Ti({data:n,xField:o,yField:r,cellSize:s,pointRadius:a,pointOpacity:l,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:p,mode:f,onPointHover:y}){const m=i(null),v=ro({name:h,clientId:`splom-${o}-${r}`}),b=lo({name:h,xField:o,yField:r}),x=ro({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=c(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=c(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Li];void 0!==n&&(k({[Li]:[n]}),null==y||y(t,e.x+Bi.left,e.y+Bi.top))},[k,y]),O=c(e=>{const t={opacity:l,r:a};return t.fill=u?je(e,u,d):vo,"hover"===f?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*l):v.isActive&&!v.predicate(e)&&(t.opacity=p),t},[u,d,l,a,f,v.isActive,v.predicate,x.isActive,x.predicate,p]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Qn,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:O,margin:Bi,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?A:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e(Ni,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:w})]})}function Hi({data:n,field:o,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=ro({name:u,clientId:"splom-diag-"+o}),p=ro({name:d,clientId:`splom-diag-${o}-hover`}),f="hover"===h?p:g,y=f.isActive,m=f.predicate,v=r(()=>{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)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),p=Array.from({length:a},()=>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),a-1);if(d[s]++,y&&!m(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!m(e)||p[s][t]++)}}const f=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/f*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/f*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/f*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/f*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:f,categories:c}},[n,o,a,s,y,m,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):vo,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:vo,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):vo,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:vo,opacity:.7},"sel-"+n)))]})}function Ii({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Fi(n){const{data:i,fields:s,fieldLabels:a={},colorBy:l,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:p=2,pointOpacity:f=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:O,className:S,onObservation:j,chartId:C}=n,M="splom",_="splom-hover",P=b?"hover":v?"brush":"hover",L=no(e=>e.clearSelection),[B,N]=d(null),T=c(()=>{L(_),N(null)},[L,_]),H=r(()=>(i||[]).map((e,t)=>void 0!==e[Li]?e:Object.assign(Object.assign({},e),{[Li]:t})),[i]),I=xo(H,l,u),F=void 0!==A?A:!!l,z=r(()=>{if(!F||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(H.map(t=>t[e]))].map(e=>({label:e+"",color:I?I(e+""):vo})):null},[F,l,H,I]),W=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:S,style:{position:"relative"},children:[z&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:z.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:W,onMouseLeave:"hover"===P?T:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[n]||n}),s.map((t,o)=>i===o?"label"===y?e(Ii,{label:a[n]||n,cellSize:h},"diag-"+n):e(Hi,{data:H,field:n,label:a[n]||n,cellSize:h,bins:m,colorBy:l,colorScale:I,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,mode:P},"diag-"+n):e(Ti,{data:H,xField:t,yField:n,fieldLabels:a,cellSize:h,pointRadius:p,pointOpacity:f,colorBy:l,colorScale:I,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(N({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,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:C})):(N(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),B&&"hover"===P&&(()=>{const n=B.datum,o=a[B.xField]||B.xField,i=a[B.yField]||B.yField,r=l?"function"==typeof l?l(n):n[l]:null,s=O?"function"==typeof O?O(n):n[O]:"Row "+n[Li];return t("div",{style:{position:"absolute",left:40+B.colIndex*(h+g)+B.px,top:B.rowIndex*(h+g)+B.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[B.xField]?Number(n[B.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[B.yField]?Number(n[B.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof l?l:"group",": ",r+""]})]})})()]})}function zi(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(go,{selections:i,children:e(Fi,Object.assign({},t))})}function Wi({width:t,height:n,margin:o,scales:r,brushDirection:a,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+o.left+o.right,p=n+o.top+o.bottom;return s(()=>{if(!u.current||!r)return;const e=f(u.current).select(".brush-group"),o="x"===a?y().extent([[0,0],[t,n]]):m().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,a,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=f(u.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:u,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function $i(n){var o,a;const{data:l,width:u=600,height:h=400,margin:g,className:p,title:f,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:O,lineDataAccessor:S="coordinates",colorBy:j,colorScheme:C,curve:M="linear",lineWidth:_=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:B=!1,pointRadius:N=3,enableHover:T=!0,showGrid:H=!1,showLegend:I,legendPosition:F,tooltip:z,minimap:W={},renderBefore:$=!1,onBrush:D,brushExtent:R,frameProps:E={},loading:Y,emptyContent:G}=n,q=pi(Y,u,h),X=q?null:gi(l,u,h,G),V=l||[],[U,Q]=d(null),K=null!=R?R:U,J=c(e=>{R||Q(e),null==D||D(e)},[R,D]),Z=i(null),[ee,te]=d(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=Z.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?te(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[l]);const ne=void 0!==(null===(o=V[0])||void 0===o?void 0:o[S]),oe=r(()=>{if(ne)return V;if(O){const e=V.reduce((e,t)=>{const n="function"==typeof O?O(t):t[O];if(!e[n]){const t={[S]:[]};"string"==typeof O&&(t[O]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:V}]},[V,O,S,ne]),ie=r(()=>ne||O?oe.flatMap(e=>{const t=e[S]||[];return O&&"string"==typeof O?t.map(t=>Object.assign(Object.assign({},t),{[O]:e[O]})):t}):V,[oe,S,ne,O,V]),re=xo(V,j,C),se=r(()=>e=>{const t={strokeWidth:_};return t.stroke=j?je(e,j,re):vo,P&&(t.fill=t.stroke,t.fillOpacity=L),t},[j,re,_,P,L]),ae=r(()=>W.lineStyle?W.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=j?je(e,j,re):vo,t},[j,re,W.lineStyle]),le=r(()=>{if(B)return e=>{const t={r:N,fillOpacity:1};return t.fill=j?je(e.parentLine||e,j,re):vo,t}},[B,N,j,re]),{legend:ce,margin:ue,legendPosition:de}=Ao({data:oe,colorBy:j,colorScale:re,showLegend:I,legendPosition:F,userMargin:g}),he=W.height||60,ge=r(()=>{var e,t,n,o,i,r,s,a;return{top:null!==(t=null===(e=W.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=W.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=W.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=W.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[W.margin,ue]),pe=W.brushDirection||"x",fe=Go({componentName:"MinimapChart",data:l,accessors:{xAccessor:w,yAccessor:A}});if(fe)return e(Wo,{componentName:"MinimapChart",message:fe,width:u,height:h});const ye=P?"area":"line",me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:M,lineStyle:se},B&&{pointStyle:le}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ue,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:T,showGrid:H}),ce&&{legend:ce,legendPosition:de}),f&&{title:f}),y&&{description:y}),m&&{summary:m}),z&&{tooltipContent:No(z)||void 0}),K&&{xExtent:K}),E),ve={chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:M,lineStyle:ae,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(a=W.showAxes)&&void 0!==a&&a,background:W.background,enableHover:!1},be=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Qn,Object.assign({ref:Z},ve)),e(Wi,{width:u-ge.left-ge.right,height:he,margin:ge,scales:ee,brushDirection:pe,extent:K,onBrush:J})]},"minimap"),xe=e("div",{style:{overflow:"hidden"},children:e(Qn,Object.assign({},me))},"main");return q||X||e(ui,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(p?" "+p:""),children:[$?be:xe,$?xe:be]})})}zi.displayName="ScatterplotMatrix",$i.displayName="MinimapChart";const Di=h(function(o,s){const a=i(null);g(s,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=jo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:p,xAccessor:f="x",yAccessor:y="y",xCenter:m,yCenter:v,quadrants:b,centerlineStyle:x={},showQuadrantLabels:k=!0,quadrantLabelSize:w=12,colorBy:A,colorScheme:O,sizeBy:S,sizeRange:j=[3,15],pointRadius:C=5,pointOpacity:M=.8,tooltip:_,pointIdAccessor:P,annotations:L,frameProps:B={},selection:N,linkedHover:T,onObservation:H,onClick:I,hoverHighlight:F,chartId:z,loading:W,emptyContent:$,legendInteraction:D,legendPosition:R,color:E,stroke:Y,strokeWidth:G,opacity:q}=o,X=l.width,V=l.height,U=l.enableHover,Q=l.showGrid,K=l.showLegend,J=l.title,Z=l.description,ee=l.summary,te=l.accessibleTable,ne=l.xLabel,oe=l.yLabel,ie=pi(W,X,V),re=ie?null:gi(c,X,V,$),se=c||[];fi("QuadrantChart",se,"xAccessor",f),fi("QuadrantChart",se,"yAccessor",y);const{activeSelectionHook:ae,hoverSelectionHook:le,customHoverBehavior:ce,customClickBehavior:ue,crosshairSourceId:de}=ko({selection:N,linkedHover:T,fallbackFields:"string"==typeof A?[A]:[],onObservation:H,onClick:I,chartType:"QuadrantChart",chartId:z,hoverHighlight:F,colorByField:"string"==typeof A?A:void 0}),he=yi(N),ge=wo(T,de),pe=xo(se,A,O),fe=r(()=>{if(!A)return[];const e=new Set;for(const t of se){const n="function"==typeof A?A(t):t[A];null!=n&&e.add(n+"")}return Array.from(e)},[se,A]),ye=Oo(D,A,fe),me=r(()=>le||(ye.legendSelectionHook?ye.legendSelectionHook:ae),[le,ye.legendSelectionHook,ae]),ve=r(()=>{if(!se.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof y?y:e=>+e[y];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of se){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=m&&isFinite(m)&&(n>m&&(n=m),m>o&&(o=m)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-a,r+a]}},[se,f,y,m,v]),be=r(()=>{if(!S||0===se.length)return;const e=se.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[se,S]),xe=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ke=r(()=>"function"==typeof y?y:e=>+e[y],[y]),we=r(()=>e=>{const t={fillOpacity:M};if(A)pe&&(t.fill=je(e,A,pe));else{const n=xe(e),o=ke(e),i=null!=m?n>=m:void 0,r=null!=v?o>=v:void 0;t.fill=void 0===r||void 0===i?E||vo:r&&i?b.topRight.color:r&&!i?b.topLeft.color:!r&&i?b.bottomRight.color:b.bottomLeft.color}return t.r=S?Me(e,S,j,be):C,t},[A,pe,S,j,be,C,M,xe,ke,m,v,b,E]),Ae=r(()=>Mo(we,{stroke:Y,strokeWidth:G,opacity:q}),[we,Y,G,q]),Oe=r(()=>yo(Ae,me,he),[Ae,me,he]),{legend:Se,margin:Ce,legendPosition:_e}=Ao({data:se,colorBy:A,colorScale:pe,showLegend:K,legendPosition:R,userMargin:u,defaults:l.marginDefaults}),Pe=r(()=>{if(!se.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof y&&e.add(y),"string"==typeof A&&e.add(A),"string"==typeof S&&e.add(S);const t=se[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[se,f,y,A,S]),Le=r(()=>zo([...Pe?[{label:Pe,accessor:Pe,role:"title"}]:[],{label:ne||To(f),accessor:f,role:"x",format:h},{label:oe||To(y),accessor:y,role:"y",format:p},...A?[{label:To(A),accessor:A,role:"color"}]:[],...S?[{label:To(S),accessor:S,role:"size"}]:[]]),[Pe,f,y,ne,oe,A,S,h,p]),Be=Go({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:y}}),Ne=r(()=>{var e;const t={stroke:x.stroke||"#999",strokeWidth:null!==(e=x.strokeWidth)&&void 0!==e?e:1,dashArray:x.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,a=i.height,l=null!=m?o.x(m):s/2,c=null!=v?o.y(v):a/2;if(null!=m&&!isFinite(l))return;if(null!=v&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:b.topLeft,x:0,y:0,w:u,h:d},{config:b.topRight,x:u,y:0,w:s-u,h:d},{config:b.bottomLeft,x:0,y:d,w:u,h:a-d},{config:b.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[m,v,b,x]),Te=r(()=>k?[...Ne,(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!=m?n.x(m):i/2,a=null!=v?n.y(v):r/2;(null==m||isFinite(s))&&(null==v||isFinite(a))&&(e.font=`600 ${w}px sans-serif`,e.globalAlpha=.5,e.fillStyle=b.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(b.topLeft.label,8,8),e.fillStyle=b.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(b.topRight.label,i-8,8),e.fillStyle=b.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(b.bottomLeft.label,8,r-8),e.fillStyle=b.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(b.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:Ne,[Ne,k,w,b,m,v]),He=r(()=>{const e=B.canvasPreRenderers||[];return[...Te,...e]},[Te,B.canvasPreRenderers]),Ie=r(()=>{var o;const i={stroke:x.stroke||"#999",strokeWidth:null!==(o=x.strokeWidth)&&void 0!==o?o:1,dashArray:x.strokeDasharray?Array.isArray(x.strokeDasharray)?x.strokeDasharray.join(","):x.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=m?r.x(m):a/2,u=null!=v?r.y(v):l/2;if(null!=m&&!isFinite(c))return null;if(null!=v&&!isFinite(u))return null;const d=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,u));return t(n,{children:[[{config:b.topLeft,x:0,y:0,w:d,h:h},{config:b.topRight,x:d,y:0,w:a-d,h:h},{config:b.bottomLeft,x:0,y:h,w:d,h:l-h},{config:b.bottomRight,x:d,y:h,w:a-d,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),k&&t(n,{children:[e("text",{x:8,y:8+w,fill:b.topLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.topLeft.label}),e("text",{x:a-8,y:8+w,fill:b.topRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.topRight.label}),e("text",{x:8,y:l-8,fill:b.bottomLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:b.bottomRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.bottomRight.label})]})]})}]},[m,v,b,x,k,w]),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({chartType:"scatter"},null!=c&&{data:se}),{xAccessor:f,yAccessor:y,colorAccessor:A||void 0,sizeAccessor:S||void 0,sizeRange:j,pointStyle:Oe,colorScheme:O,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:p,enableHover:U,showGrid:Q}),ve&&{xExtent:ve.xExtent,yExtent:ve.yExtent}),Se&&{legend:Se,legendPosition:_e}),D&&"none"!==D&&{legendHoverBehavior:ye.onLegendHover,legendClickBehavior:ye.onLegendClick,legendHighlightedCategory:ye.highlightedCategory,legendIsolatedCategories:ye.isolatedCategories}),J&&{title:J}),Z&&{description:Z}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?Le:No(_)||Le}),(T||H||I||F)&&{customHoverBehavior:ce}),(H||I||T)&&{customClickBehavior:ue}),P&&{pointIdAccessor:P}),L&&L.length>0&&{annotations:L}),{canvasPreRenderers:He}),ge),B),He.length>0&&{canvasPreRenderers:He}),{svgPreRenderers:Ie});return ie||re||(Be?e(Wo,{componentName:"QuadrantChart",message:Be,width:X,height:V}):e(ui,{componentName:"QuadrantChart",width:X,height:V,children:e(Qn,Object.assign({ref:a},Fe))}))});Di.displayName="QuadrantChart";const Ri="__ma_unitized",Ei="__ma_series";function Yi(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Gi(e,t){return t[0]+e*(t[1]-t[0])}const qi=h(function(t,n){var s,a;const l=i(null),c=i([]);g(n,()=>({push:e=>{if(!l.current)return;const n=e;for(let e=0;t.series.length>e&&2>e;e++){const o=t.series[e],i=o.extent||c.current[e];if(!i)continue;const r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(n);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},n),{[Ri]:Yi(r,i),[Ei]:o.label||"Series "+(e+1)}))}},pushMany:e=>{if(!l.current)return;const n=[];for(const o of e)for(let e=0;t.series.length>e&&2>e;e++){const i=t.series[e],r=i.extent||c.current[e];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},o),{[Ri]:Yi(s,r),[Ei]:i.label||"Series "+(e+1)}))}l.current.pushMany(n)},remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const u=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:p,xFormat:f,xAccessor:y="x",series:m,colorScheme:v,curve:b="monotoneX",lineWidth:x=2,tooltip:k,annotations:w,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:C,hoverHighlight:M,chartId:_,loading:P,emptyContent:L,legendInteraction:B,legendPosition:N,stroke:T,strokeWidth:H,opacity:I}=t,F=u.width,z=u.height,W=u.enableHover,$=u.showGrid,D=null===(s=u.showLegend)||void 0===s||s,R=u.title,E=u.description,Y=u.summary,G=u.accessibleTable,q=u.xLabel,X=2===m.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||X||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${m.length}. Rendering as a standard multi-line chart.`);const V=pi(P,F,z),U=V?null:gi(d,F,z,L),Q=d||[],K=bo(),J=r(()=>{let e;if(Array.isArray(v))e=v;else if(K&&K.length>0)e=K;else{const t=we[v];e=Array.isArray(t)?t:Ae}return m.map((t,n)=>t.color||e[n%e.length])},[m,v,K]),Z=r(()=>m.map((e,t)=>e.label||"Series "+(t+1)),[m]),{unitizedData:ee,extents:te}=r(()=>{if(0===Q.length){const e=m.map(e=>e.extent||null).filter(Boolean);return e.length===m.length&&(c.current=e),{unitizedData:[],extents:e.length===m.length?e:[]}}const e=m.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]}(Q,e.yAccessor));if(c.current=e,!X){const t=[];for(const e of Q)for(let n=0;m.length>n;n++){const o=m[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Ri]:i,[Ei]:Z[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of Q)for(let o=0;2>o;o++){const i=m[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Ri]:Yi(r,e[o]),[Ei]:Z[o]}))}return{unitizedData:t,extents:e}},[Q,m,X,Z]),ne=r(()=>{if(X&&te.length>=2)return[{orient:"left",label:Z[0],tickFormat:m[0].format||(e=>{const t=Gi(e,te[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Z[1],tickFormat:m[1].format||(e=>{const t=Gi(e,te[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[X,te,m,Z]),oe=Si({data:r(()=>ee.length>0?ee:Z.map(e=>({[Ei]:e})),[ee,Z]),rawData:d,colorBy:Ei,colorScheme:J,legendInteraction:B,legendPosition:N,selection:O,linkedHover:S,fallbackFields:[Ei],unwrapData:!1,onObservation:j,onClick:C,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:_,showLegend:D,userMargin:h,marginDefaults:X?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:P,emptyContent:L,width:F,height:z});if(oe.earlyReturn)return oe.earlyReturn;const ie=r(()=>{const e=new Map;return Z.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[Ei])||J[0],strokeWidth:x,fill:"none"})},[Z,J,x]),re=r(()=>Mo(ie,{stroke:T,strokeWidth:H,opacity:I}),[ie,T,H,I]),se=r(()=>yo(re,oe.effectiveSelectionHook,oe.resolvedSelection),[re,oe.effectiveSelectionHook,oe.resolvedSelection]),ae=r(()=>{if(!1===k)return()=>null;return No(k)||(e=>{var t;const n=e.data||e,i=n[Ei],r=Z.indexOf(i),s=n[Ri],a=X&&r>=0&&te[r]?Gi(s,te[r]):s,l=r>=0&&(null===(t=m[r])||void 0===t?void 0:t.format)?m[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(n):n[y];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(a)}`))})},[k,Z,J,te,X,m,y]),le=Go({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),ce=X?[0,1]:void 0,ue=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!=d&&{data:ee}),{xAccessor:y,yAccessor:Ri,groupAccessor:Ei,lineStyle:se,colorScheme:J,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,showAxes:u.showAxes}),ne&&{axes:ne}),{xLabel:q}),X?{}:{yLabel:Z[0]}),{xFormat:f}),X&&ce&&{yExtent:ce}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:$,curve:b}),oe.legendBehaviorProps),R&&{title:R}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),p&&{className:p}),null!=t.animate&&{animate:t.animate}),{tooltipContent:ae}),w&&{annotations:w}),(S||j||C||M)&&{customHoverBehavior:oe.customHoverBehavior}),(j||C||S)&&{customClickBehavior:oe.customClickBehavior}),oe.crosshairProps),A);return V||U||(le?e(Wo,{componentName:"MultiAxisLineChart",message:le,width:F,height:z}):e(ui,{componentName:"MultiAxisLineChart",width:F,height:z,children:e(Qn,Object.assign({ref:l},ue))}))});qi.displayName="MultiAxisLineChart";const Xi=h(function(t,n){const o=i(null);g(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=jo(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:p="high",lowAccessor:f="low",openAccessor:y,closeAccessor:m,candlestickStyle:v,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:O,onClick:S,chartId:j,loading:C,emptyContent:M}=t,_=s.width,P=s.height,L=s.enableHover,B=s.showGrid,N=s.title,T=s.description,H=s.summary,I=s.accessibleTable,F=s.xLabel,z=s.yLabel,W=pi(C,_,P),$=W?null:gi(a,_,P,M),D=a||[],R=null==y||null==m;fi("CandlestickChart",D,"xAccessor",h),fi("CandlestickChart",D,"highAccessor",p),fi("CandlestickChart",D,"lowAccessor",f),R||(fi("CandlestickChart",D,"openAccessor",y),fi("CandlestickChart",D,"closeAccessor",m));const{customHoverBehavior:E,customClickBehavior:Y,crosshairSourceId:G}=ko({selection:w,linkedHover:A,onObservation:O,onClick:S,chartType:"CandlestickChart",chartId:j}),q=wo(A,G),X=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},n),l)},[l,s.marginDefaults,t.mode]),V=r(()=>{const e=[{label:F||To(h),accessor:h,role:"x",format:u}];return R?(e.push({label:"High",accessor:p,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:y,format:d}),e.push({label:"High",accessor:p,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:m,format:d})),zo(e)},[h,F,u,d,p,f,y,m,R]),U=Go({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:p,lowAccessor:f},!R&&{openAccessor:y,closeAccessor:m})}),Q=Math.max(2,Math.min(12,Math.round(_/40))),K=_>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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=a&&{data:D}),{xAccessor:h,yAccessor:p,highAccessor:p,lowAccessor:f}),!R&&{openAccessor:y,closeAccessor:m}),v&&{candlestickStyle:v}),{scalePadding:Q,extentPadding:K,size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,showAxes:s.showAxes,xLabel:F,yLabel:z,xFormat:u,yFormat:d,enableHover:L,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),N&&{title:N}),T&&{description:T}),H&&{summary:H}),void 0!==I&&{accessibleTable:I}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:No(b)||V}),(A||O||S)&&{customHoverBehavior:E}),(O||S||A)&&{customClickBehavior:Y}),x&&x.length>0&&{annotations:x}),q),k);return W||$||(U?e(Wo,{componentName:"CandlestickChart",message:U,width:_,height:P}):e(ui,{componentName:"CandlestickChart",width:_,height:P,children:e(Qn,Object.assign({ref:o},J))}))});Xi.displayName="CandlestickChart";export{wi as AreaChart,_i as BubbleChart,Xi as CandlestickChart,Mi as ConnectedScatterplot,Pi as Heatmap,ki as LineChart,$i as MinimapChart,qi as MultiAxisLineChart,Di as QuadrantChart,ji as Scatterplot,zi as ScatterplotMatrix,Oi as StackedAreaChart,Qn as StreamXYFrame};