semiotic 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/ai/schema.json +1 -1
  2. package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
  3. package/dist/components/charts/ordinal/BoxPlot.d.ts +2 -0
  4. package/dist/components/charts/ordinal/DotPlot.d.ts +2 -0
  5. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -0
  6. package/dist/components/charts/ordinal/Histogram.d.ts +2 -0
  7. package/dist/components/charts/ordinal/LikertChart.d.ts +2 -0
  8. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  9. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -0
  10. package/dist/components/charts/ordinal/SwarmPlot.d.ts +2 -0
  11. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -0
  12. package/dist/components/charts/ordinal/ViolinPlot.d.ts +2 -0
  13. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +24 -0
  14. package/dist/components/charts/xy/AreaChart.d.ts +14 -0
  15. package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
  16. package/dist/components/charts/xy/CandlestickChart.d.ts +4 -0
  17. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -0
  18. package/dist/components/charts/xy/Heatmap.d.ts +4 -0
  19. package/dist/components/charts/xy/LineChart.d.ts +12 -0
  20. package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
  21. package/dist/components/charts/xy/Scatterplot.d.ts +4 -0
  22. package/dist/components/charts/xy/StackedAreaChart.d.ts +12 -0
  23. package/dist/ordinal.min.js +1 -1
  24. package/dist/ordinal.module.min.js +1 -1
  25. package/dist/realtime.min.js +1 -1
  26. package/dist/realtime.module.min.js +1 -1
  27. package/dist/semiotic-ai.min.js +1 -1
  28. package/dist/semiotic-ai.module.min.js +1 -1
  29. package/dist/semiotic.min.js +1 -1
  30. package/dist/semiotic.module.min.js +1 -1
  31. package/dist/server.min.js +1 -1
  32. package/dist/server.module.min.js +1 -1
  33. package/dist/xy.min.js +1 -1
  34. package/dist/xy.module.min.js +1 -1
  35. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as a,useCallback as l,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as v,brushY as m,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as S,scaleBand as O}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{curveNatural as j,curveBasis as _,curveStepAfter as P,curveStepBefore as M,curveStep as L,curveCatmullRom as T,curveCardinal as B,curveMonotoneY as D,curveMonotoneX as I,line as N,area as H,curveLinear as R,arc as W,pie as F}from"d3-shape";import{bin as z,quantile as E,min as $,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Q,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as oe}from"d3-hierarchy";import ne from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as se,forceManyBody as ae,forceCenter as le,forceX as ce,forceY as ue}from"d3-force";import{ribbon as de,chord as he}from"d3-chord";const ge=Object.freeze([]);function fe(e){if(!e)return ge;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}function pe(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function ye(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function ve({width:t,height:o,totalWidth:n,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),C=i(O);C.current=O;const j=i(!1),_=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),n="x"===c?v():"y"===c?m():b();return n.extent([[0,0],[t,o]]),n.on("brush end",i=>{if(j.current)return;const r=S.current;if(!r)return;if(!i.selection)return _.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(o),r.y.invert(0)]}else if("y"===c){const[e,o]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(e)]}else{const[[e,t],[o,n]]=i.selection;s=[r.x.invert(e),r.x.invert(o)],a=[r.y.invert(n),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[pe(e[0],t),ye(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const o=r.x(s[0]),a=r.x(s[1]);if(j.current=!0,"x"===c)e.call(n.move,[o,a]);else if("xy"===c){const t=i.selection;e.call(n.move,[[o,t[0][1]],[a,t[1][1]]])}j.current=!1}const l={x:s,y:a};_.current=l,A.current(l)}),e.call(n),w.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[t,o,c,g,h,p]),s(()=>{if(!(x&&u&&w.current&&_.current))return;if(!k.current)return;if("y"===c)return;const e=_.current,t=u.x.domain()[0],o=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,o.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);let n=e.x[0],i=!1;if(t>e.x[0]){if(n=t,"bin"===g){const e=C.current;e&&e.length>0?n=ye(t,e):h&&h>0&&(n=Math.ceil(t/h)*h)}if(n>=e.x[1])return j.current=!0,o.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);i=!0}const r=u.x(n),s=u.x(e.x[1]);if(j.current=!0,"x"===c)o.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(w.current.move,[[r,t],[s,n]])}if(j.current=!1,i){const t={x:[n,e.x[1]],y:e.y};_.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:n,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class me{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=fe(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=fe(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function be(t){let o=null;const n=()=>(o||(o=u(null)),o),s=xe(t);return[function({children:o,initialState:s}){const a=i(s),l=r(()=>xe(t,a.current),[]),c=n();return e(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=a(o))&&void 0!==t?t:s,u=i(e);u.current=e;const d=l(()=>u.current(r.getState()),[r]),h=l(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function xe(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Oe={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}},Ce={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function je(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return Ce;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Oe:Se;return we(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 we(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_e,Pe]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:je(e.theme,t)}))}}));class Me{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 o of e){const e=this.push(o);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 o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+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),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 Le{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Te(e,t,o,n,i){const r=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=r.get(l);if(c||(c={start:l,end:l+n,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 Be(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const 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 De(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(!Number.isFinite(e)||!Number.isFinite(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 Ie(e,t,o,n){var i,r,s;const a=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const i of t)e+=o(i,n)||0;a.set(n,-e/2)}else if("wiggle"===n){e.length>0&&a.set(e[0],0);for(let n=1;e.length>n;n++){const r=e[n-1],s=e[n];let l=0,c=0,u=0;for(const e of t){const t=o(e,s)||0;l+=(2*u+t)*(t-(o(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(c>0?l/(2*c):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=n/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function Ne(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(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 He(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function Re(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,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 We(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Fe(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function ze(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Ee(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function $e(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ge(e){const t=e.map($e),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return Ye(e,o,n)}if(e>=1){const[e,n,i]=t[o];return Ye(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return Ye(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qe=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ot=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),nt=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),st=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),at=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ut=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),dt=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Qe,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 vt(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||yt.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):gt[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%gt.length]}function mt(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return x().domain(n).range(o).unknown("#999");const r=ht[o]||ht.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:gt;return x().domain(n).range(e).unknown("#999")}}function bt(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function xt(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}function kt(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,o){return e+(t-e)*o}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ct(e,t,o){var n,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 o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function jt(e,t,o){if(!e.getBounds||!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o),r=e.getY(o);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(o),a=e.scales.x(t);if(s&&0!==s)n.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);n.push([a,t]),i.push([a,t])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:e.resolveBoundsStyle(o,t[0]),datum:t,group:o,interactive:!1}}function _t(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=Ne(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const Pt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it},Mt=new Map;class Lt{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Me(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Fe(e.timeAccessor||e.xAccessor,"time"),this.getY=Fe(e.valueAccessor||e.yAccessor,"value")):(this.getX=Fe(e.xAccessor,"x"),this.getY=Fe(e.yAccessor,"y")),this.getGroup=Ee(e.groupAccessor),this.getCategory=Ee(e.categoryAccessor),this.getSize=e.sizeAccessor?Fe(e.sizeAccessor,"size"):void 0,this.getColor=Ee(e.colorAccessor),this.getBounds=e.boundsAccessor?Fe(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?Fe(e.y0Accessor,"y0"):void 0,this.getPointId=Ee(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Fe(e.openAccessor,"open"):void 0,this.getHigh=Fe(e.highAccessor,"high"),this.getLow=Fe(e.lowAccessor,"low"),this.getClose=o?Fe(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Fe(this.config.timeAccessor||this.config.xAccessor,"time"):Fe(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o)))}else for(const o 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(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e))))}return!0}computeScene(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),m=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(o=p.xExtent[0])&&void 0!==o?o:m[0],null!==(n=p.xExtent[1])&&void 0!==n?n:m[1]]:m,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1];if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(a=p.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(v),o=new Map,n=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const o of e.data){const e=this.getX(o),s=this.getY(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),n.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}o.set(e.key,t),s.set(e.key,a)}const a=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(n.push(t),r+=null!==(u=s.get(t))&&void 0!==u?u:0);f=[...n.reverse(),...o]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(e))&&void 0!==o?o:0)-(null!==(n=s.get(t))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=Ie(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(d=t.get(o))&&void 0!==d?d:0,n=null!==(h=r.get(o))&&void 0!==h?h:0;i>e&&(i=e),e+n>s&&(s=e+n)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=a>0?a*p.extentPadding:1;S=[i-l,s+l]}else S=[0,i+(i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,o,n,i){const r=Te(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(y,this.getY),o=t-e,n=o>0?o*p.extentPadding:1;S=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!O&&S[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),o=this.getBounds(e);null!=t&&!Number.isNaN(t)&&o&&(t+o>S[1]&&(S[1]=t+o),S[0]>t-o&&(S[0]=t-o))}const e=S[1]-S[0],t=e>0?e*p.extentPadding:1,o=null===(g=p.yExtent)||void 0===g?void 0:g[0],n=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=o?S[0]:S[0]-t,null!=n?S[1]:S[1]+t],"log"===p.yScaleType&&0>=S[0]&&b[0]>0&&(S[0]=null!=o?S[0]:b[0]/(1+p.extentPadding))}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const C="streaming"===p.runtimeMode,j=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(C)if("x"==("up"===(_=p.arrowOfTime)||"down"===_?"y":"x")){const t="right"===p.arrowOfTime?[j,e.width-j]:[e.width-j,j];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-j,j])}}else{const t="down"===p.arrowOfTime?[j,e.height-j]:[e.height-j,j];this.scales={x:k().domain(S).range([j,e.width-j]),y:k().domain(x).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)};this.scales={x:t(p.xScaleType,x,[j,e.width-j]),y:t(p.yScaleType,S,[e.height-j,j])}}var _;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Lt.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)},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,n,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 o,n,i,r,s,a,l;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(n=c.themeSemantic)&&void 0!==n?n:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var o,n;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(n=null===(o=c.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==n?n:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.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 n){const o=jt(e,t.data,t.key);o&&i.push(o)}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=Be(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return _t(e,n,i),i}(d,t);case"area":return function(e,t){const o=e.groupData(t),n=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=De(t.data,e.scales,e.getX,e.getY,i,o,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),n.push(s)}return _t(e,o,n),n}(d,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=De(t.data,e.scales,e.getX,e.getY,r,o,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),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=Be(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return _t(e,o,n),n}(d,t);case"stackedarea":return function(e,t){var o,n,i,r;const s=e.groupData(t),a=null!==(o=e.config.stackOrder)&&void 0!==o?o:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const o of s){let n=0;for(const t of o.data){const o=e.getX(t),i=e.getY(t);Number.isFinite(o)&&Number.isFinite(i)&&(n+=i)}t.set(o.key,n)}const o=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(n.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else if("desc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else{const e=[...s].sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)}),r=[],a=[];let l=0,c=0;for(const o of e)c>l?(r.push(o),l+=null!==(n=t.get(o.key))&&void 0!==n?n:0):(a.push(o),c+=null!==(i=t.get(o.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of d){let o=0;for(const n of e)o+=(null===(l=h.get(n.key))||void 0===l?void 0:l.get(t))||0;g.set(t,o||1)}}const f=Ie(d,e.map(e=>e.key),(e,t)=>{var o;return(null===(o=h.get(e))||void 0===o?void 0:o.get(t))||0},a),p=[],y=new Map,v=new Map;for(const e of d)v.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const o of e){const e=h.get(o.key),n=[],a=[],l=new Map;for(const o of d){let i=e.get(o)||0;const s=v.get(o);r&&(i/=g.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),v.set(o,c),l.set(o,c)}y.set(o.key,l);const c={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const o of s){const n=h.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=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};_t(e,s,g,o)}return g}(d,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,u=Ne(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(d,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n: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=Fe(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const v=new Int32Array(y),m=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;v[g]++;const y=c(n);m[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===v[e])continue;let t;switch(l){case"sum":t=m[e];break;case"mean":t=m[e]/v[e];break;default:t=v[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=o.width/s,A=o.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,C=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===v[n])continue;let i;switch(l){case"sum":i=m[n];break;case"mean":i=m[n]/v[n];break;default:i=v[n]}const r=(i-b)/k;C.push(Re(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:v[n],sum:m[n]},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return C}(e,t,o);if(0===t.length)return[];const n=Fe(e.config.valueAccessor,"value"),i=ze(e.config.xAccessor,"x"),r=ze(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 o=t[e],n=i(o),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,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()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){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),v=new Float64Array(t.length),m=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,v[f]=d,m[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=v[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 Pt?e:"blues";let o=Mt.get(t);if(o)return o;o=Array(256);const n=Pt[t]||Xe;for(let e=0;256>e;e++)o[e]=n(e/255);return Mt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=o.width/u,C=o.height/d,j=e.config.showValues,_=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=v[e];if(!isFinite(t))continue;const o=y[e],n=o%u;P.push(Re(n*O,(d-1-(o-n)/u)*C,O,C,A[Math.min((t-k)*S+.5|0,255)],m[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return P}(d,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(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 o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.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===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),v=y>g+1?g:0,m=Math.min(h,p)+v/2,b=Math.max(y-v,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(He(m,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(He(m,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(l=d.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=null!==(r=null!==(n=c.fill)&&void 0!==n?n: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,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=d;if(e.getCategory){const t=e.getCategory(o);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:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return u;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=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,v=null==h?void 0:h.stroke,m=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 n=g[t],i=e.getX(n),r=e.getY(n),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+o.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),S=d.y(s),O=Math.min(A,S),C=Math.abs(A-S),j={fill:0>r?p:f,stroke:v,strokeWidth:m};null!=b&&(j.opacity=b),u.push(He(k,O,w,C,j,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(d,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;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!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=xt(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=xt(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=xt(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=xt(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){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;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=kt(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=kt(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-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,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Ct(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.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?o.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?n.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&&n.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,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=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=Ct(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:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o: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,o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,C,j,_,P,M,L,T,B,D,I,N,H,R,W,F,z,E,$,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],M=Ct(e,r,t);if(!M)continue;if(r._transitionKey=M,"line"===r.type||"area"===r.type){const e=i.get(M);if(e){if(U.add(M),"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=n.get(M);if("point"===r.type)if(L){V.add(M);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(M);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!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p: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(M);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m: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(M);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,X=!0)}else r._targetOpacity=null!==(P=null===(_=r.style)||void 0===_?void 0:_.opacity)&&void 0!==P?P: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 n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(M=t.opacity)&&void 0!==M?M:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={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};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(D=t.w)&&void 0!==D?D:0,h:null!==(I=t.h)&&void 0!==I?I:0,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(H=t.w)&&void 0!==H?H:0,h:null!==(R=t.h)&&void 0!==R?R:0,fill:"#999",datum:null,style:{opacity:null!==(W=t.opacity)&&void 0!==W?W:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(F=t.openY)&&void 0!==F?F:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(z=t.closeY)&&void 0!==z?z:n,highY:null!==(E=t.highY)&&void 0!==E?E:n,lowY:null!==($=t.lowY)&&void 0!==$?$:n,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};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:Ot(),duration:q}),o}(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},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const u=At(e,o.activeTransition),d=wt(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=St(o.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==o.w&&(e.w=St(o.w,e._targetW,d)),void 0!==o.h&&(e.h=St(o.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==o.w&&(e.w=St(o.w,e._targetW,d)),void 0!==o.h&&(e.h=St(o.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=St(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=St(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=St(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=St(o.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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=St(t[n][0],o[n][0],d),e.path[n][1]=St(t[n][1],o[n][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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=St(t[o][0],n[o][0],d),e.topPath[o][1]=St(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(o[t][0],i[t][0],d),e.bottomPath[t][1]=St(o[t][1],i[t][1],d)}}if(u>=1){for(const e of o.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 o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.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,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}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 o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.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 o=(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)||ft;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Lt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}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]),o=this.getPointId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);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 o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!We(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),u=l||!We(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Fe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Fe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Fe(this.config.xAccessor,"x"),this.getY=Fe(this.config.yAccessor,"y")),s=!0,a=!0)}if("groupAccessor"in e&&!We(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Ee(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!We(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Ee(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!We(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Fe(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!We(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Ee(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!We(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Fe(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),"boundsAccessor"in e&&!We(e.boundsAccessor,r.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?Fe(this.config.boundsAccessor,"bounds"):void 0,s=!0,a=!0),"pointIdAccessor"in e&&!We(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Ee(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!We(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!We(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!We(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!We(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Fe(this.config.openAccessor,"open"):void 0,this.getHigh=Fe(this.config.highAccessor,"high"),this.getLow=Fe(this.config.lowAccessor,"low"),this.getClose=t?Fe(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Tt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Bt(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function Dt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function It(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Nt(e,t){const o=It(e);if(!o)return!1;const n=It(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Ht(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Rt(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+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-o,a=Math.sqrt(r*r+s*s);Dt(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}Lt.GROUP_COLOR_MAP_CAP=1e3,Lt.QUADTREE_THRESHOLD=500;const Wt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ft=new WeakMap;let zt=0,Et=!1,$t=null,Yt=null,Gt=null;function qt(e,t){var o,n;if(!t)return t;const i=Wt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(Et)return;if("undefined"==typeof window||"undefined"==typeof document)return;Et=!0;const e=()=>{zt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&($t=new MutationObserver(e),$t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Yt=window.matchMedia("(prefers-color-scheme: dark)"),Gt=e,"function"==typeof Yt.addEventListener?Yt.addEventListener("change",Gt):"function"==typeof Yt.addListener&&Yt.addListener(Gt)}catch(e){}}();let s=Ft.get(r);s&&s.version===zt||(s={version:zt,map:new Map},Ft.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}function Xt(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)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 Vt(e){switch(e){case"monotoneX":return I;case"monotoneY":return D;case"cardinal":return B;case"catmullRom":return T;case"step":return L;case"stepBefore":return M;case"stepAfter":return P;case"basis":return _;case"natural":return j;default:return null}}function Ut(e,t,o){return null==t?o:"string"!=typeof t?t:qt(e,t)||o}function Kt(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=Xt(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function Qt(e,t,o,n,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,n,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const Zt=new WeakMap;function Jt(e,t){const o=Vt(t);if(!o)return e;const n=Zt.get(e);if(n)return n;const i=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let i=null;const r={moveTo(e,t){i=[e,t],n.push([e,t])},lineTo(e,t){i=[e,t],n.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void n.push([a,l]);const[c,u]=i;for(let i=1;o>=i;i++){const d=i/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return N().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return Zt.set(e,i),i}function eo(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Rt(i,t,o,n,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=oo(r,t,o,n);break;case"line":e=no(r,t,o,n);break;case"rect":if(null==r.datum)break;e=ro(r,t,o);break;case"heatcell":e=so(r,t,o);break;case"area":if(!1===r.interactive)break;e=lo(r,t,o);break;case"candlestick":e=ao(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function to(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=co(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+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 oo(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function no(e,t,o,n=30){var i,r,s,a;if(0===e.path.length)return null;const l=co(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let n=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=io(t,o,i,r,a,l);n>c&&(n=c)}d=n}else{const e=t-c,n=o-u;d=Math.sqrt(e*e+n*n)}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,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function io(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function ro(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function so(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function ao(e,t,o){const n=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function lo(e,t,o){if(0===e.topPath.length)return null;const n=co(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function co(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function uo(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.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(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.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===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}function ho(e,t){var o,n;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!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}function go(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);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=o.groups.indexOf(n);return o.groups.length-1>e?fo(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?fo(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function fo(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function po(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function yo(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function vo(e,t,o,n,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),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,i,n])}const mo={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 bo(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,mo[o])(n(e,t)),i}function xo(){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 ko(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const wo=(o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===d||void 0===d&&null!=s;return f.forEach((o,d)=>{const b=bo(o,d,h,g),x=ko(o,r,s),k=s&&s.size>0&&s.has(o.label);p.push(t("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(d+("ArrowDown"===e.key?1:-1)+f.length)%f.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(xo,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),y+=22}),p};function Ao({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let t=0;64>=t;t++){const o=t/64;c.push(e("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(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+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:n,height:o,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+n,y:o+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 o=t/64;h.push(e("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(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 So(o){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"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:t,width:o,customClickBehavior:n,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:o,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:wo(t,n,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:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===d||void 0===d&&null!=s;p.forEach((o,d)=>{const k=bo(o,d,g,f),w=ko(o,r,s),A=s&&s.size>0&&s.has(o.label),S=26+7*o.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):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&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(d+("ArrowRight"===e.key?1:-1)+p.length)%p.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(o);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*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(xo,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),v+=S});let k=0,w=0;for(const e of p){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=m+1;return{items:y,offset:k,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,u,n,d,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((t,i)=>{const r=o[i];r.label&&(y.push(e("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),y.push(e("g",{className:"legend-item",transform:`translate(${p},0)`,children:t.items},"legend-group-"+i)),p+=t.offset+5,o[i+1]&&y.push(e("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,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 Oo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Co(e){return"object"==typeof e&&null!==e&&"gradient"in e}function jo(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),e("g",{transform:`translate(${f}, ${p})`,children:Co(o)?e(Ao,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):Oo(o)?e(So,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):o})}function _o(e){return"string"==typeof e?{type:e}:e}function Po({orient:o,config:n,values:i,scale:s,size:a,length:l}){const c=function(e){var t,o,n,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),u="top"===o||"bottom"===o,d=r(()=>{if(0===i.length)return null;const n=s.domain(),r=a-8;if("boxplot"===c.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!n)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=n,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="top"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:u,y1:m+v*(p+f/2),x2:y,y2:m+v*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*p,x2:u,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*p,x2:y,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(n,i),y:"top"===o?m-p-f:m+p,width:Math.abs(i-n),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===o?m-p-f:m+p,x2:r,y2:"top"===o?m-p:m+p+f,stroke:c.fill,strokeWidth:2})]})}{const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="left"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:m+v*(p+f/2),y1:u,x2:m+v*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:u,x2:m+v*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:y,x2:m+v*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===o?m-p-f:m+p,y:Math.min(n,i),width:f,height:Math.abs(i-n),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===o?m-p-f:m+p,y1:r,x2:"left"===o?m-p:m+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=z().domain(n).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-"+o,children:d.map((t,n)=>{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"===o?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===o?-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},n)}})});if("violin"===c.type){const t=r/2+4,n=[];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);n.push(u?`${a},${"top"===o?-(t-i):t-i}`:`${"left"===o?-(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);n.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+o,children:e("polygon",{points:n.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,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${n},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===o?-n-4:n+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,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${n}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===o?-n-4:n+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-"+o,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,o,u,4]);return d?e("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function Mo(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Lo(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function To(o,n,i,r){if(!o)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=o;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?d?[a]:Mo(a,u):[],v=s?d?[s]:Mo(s,u):[],m="leftRight"===h?"end"===f?-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:f,fontWeight:"bold",children:y.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:v.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-label"));let w=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const t=Math.min(u,120);let o=0,n=t;"end"===f?(o=-t,n=0):"middle"===f&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=t;"bottom"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Bo(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e("path",{d:Lo((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function Do(t,o,n,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,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),u=e/2,d=n/2,h=t*d>o*u?u/t:d/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*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 Io(e){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=e,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=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;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&Do(m,b,c,h,x,u),!v.has("subject")&&Bo(x,u,h,o,n),!v.has("note")&&To(l,m,b,h)]}))}function No(t){var o,n;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!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e(Io,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Io,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ho(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n: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 Ro(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n: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 Wo(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.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)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ho(e,o),c=Ro(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Fo(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const zo={linear:R,monotoneX:I,monotoneY:D,step:L,stepAfter:P,stepBefore:M,basis:_,cardinal:B,catmullRom:T};function Eo(o){return function(o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,C,j,_,P,M,L,T,B,D,I,N,W,F,z,E,$,Y,G,q,X,V,K,Q,Z,J,ee,te;switch(o.type){case"label":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Fo(r,s,i)?e(No,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Fo(r,s,i)?e(No,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=Ho(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.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:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Ro(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.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:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:Ho(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ro(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=U(r),a=o.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:Ho(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ro(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.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:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const t=i.data||[],r="function"==typeof o.filter?t.filter(o.filter):o.field&&null!=o.value?t.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,n)=>{const r=Ho(t,i),a=Ro(t,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(t):o.r||6,c="function"==typeof o.style?o.style(t):o.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Ho(o,i),r=Ro(o,i);return e(No,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.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,v=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||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(d=o.bandwidth)&&void 0!==d?d:.3):("polynomial"===m?ne.polynomial(p,{order:o.order||2}):ne.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),k=o.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:k,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.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:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m: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=o.upperAccessor||"upperBounds",u=o.lowerAccessor||"lowerBounds",d=o.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=zo[i.curve||"linear"]||R,f=H().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=o.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),o.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(C=i.scales)||void 0===C?void 0:C.time,l=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.y)&&void 0!==_?_:null===(P=i.scales)||void 0===P?void 0:P.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!==(M=o.threshold)&&void 0!==M?M:2,f=u-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(L=o.fillOpacity)&&void 0!==L?L:.1,m=o.anomalyColor||"#ef4444",b=null!==(T=o.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,o)=>{const n=Ho(t,i),r=Ro(t,i);return null==n||null==r?null:e("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(D=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==D?D:null===(I=i.scales)||void 0===I?void 0:I.time,c=null!==(W=null===(N=i.scales)||void 0===N?void 0:N.y)&&void 0!==W?W:null===(F=i.scales)||void 0===F?void 0:F.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"===(o.method||"linear")){const e=ne.polynomial(u,{order:o.order||2}).equation;d=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=u.length;let t=0,o=0,n=0,i=0;for(const[e,r]of u)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-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),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(z=o.confidence)&&void 0!==z?z:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(E=o.steps)&&void 0!==E?E: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),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`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`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),C=`${l(x)},${c(d(x))}`,j=o.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:o.fill||"#6366f1",fillOpacity:null!==($=o.fillOpacity)&&void 0!==$?$:.15,stroke:"none"}),e("polyline",{points:`${C} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(Y=o.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=o.strokeDasharray)&&void 0!==G?G:"6,3"}),o.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let t=null,r=null;if(null!=o.px&&null!=o.py)t=o.px,r=o.py;else{const e=Wo(o,n,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!Fo(t,r,i))return null;const s=null!==(q=o.dx)&&void 0!==q?q:0,a=null!==(X=o.dy)&&void 0!==X?X:0,l=null!==(V=o.width)&&void 0!==V?V:32,c=null!==(K=o.height)&&void 0!==K?K:32,u=null!==(Q=o.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:o.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-"+n)}case"text":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(Z=i.scales)||void 0===Z?void 0:Z.o,a=null===(J=i.scales)||void 0===J?void 0:J.x,l=null===(ee=i.scales)||void 0===ee?void 0:ee.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=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(te=o.opacity)&&void 0!==te?te:.15,f=o.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}),f&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),f&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}}}let $o={positions:new Map};const Yo=new Set;function Go(){for(const e of Yo)e()}function qo(e,t){const o=$o.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Xo(e,t){const o=$o.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Vo(){return $o}function Uo(e){return Yo.add(e),()=>Yo.delete(e)}const Ko={positions:new Map};function Qo(){return()=>{}}function Zo(){return Ko}function Jo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function en(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function tn(o){const{width:n,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f}=o,p=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||g||on,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(n/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:c.x(e),label:o(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 nn(a,Math.max(55,l+8))},[c,d,g,n]),y=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||f||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(c.y.ticks(Math.min(n,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i]),v=h&&c,m=u&&c;if(!v&&!m)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=m&&(!b||!1!==b.baseline),w=m&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,S=(null==x?void 0:x.jaggedBase)||!1,O="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:[v&&(()=>{var o,r;const s=Jo(null===(o=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),a=Jo(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:[p.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+o)),y.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+o))]})})(),k&&!A&&e("line",{x1:0,y1:i,x2:n,y2:i,stroke:O,strokeWidth:1}),A&&e("path",{d:en("bottom",n,i),fill:"none",stroke:O,strokeWidth:1}),w&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:O,strokeWidth:1}),S&&e("path",{d:en("left",n,i),fill:"none",stroke:O,strokeWidth:1})]})})}function on(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nn(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function rn(n){var a,l;const{width:u,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:A,title:S,legend:O,legendHoverBehavior:C,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:P,legendPosition:M="right",foregroundGraphics:L,marginalGraphics:T,xValues:B,yValues:D,annotations:I,svgAnnotationRules:N,xAccessor:H,yAccessor:R,annotationData:W,pointNodes:F,curve:z,underlayRendered:E,canvasObscuresUnderlay:$=!0,linkedCrosshairName:Y,linkedCrosshairSourceId:G,children:q}=n,X=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||k||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=p.x.ticks(Math.min(n,Math.max(2,Math.floor(u/70)))),r=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:p.x(e),label:o(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 c=nn(s,l);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),(null==t?void 0:t.includeMax)&&c.length>0){const e=p.x.domain()[1],t=p.x(e),n=c[c.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,c.length,r);l>t-n&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:t,label:i})}}return c},[y,p,v,k,u]),V=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||w||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=nn(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(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=p.y.domain()[1],t=p.y(e),n=i[i.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e);22>Math.abs(t-n)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[y,p,v,w,d]),U=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"right"===e.orient);if(!t)return[];const o=t.tickFormat||w||on,n=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,v,w,d]),K=i(new Map),Q=i(null!==(a=null==I?void 0:I.length)&&void 0!==a?a:0),Z=null!==(l=null==I?void 0:I.length)&&void 0!==l?l:0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=r(()=>{if(!I||0===I.length)return null;const e=Eo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:H,yAccessor:R,width:u,height:d,data:W,frameType:"xy",pointNodes:F,curve:z,stickyPositionCache:K.current};return I.map((o,n)=>{if(N){const i=N(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[I,N,u,d,H,R,W,p,F,z]),ee=function(e){var t;const o=c(e?Uo:Qo,e?Vo:Zo,e?Vo:Zo);return e&&null!==(t=o.positions.get(e))&&void 0!==t?t:null}(Y);return s(()=>{if(!(null==ee?void 0:ee.locked)||!Y)return;const e=e=>{"Escape"===e.key&&Xo(Y)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ee?void 0:ee.locked,Y]),y||S||O||L||T||J&&J.length>0||A||q||ee?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 S?S:"XY Chart"}),e("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[A&&p&&(!E||$)&&(()=>{var o,n;const i=Jo(null===(o=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),r=Jo(null===(n=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return t("g",{className:"stream-grid",children:[X.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+o)),V.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),y&&p&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!n||!1!==n.baseline,s=!i||!1!==i.baseline,a=(null==n?void 0:n.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,c=null==i?void 0:i.landmarkTicks,h=null==n?void 0:n.landmarkTicks,g="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&X.length>1&&(()=>{const e=u/Math.max(X.length-1,1),t=X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!E||$)&&s&&!l&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:g,strokeWidth:1}),(!E||$)&&l&&e("path",{d:en("bottom",u,d),fill:"none",stroke:g,strokeWidth:1}),X.map((o,n)=>{const i=!!c&&("function"==typeof c?c(o.value,n):Nt(o.value,n>0?X[n-1].value:void 0));return t("g",{transform:`translate(${o.pixel},${d})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:o.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:o.label})})]},"xtick-"+n)}),m&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!E||$)&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:g,strokeWidth:1}),(!E||$)&&a&&e("path",{d:en("left",u,d),fill:"none",stroke:g,strokeWidth:1}),V.map((o,n)=>{const i=!!h&&("function"==typeof h?h(o.value,n):Nt(o.value,n>0?V[n-1].value:void 0));return t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},children:o.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:o.label})})]},"ytick-"+n)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${d/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===U.length)return null;const i=n.landmarkTicks,r=n.label||x;return t(o,{children:[!1!==n.baseline&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:g,strokeWidth:1}),U.map((o,n)=>{const r=!!i&&("function"==typeof i?i(o.value,n):Nt(o.value,n>0?U[n-1].value:void 0));return t("g",{transform:`translate(${u},${o.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"},children:o.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:o.label})})]},"ytick-r-"+n)}),r&&e("text",{x:u+f.right-15,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${u+f.right-15}, ${d/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),J,T&&p&&B&&D&&t(o,{children:[T.top&&e("g",{transform:"translate(0, 0)",children:e(Po,{orient:"top",config:_o(T.top),values:B,scale:p.x,size:f.top,length:u})}),T.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(Po,{orient:"bottom",config:_o(T.bottom),values:B,scale:p.x,size:f.bottom,length:u})}),T.left&&e("g",{transform:"translate(0, 0)",children:e(Po,{orient:"left",config:_o(T.left),values:D,scale:p.y,size:f.left,length:d})}),T.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Po,{orient:"right",config:_o(T.right),values:D,scale:p.y,size:f.right,length:d})})]}),L,ee&&ee.sourceId!==G&&(null==p?void 0:p.x)&&(()=>{const t=p.x(ee.xValue);if(null==t||0>t||t>u)return null;const o=ee.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),q]}),S&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof S?S:null}),jo({legend:O,totalWidth:h,totalHeight:g,margin:f,legendPosition:M,title:S,legendHoverBehavior:C,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:P})]}):null}const sn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function an(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ln="undefined"==typeof window||"undefined"==typeof document,cn="undefined"!=typeof window?h:s;function un(){const[e,t]=d(!1);return cn(()=>{t(!0)},[]),e}const dn=()=>()=>{},hn=()=>!1,gn=()=>!0;function fn(){const e=c(dn,hn,gn);return i(e).current}function pn(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;cn(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=i(l);c.current=l,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function yn(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return mn(e,t);if(!bn(e)||!bn(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!mn(o,i))return!1}else{if(!bn(o)||!bn(i))return!1;if(!vn(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function vn(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function mn(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function bn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const xn=n.createContext(null);function kn({children:t}){const[o,i]=n.useState(!1),r=n.useMemo(()=>({visible:o,setVisible:i}),[o]);return e(xn.Provider,{value:r,children:t})}function wn(){return n.useContext(xn)}const An={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Sn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],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(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}function On(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const Cn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},jn={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"},_n={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Pn={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)"},Mn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ln={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)"},Bn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Dn({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),u=wn(),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||d||c(!0)},[l,d]),y=n.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!o||0===o.length)return r?e("span",{id:r,tabIndex:-1,style:An}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:p,style:An,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O;const C=[];if(!Array.isArray(e))return C;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":C.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&C.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&C.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;C.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":C.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":C.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=j.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=j.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":C.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=j.cx)&&void 0!==g?g:j.x,y:null!==(f=j.cy)&&void 0!==f?f:j.y}});break;case"arc":C.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=j.cx)&&void 0!==v?v:j.x,y:null!==(m=j.cy)&&void 0!==m?m:j.y}});break;case"candlestick":C.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":C.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=j.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return C}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];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 o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Cn(e.min)} to ${Cn(e.max)}, mean ${Cn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.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:jn,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Pn,children:"×"}),e("div",{role:"note",style:_n,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Mn,children:[t("caption",{style:Bn,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ln,children:"type"}),w.map(t=>e("th",{style:Ln,children:t},t))]})}),e("tbody",{children:x.map((o,n)=>t("tr",{children:[e("td",{style:Tn,children:o.label}),w.map(t=>{return e("td",{style:Tn,children:(n=o.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Cn(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},n))})]})]})}function In({nodes:o,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,u,d,h,g,f,p,y,v,m,b,x,k;const[w,A]=n.useState(!1),S=wn(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,C=w||O,j=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,_=n.useRef(null),P=n.useCallback(()=>{w||O||A(!0)},[w,O]),M=n.useCallback(e=>{var t;O||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!o||0===o.length)return s?e("span",{id:s,tabIndex:-1,style:An}):null;if(!C)return e("div",{id:s,tabIndex:-1,onFocus:P,style:An,role:"region","aria-label":j,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",o.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(o)?o:[],T=Array.isArray(i)?i:[],B=new Map,D=new Map,I=new Map,N=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,o="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,n="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";D.set(e,(null!==(h=D.get(e))&&void 0!==h?h:0)+1),N.set(e,(null!==(g=N.get(e))&&void 0!==g?g:0)+i)}if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),I.set(e,(null!==(p=I.get(e))&&void 0!==p?p:0)+i)}}const H=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const o=null!==(v=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==v?v:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=B.get(n))&&void 0!==m?m:0,r=null!==(b=D.get(n))&&void 0!==b?b:0,s=null!==(x=I.get(n))&&void 0!==x?x:0,a=null!==(k=N.get(n))&&void 0!==k?k:0;H.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}H.sort((e,t)=>t.degree-e.degree);let R=0,W=0;if(H.length>0){let e=0;for(const t of H)e+=t.degree,t.degree>W&&(W=t.degree);R=e/H.length}const F=T.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),z=[`${H.length} nodes, ${T.length} edges.`];H.length>0&&z.push(`Mean degree: ${Cn(R)}, max degree: ${W}.`);const E=H.slice(0,5);return t("div",{ref:_,id:s,tabIndex:-1,onBlur:M,style:jn,role:"region","aria-label":j,children:[e("button",{type:"button",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Pn,children:"×"}),e("div",{role:"note",style:_n,children:z.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+r,style:Mn,children:[t("caption",{style:Bn,children:["Top ",E.length," of ",H.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ln,children:"id"}),e("th",{style:Ln,children:"degree"}),e("th",{style:Ln,children:"in"}),e("th",{style:Ln,children:"out"}),F&&e("th",{style:Ln,children:"w. degree"}),F&&e("th",{style:Ln,children:"w. in"}),F&&e("th",{style:Ln,children:"w. out"})]})}),e("tbody",{children:E.map((o,n)=>t("tr",{children:[e("td",{style:Tn,children:o.id}),e("td",{style:Tn,children:o.degree}),e("td",{style:Tn,children:o.inDeg}),e("td",{style:Tn,children:o.outDeg}),F&&e("td",{style:Tn,children:Cn(o.wDegree)}),F&&e("td",{style:Tn,children:Cn(o.wInDeg)}),F&&e("td",{style:Tn,children:Cn(o.wOutDeg)})]},n))})]})]})}function Nn({summary:t}){return t?e("div",{role:"note",style:An,children:t}):null}function Hn({tableId:t}){return e("a",{href:"#"+t,style:An,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.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,An)},children:"Skip to data table"})}function Rn({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="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:An,children:o})}const Wn="var(--semiotic-focus, #005fcc)";function Fn({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:Wn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Wn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Wn,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 zn({x:t,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=n.useRef(null),[d,h]=n.useState(null);n.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-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function En(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function $n(e,t,o){const n=i(null),[r,a]=d(null);return s(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;a(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}const Yn="undefined"==typeof window?s:h;function Gn(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function qn(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),En(e,e=>t(e.matches))},[]),e}(),o=i(t);o.current=t;const[a,c]=$n(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,g=c[1]-u.top-u.bottom,f=Gn(e.foregroundGraphics,c,u),p=Gn(e.backgroundGraphics,c,u),y=Pe(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),C=i(0),j=l(()=>{C.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),_=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),P=l(()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const M=e.themeDirtyRef;return Yn(()=>{M&&(zt++,M.current=!0,w())},[y,w,M]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:a,size:c,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:_,onPointerLeave:P}}function Xn(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,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(n,0,0,n,0,0),i.translate(o.left,o.top),i}function Vn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Un(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function Kn(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const Qn=(e,t,o,n)=>{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,n.width*l,n.height),e.clip());const c=a.style.stroke||"#007bff",u=qt(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 v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Kn(e,a.path,u,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Vt(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=u;const m=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])*m,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(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function C(){S&&(e.stroke(),S=!1)}for(let j=0;a.path.length>j;j++){const[_,P]=a.path[j],M=g[j],L=Un(M,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(_,P);else{const T=[];for(const B of h){const D=B.value;(w>D||D>M)&&(D>w||M>D)||w===D||M===D||T.push({t:(D-w)/(M-w)})}T.sort((e,t)=>e.t-t.t);for(const I of T){const H=x+(_-x)*I.t,R=k+(P-k)*I.t,W=Un(w+(M-w)*Math.min(I.t+1e-4,1),h,u);e.lineTo(H,R),C(),O(W,H,R)}e.lineTo(_,P)}x=_,k=P,w=M,A=L}else O(L,_,P),x=_,k=P,w=M,A=L}C()}else{e.beginPath();const F=a.strokeGradient&&a.path.length>=2?Qt(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=F||u,f)N().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[z,E]=a.path[0];e.moveTo(z,E);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=Ut(e,a.style.fill,a.style.fill),f&&!p)N().x(e=>e[0]).y(e=>e[1]).curve(f).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],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Zn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Jn(e,t,o=.3){Zn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ei(e,t,o=.6){var n,i,r,s,a;if(!Zn(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n: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*o,e.stroke()}function ti(e,t,o,n=.35){Zn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function oi(e,t){const o=Vt(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=H().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const ni=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,n.width*a,n.height),e.clip());const l=t.style.fill||"#4e79a7",c=t._decayOpacities;if(c&&c.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1])*o,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.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1]),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.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(oi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=Kt(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,o,0,n);e.fillStyle=i||l,e.globalAlpha=u}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*u,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(oi(e,t),ti(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const o=t.strokeGradient&&t.topPath.length>=2?Qt(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Vt(t.curve);if(e.beginPath(),n)N().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 o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),o&&e.restore(),e.globalAlpha=1}},ii=(e,t,o,n)=>{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 o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Ut(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Ut(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),ei(e,t),e.globalAlpha=1}}finally{e.restore()}}};function ri(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const si=(e,t,o,n)=>{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)ai(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=ri(t),i=t.fillGradient&&"string"==typeof o?Kt(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=ri(t),i=t.fillGradient&&"string"==typeof o?Kt(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Jn(e,t),e.globalAlpha=1}};function ai(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;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+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}function li(e,t,o,n){return Object.assign({data:e,x:t,y:o,__semioticHoverData:!0},n)}function ci(e){const[t,o,n]=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*o+.114*n>128?"#000":"#fff"}function ui(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const di=(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=qt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Jn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):ui(t.value),n=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=ci(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},hi=(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;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=qt(e,t.wickColor)||t.wickColor,c=60>n.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 o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=qt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&d(),e.restore()}};function gi(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}function fi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}const pi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function yi(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${pi[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${pi[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const vi={line:[ni,Qn,ii],area:[ni,ii],stackedarea:[ni,ii],scatter:[ii],bubble:[ii],heatmap:[di],bar:[si],swarm:[ii],waterfall:[(e,t,o,n)=>{var i,r,s;si(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=qt(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 n=a[t],i=a[t+1];if(!(null===(r=n.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const l=o.y(n.datum.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[hi],mixed:[ni,Qn,ii],custom:[ni,si,di,Qn,ii,hi]},mi={top:20,right:20,bottom:30,left:40},bi={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 xi(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const ki={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 wi({hover:o}){var n,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",a=null!==(n=o.data)&&void 0!==n?n:{},l=null!==(i=a.y)&&void 0!==i?i:a.value,c=null!==(r=a.x)&&void 0!==r?r:a.time;return t("div",{className:"semiotic-tooltip",style:ki,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}const Ai=g(function(o,a){var c,u,h,g,y,v,m,b,x,k,w,A,S;const{chartType:O,runtimeMode:C,data:j,chunkThreshold:_,chunkSize:P,xAccessor:M,yAccessor:L,colorAccessor:T,sizeAccessor:B,groupAccessor:D,lineDataAccessor:I,curve:N,normalize:H,baseline:R,stackOrder:W,binSize:F,valueAccessor:z,arrowOfTime:E="right",windowMode:$="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Q=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:oe,lineStyle:ne,pointStyle:ie,areaStyle:re,barStyle:se,waterfallStyle:ae,swarmStyle:le,barColors:ce,colorScheme:ue,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,gradientFill:pe,lineGradient:ye,areaGroups:be,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,showAxes:Ce=!0,axes:je,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:Le,yFormat:Te,tickFormatTime:Be,tickFormatValue:De,hoverAnnotation:Ie,tooltipContent:Ne,customHoverBehavior:He,customClickBehavior:Re,enableHover:We,hoverRadius:Fe=30,tooltipMode:ze,annotations:Ee,svgAnnotationRules:$e,showGrid:Ye,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,legendCategoryAccessor:Qe,onCategoriesChange:Ze,backgroundGraphics:Je,foregroundGraphics:et,canvasPreRenderers:tt,svgPreRenderers:ot,title:nt,categoryAccessor:it,brush:rt,onBrush:st,decay:at,pulse:lt,transition:ct,animate:ut,staleness:dt,heatmapAggregation:ht,heatmapXBins:gt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,marginalGraphics:vt,pointIdAccessor:mt,xScaleType:bt,yScaleType:xt,accessibleTable:kt=!0,description:wt,summary:At,linkedCrosshairName:St,linkedCrosshairSourceId:Ot,customLayout:Ct,layoutConfig:jt}=o,_t=f().replace(/:/g,""),Pt=i(!1),Mt=qn({sizeProp:Q,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:mi,animate:ut,transitionProp:ct,themeDirtyRef:Pt}),Bt=un(),Dt=fn(),{reducedMotionRef:It,responsiveRef:Nt,size:Ht,currentTheme:Rt,transition:Wt,introEnabled:Ft,tableId:zt,rafRef:Et,renderFnRef:$t,scheduleRender:Yt}=Mt;let Gt=Mt.margin;if(vt){const e=60,t=Object.assign({},Mt.margin);vt.top&&e>t.top&&(t.top=e),vt.bottom&&e>t.bottom&&(t.bottom=e),vt.left&&e>t.left&&(t.left=e),vt.right&&e>t.right&&(t.right=e),Gt=t}const Xt="function"==typeof et?et({size:Ht,margin:Gt}):et,Vt="function"==typeof Je?Je({size:Ht,margin:Gt}):Je,Ut=Ht[0]-Gt.left-Gt.right,Kt=Ht[1]-Gt.top-Gt.bottom,Qt=r(()=>fe(j),[j]),Zt=null!=Ie?Ie:We,oo=i(null),no=i(null),[io,ro]=d(0),[so,ao]=d(null),lo=i(null),fo=i(null),[po,mo]=d(null),bo=i(bi.primary),xo=i([]),ko=i(Qe),wo=i(Ze);ko.current=Qe,wo.current=Ze;const[Ao,So]=d(!1),[Oo,Co]=d([]),[jo,_o]=d([]),Po="streaming"===C||["bar","swarm","waterfall"].includes(O),Mo=r(()=>{var e,t,o;return{chartType:O,runtimeMode:Po?"streaming":"bounded",windowSize:Y,windowMode:$,arrowOfTime:Po?E:"right",extentPadding:V,scalePadding:U,xAccessor:M,yAccessor:L,timeAccessor:Po?G:void 0,valueAccessor:z,colorAccessor:T,sizeAccessor:B,groupAccessor:D||(I?"_lineGroup":void 0),categoryAccessor:it,lineDataAccessor:I,xScaleType:bt,yScaleType:xt,xExtent:q,yExtent:X,sizeRange:K,binSize:F,normalize:H,baseline:R,stackOrder:W,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,gradientFill:!0===pe?{topOpacity:.8,bottomOpacity:.05}:!1===pe?void 0:pe,areaGroups:be?new Set(be):void 0,lineGradient:ye,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,lineStyle:ne,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:ae,colorScheme:ue,barColors:ce,barStyle:se,annotations:Ee,decay:at,pulse:lt,transition:Wt,introAnimation:Ft,staleness:dt,heatmapAggregation:ht,heatmapXBins:gt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,pointIdAccessor:mt,curve:N,themeCategorical:null===(e=null==Rt?void 0:Rt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Rt),themeSequential:null===(t=null==Rt?void 0:Rt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Rt?void 0:Rt.colors)||void 0===o?void 0:o.diverging,customLayout:Ct,layoutConfig:jt,layoutMargin:Gt}},[O,Y,$,E,V,U,M,L,G,z,bt,xt,T,B,D,it,I,q,X,K,F,H,R,W,de,he,ge,pe,ye,be,xe,we,Ae,Se,Oe,ne,ie,re,le,ae,se,ue,ce,Ee,at,lt,null==Wt?void 0:Wt.duration,null==Wt?void 0:Wt.easing,Ft,dt,ht,gt,ft,pt,yt,Po,mt,N,Rt,Ct,jt,Gt]),Lo=yn(Mo),To=i(null);To.current||(To.current=new Lt(Lo));const Bo=l(()=>{var e,t;const o=ko.current,n=wo.current;if(!n||!o)return;const i=gi(null!==(t=null===(e=To.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);fi(i,xo.current)||(xo.current=i,n(i))},[]);s(()=>{var e;null===(e=To.current)||void 0===e||e.updateConfig(Lo),Pt.current=!0,Yt()},[Lo,Yt]);const Do=i(null);Do.current||(Do.current=new me(e=>{const t=To.current;t&&t.ingest(e)&&(Pt.current=!0,Yt())},{chunkThreshold:_,chunkSize:P})),s(()=>{var e;null===(e=Do.current)||void 0===e||e.updateChunkOptions({chunkThreshold:_,chunkSize:P})},[_,P]);const Io=l(e=>{var t;null===(t=Do.current)||void 0===t||t.push(e)},[]),No=l(e=>{var t;null===(t=Do.current)||void 0===t||t.pushMany(e)},[]),Ho=l(()=>{var e,t;null===(e=Do.current)||void 0===e||e.clear(),null===(t=To.current)||void 0===t||t.clear(),Pt.current=!0,Yt()},[Yt]);p(a,()=>({push:Io,pushMany:No,remove:e=>{var t,o,n;null===(t=Do.current)||void 0===t||t.flush();const i=null!==(n=null===(o=To.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(lo.current&&i.some(e=>{var t;return e===(null===(t=lo.current)||void 0===t?void 0:t.data)})&&(lo.current=null,mo(null)),Pt.current=!0,Yt()),i},update:(e,t)=>{var o,n,i;null===(o=Do.current)||void 0===o||o.flush();const r=null!==(i=null===(n=To.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Pt.current=!0,Yt()),r},clear:Ho,getData:()=>{var e,t,o;return null===(e=Do.current)||void 0===e||e.flush(),null!==(o=null===(t=To.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=To.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=To.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Io,No,Ho,Yt]),s(()=>{var e,t;if(j){if(I&&Qt.length>0&&"object"==typeof Qt[0]&&null!==Qt[0]){const t="string"==typeof I?I:"coordinates";if(Array.isArray(Qt[0][t])){const o=[];for(const e of Qt){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=Do.current)||void 0===e||e.setBoundedData(o))}}null===(t=Do.current)||void 0===t||t.setBoundedData(Qt)}},[j,Qt,I]);const{hoverHandlerRef:Ro,hoverLeaveRef:Wo,onPointerMove:Fo,onPointerLeave:zo}=Mt;Ro.current=e=>{var t,o,n;if(!Zt)return;const i=oo.current;if(!i)return;const r=i.getBoundingClientRect(),s=e.clientX-r.left-Gt.left,a=e.clientY-r.top-Gt.top;if(0>s||s>Ut||0>a||a>Kt)return void(lo.current&&(lo.current=null,fo.current=null,mo(null),He&&(He(null),Pt.current=!0),Yt()));const l=To.current;if(!l||0===l.scene.length)return;const c=eo(l.scene,s,a,Fe,l.quadtree,l.maxPointRadius),u="multi"===ze,d=()=>{lo.current&&(lo.current=null,fo.current=null,mo(null),He&&He(null),Yt())};if(!c&&!u)return void d();const h=u||!c?s:c.x,g=u||!c?a:c.y;let f=li(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},h,g);if(u&&l.scene.length>0&&l.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=to(Jt(e.path,e.curve),t,o);if(null===r)continue;const s=co(e.path,t);n.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=Jt(e.topPath,e.curve),s=Jt(e.bottomPath,e.curve),a=to(r,t,o);if(null===a)continue;const l=to(s,t,o),c=co(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(l.scene,h,Math.max(Fe,Ut));if(e.length>0){const t=l.scales.y.invert,o=l.scales.x.invert,n=bo.current,i=o?o(h):h;if(c)f.xValue=i,f.xPx=h;else{const e={xValue:i};"string"==typeof M&&(e[M]=i),f=li(e,h,g,{xValue:i,xPx:h})}f.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:e.datum}})}}c||(null===(o=f.allSeries)||void 0===o?void 0:o.length)?(lo.current=f,fo.current=null!==(n=null==c?void 0:c.node)&&void 0!==n?n:null,mo(f),He&&(He(f),Pt.current=!0),Yt()):d()},Wo.current=()=>{lo.current&&(lo.current=null,fo.current=null,mo(null),He&&(He(null),Pt.current=!0),Yt())};const Eo=i(()=>{});Eo.current=e=>{if(!Re)return;const t=oo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Gt.left,i=e.clientY-o.top-Gt.top;if(0>n||n>Ut||0>i||i>Kt)return void Re(null);const r=To.current;if(!r||0===r.scene.length)return void Re(null);const s=eo(r.scene,n,i,Fe,r.quadtree,r.maxPointRadius);Re(s?li(s.datum||{},s.x,s.y):null)};const $o=l(e=>Eo.current(e),[]),Yo=i(-1),Go=i(null),qo=i(null),Xo=l(e=>{const t=To.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(qo.current&&qo.current.version===o)n=qo.current.graph;else{const e=function(e){var t,o,n;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,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,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++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});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!==(n=r.group)&&void 0!==n?n:"_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;n=uo(e),qo.current={version:o,graph:n}}const i=Yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Yo.current=0;const t=n.flat[0];Go.current={shape:t.shape,w:t.w,h:t.h};const o=yo(t);return lo.current=o,mo(o),He&&He(o),void Yt()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Yo.current=-1,Go.current=null,lo.current=null,fo.current=null,mo(null),He&&He(null),void Yt();Yo.current=s;const a=n.flat[s];Go.current={shape:a.shape,w:a.w,h:a.h};const l=yo(a);lo.current=l,mo(l),He&&He(l),Yt()},[He,Yt]),Vo=l(e=>{Yo.current=-1,Go.current=null,Fo(e)},[Fo]);$t.current=()=>{var e,t;Et.current=0;const o=oo.current,n=no.current;if(!o||!n)return;const i=To.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(It.current?r+1e6:r),a=!It.current&&s,l=Pt.current||s;l&&!a&&(i.computeScene({width:Ut,height:Kt}),Bo());const c=Vn(),u=function(e){if(!e)return bi;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||bi.axisStroke,tickText:s||bi.tickText,crosshair:s?xi(s,"66"):bi.crosshair,hoverFill:c?xi(c,"4D"):bi.hoverFill,hoverStroke:s?xi(s,"99"):bi.hoverStroke,pointRing:c||bi.pointRing,primary:r||bi.primary}:bi}(o);bo.current=u.primary;const d=null!==(e=null==dt?void 0:dt.threshold)&&void 0!==e?e:5e3,h=dt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=Xn(o,Ht,Gt,c);if(e){if(e.clearRect(-Gt.left,-Gt.top,Ht[0],Ht[1]),h&&(e.globalAlpha=null!==(t=null==dt?void 0:dt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==oe&&!Je){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=oe||(t&&"transparent"!==t?t:null),i=n?qt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Gt.left,-Gt.top,Ht[0],Ht[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ut,Kt),e.clip()),tt&&i.scales)for(const t of tt)e.save(),t(e,i.scene,i.scales,{width:Ut,height:Kt}),e.restore();const n=Ct?vi.custom:vi[O];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:Ut,height:Kt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Xn(n,Ht,Gt,c);if(e&&(e.clearRect(-Gt.left,-Gt.top,Ht[0],Ht[1]),Zt&&lo.current&&i.scales&&function(e,t,o,n,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,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,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 o=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 o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,lo.current,Ut,Kt,"object"==typeof Zt?Zt:{},fo.current,u),fo.current&&Array.isArray(Ie))){const t=Ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s=o.group;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,fo.current,t,u)}}l&&o&&o.setAttribute("aria-label",Sn(i.scene,O+" chart"));const g=Pt.current;if(Pt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!so||e(so.x.domain()[0])!==e(i.scales.x.domain()[0])||e(so.x.domain()[1])!==e(i.scales.x.domain()[1])||e(so.y.domain()[0])!==e(i.scales.y.domain()[0])||e(so.y.domain()[1])!==e(i.scales.y.domain()[1])||so.x.range()[0]!==i.scales.x.range()[0]||so.x.range()[1]!==i.scales.x.range()[1]||so.y.range()[0]!==i.scales.y.range()[0]||so.y.range()[1]!==i.scales.y.range()[1])&&ao(i.scales),vt){const e=i.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof L?L:e=>e[L||"y"];Co(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),_o(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ee&&Ee.length>0&&ro(e=>e+1),(null==dt?void 0:dt.showBadge)&&So(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Et.current=requestAnimationFrame(()=>$t.current()))},pn({hydrated:Bt,wasHydratingFromSSR:Dt,storeRef:To,dirtyRef:Pt,renderFnRef:$t,cleanup:()=>{var e;return null===(e=Do.current)||void 0===e?void 0:e.clear()}}),s(()=>{Pt.current=!0,Yt()},[O,Ut,Kt,Ce,oe,ne,tt,Yt]),vo(dt,To,Pt,Yt,Ao,So);const Uo=r(()=>{if(Le||Be)return;const e=To.current;return(null==e?void 0:e.xIsDate)&&so?yi(so.x.domain()):void 0},[Le,Be,so]),Ko=Le||Be||Uo,Qo=Zt&&po?Ne?Ne(po):e(wi,{hover:po}):null,Zo=Qo?e(zn,{x:po.x,y:po.y,containerWidth:Ut,containerHeight:Kt,margin:Gt,className:"stream-frame-tooltip",children:Qo}):null,Jo=Go.current,en=e(Fn,{active:Yo.current>=0,hoverPoint:po,margin:Gt,size:Ht,shape:null==Jo?void 0:Jo.shape,width:null==Jo?void 0:Jo.w,height:null==Jo?void 0:Jo.h}),on=(e,t,o,n)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null},nn=on(M,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),sn=on(L,z,"__semiotic_resolvedY","__semiotic_resolvedValue"),cn=nn.key,dn=sn.key,hn=Ee&&Ee.length>0,gn=e=>{if(!e||!hn||!nn.fn&&!sn.fn)return e;let t=!1;const o=e.map(e=>{const o=nn.fn&&nn.key&&!(nn.key in e),n=sn.fn&&sn.key&&!(sn.key in e);if(!o&&!n)return e;t=!0;const i=Object.assign({},e);return o&&(i[nn.key]=nn.fn(e)),n&&(i[sn.key]=sn.fn(e)),i});return t?o:e};if(ln||!Bt&&Dt){const o=To.current;o&&j&&(o.ingest({inserts:Qt,bounded:!0}),o.computeScene({width:Ut,height:Kt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s=Ko||(()=>{if((null==o?void 0:o.xIsDate)&&r)return yi(r.x.domain())})();return t("div",{ref:Nt,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":wt||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1]},children:[e(Nn,{summary:At}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Vt}),t("g",{transform:`translate(${Gt.left},${Gt.top})`,children:[oe&&e("rect",{x:0,y:0,width:Ut,height:Kt,fill:oe}),ot&&r&&ot.map((t,o)=>e(n.Fragment,{children:t(i,r,{width:Ut,height:Kt})},"svgpre-"+o)),i.map((o,n)=>function(o,n,i){var r,s,a,l,c;switch(o.type){case"line":{const t=o;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-"+n)}case"area":{const c=o;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const o=`${i?i+"-":""}area-clip-${n}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:o,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:an(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${o})`})]},"area-"+n)}return e("path",{d:u,fill:an(c.style.fill),fillOpacity:null!==(l=null!==(a=c.style.fillOpacity)&&void 0!==a?a:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+n)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:an(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+n)}case"rect":{const t=o;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:an(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+n)}case"heatcell":{const i=o;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const o=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:o})]},"heatcell-"+n)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+n)}case"candlestick":{const i=o,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-"+n)}default:return null}}(o,n,_t)).filter(Boolean)]})]}),e(rn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:r,showAxes:Ce,axes:je,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:s,yFormat:Te||De,showGrid:Ye,title:nt,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,foregroundGraphics:Tt(Xt,null===(h=To.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:vt,xValues:[],yValues:[],annotations:Ee,svgAnnotationRules:$e,annotationFrame:0,xAccessor:cn,yAccessor:dn,annotationData:gn(null==o?void 0:o.getData()),pointNodes:null==o?void 0:o.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,linkedCrosshairName:St,linkedCrosshairSourceId:Ot})]})}return t("div",{ref:Nt,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":wt||("string"==typeof nt?nt:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1],overflow:"visible"},onKeyDown:Xo,children:[kt&&e(Hn,{tableId:zt}),kt&&e(Dn,{scene:null!==(y=null===(g=To.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:zt,chartTitle:"string"==typeof nt?nt:void 0}),e(Nn,{summary:At}),t("div",{role:"img","aria-label":wt||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Zt?Vo:void 0,onMouseLeave:Zt?zo:void 0,onClick:Re?$o:void 0,children:[Vt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ht[0],height:Ht[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Vt})}),e(tn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:so,showAxes:Ce,axes:je,showGrid:Ye,xFormat:Ko,yFormat:Te||De}),e("canvas",{ref:oo,"aria-label":Sn(null!==(m=null===(v=To.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:no,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Rn,{hoverPoint:po}),e(rn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:so,showAxes:Ce,axes:je,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:Ko,yFormat:Te||De,showGrid:Ye,title:nt,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,foregroundGraphics:Tt(Xt,null===(b=To.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:vt,xValues:Oo,yValues:jo,annotations:Ee,svgAnnotationRules:$e,annotationFrame:io,xAccessor:cn,yAccessor:dn,annotationData:gn(null===(x=To.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=To.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==oe&&!Je,linkedCrosshairName:St,linkedCrosshairSourceId:Ot}),(rt||st)&&e(ve,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,dimension:null!==(w=null==rt?void 0:rt.dimension)&&void 0!==w?w:"xy",scales:so,onBrush:null!=st?st:()=>{},binSize:F,snap:null==rt?void 0:rt.snap,binBoundaries:null!==(A=null==rt?void 0:rt.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=To.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==rt?void 0:rt.snapDuring,streaming:"streaming"===C}),(null==dt?void 0:dt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===dt.badgePosition?{top:4,left:4}:"bottom-left"===dt.badgePosition?{bottom:4,left:4}:"bottom-right"===dt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ao?"#dc3545":"#28a745",color:"white"}),children:Ao?"STALE":"LIVE"}),en,Zo]})]})});Ai.displayName="StreamXYFrame";const Si=u(null);function Oi({colors:t,categories:o,colorScheme:n="category10",children:i}){const s=r(()=>{if(t)return t;if(o){const e=Array.isArray(n)?n:ht[n]||gt,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,n]);return e(Si.Provider,{value:s,children:i})}function Ci(){return a(Si)}function ji(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function _i(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(ji(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Pi(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Oi.displayName="CategoryColorProvider";const[Mi,Li]=be(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Pi(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Pi(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Ti,Bi]=be(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Di(e){const t=f(),o=e.clientId||t,{name:n}=e,i=Li(e=>e.selections.get(n)),s=Li(e=>e.setClause),a=Li(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?_i(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:l(()=>{a(n,o)},[a,n,o]),clientId:o}}function Ii(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Di({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}function Ni(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Hi(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=Di({name:t}),u=o&&n?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Ni(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Ni(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,o,n,a,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}function Ri(e,t,o){const n=Li(e=>e.selections.get(t));return r(()=>{if(!n||0===n.clauses.size)return e;const t=_i(n,o);return e.filter(t)},[e,n,o])}function Wi(e={}){const{limit:t=50,types:o,chartId:n}=e,i=Bi(e=>e.version),s=Bi(e=>e.observations),a=Bi(e=>e.clearObservations),l=r(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[s,o,n,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const Fi=u(!1),zi=u(null),Ei="undefined"==typeof window?s:h;function $i(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function Yi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function Gi(e){const t=a(zi),o=f(),n=$i(e),r=i([]);Yi(r.current,n)||(r.current=n);const s=r.current;Ei(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Ei(()=>{t&&t.registerCategories(o,s)},[t,o,s])}function qi({selections:e}){const t=Li(e=>e.setResolution);return s(()=>{for(const[o,n]of Object.entries(e))n.resolution&&t(o,n.resolution)},[e,t]),null}function Xi({categoryColors:t,interaction:o,selectionName:n,field:a}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=Ii({name:n,fields:[a]}),f=Di({name:n,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[v,m]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===o&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[o,p,a]);const k=l(e=>{"highlight"===o&&(e?(m(e.label),g.onHover({[a]:e.label})):(m(null),g.onHover(null)))},[o,a,g]),w=l(e=>{"isolate"===o&&y(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===u.length?new Set:o})},[o,u.length]),[A,[S]]=$n([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(So,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===o?k:void 0,customClickBehavior:"isolate"===o?w:void 0,highlightedCategory:v,isolatedCategories:p})})})}function Vi({children:o,selections:n,showLegend:s,legendPosition:a="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:u="category"}){const h=Ci(),[g,f]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const o=$i(t);f(t=>{var n;return Yi(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),v=r(()=>{const e=[];for(const t of Object.values(g))for(const o of t)e.push(o);return $i(e)},[g]),m=r(()=>{var e;const t=null!=h?h:{},o=p.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of v)t[e]||o[e]||(o[e]=gt[n%gt.length],n++);const i=Object.assign({},t);for(const n of v)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[h,v]),b=void 0===s||s,x=b&&Object.keys(m).length>0;return e(Mi,{children:t(Ti,{children:[n&&e(qi,{selections:n}),e(zi.Provider,{value:y,children:e(Oi,{colors:m,children:t(Fi.Provider,{value:x,children:[b&&"top"===a&&e(Xi,{categoryColors:m,interaction:l,selectionName:c,field:u}),o,b&&"bottom"===a&&e(Xi,{categoryColors:m,interaction:l,selectionName:c,field:u})]})})})]})})}function Ui({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(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?n(s,t,o):o?o(i):ft[r%ft.length];return{label:i+"",color:a}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:a,label:""}]}}function Ki(e){return e?"string"==typeof e?{name:e}:e:null}function Qi(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}const Zi={light:Se,dark:Oe,"high-contrast":Ce,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Ji(e){return Zi[e]}const er=n.createContext(void 0),tr="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function or(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Ji(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function nr({theme:e}){const t=Pe(e=>e.setTheme),o=Pe(e=>e.theme),i=n.useRef(o);i.current=o;const r=n.useRef(null);n.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=i.current===Ce?Se:i.current,t("high-contrast")),En(o,e=>{var o,n;e.matches?(r.current=i.current===Ce?null!==(o=r.current)&&void 0!==o?o:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===Ce?"high-contrast":t)}(t,null!==(n=r.current)&&void 0!==n?n:Se),r.current=null)})},[e,t]);const s=n.useRef(!1);return tr(()=>{s.current?void 0!==e&&t(or(e)):s.current=!0},[e,t]),null}function ir({children:t}){var o,i,r,s,a;const l=Pe(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(o=l.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=n.useContext(er),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function rr({theme:o,children:i}){const r="string"==typeof o&&Ji(o)?o:void 0,s=n.useMemo(()=>function(e){return void 0!==e?je(Se,or(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ce:Se}(o),[o]);return e(_e,{initialState:{theme:s},children:t(er.Provider,{value:r,children:[e(nr,{theme:o}),e(ir,{children:i})]})})}function sr(){return Pe(e=>e.theme)}const ar="#007bff";function lr(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function cr(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function ur(){var e;const t=sr(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function dr(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=ht[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:ar}function hr(e,t,o){const n=Ci(),i=ur();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=mt(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return mt(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=mt(e,t,s);return e=>n[e]||o(e)}return mt(e,t,s)}if(n&&Object.keys(n).length>0){const e=mt([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}function gr(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}function fr({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:i,chartType:a,chartId:c,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),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,o),v=Di({name:(null==e?void 0:e.name)||"__unused__"}),m=Ii({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Bi(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=d(null),A=g||o[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,k,A]),O=l(e=>{var o,n;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 o=lr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||($o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o})},Go())}(y.name||"hover",o,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&qo(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];w(null!=o?o+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const r=cr(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n: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,m,y,p,i,a,c,b,h,A]),C=l(e=>{var t,o,n,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 o=lr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);if(null==n?void 0:n.locked){const t=new Map($o.positions);return t.delete(e),$o={positions:t},Go(),!1}$o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Go()}(y.name||"hover",o,p)}if(e&&u){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),u(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const o=cr(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n: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,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Xo(e,p),qo(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:C,crosshairSourceId:p}}function pr(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function yr({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(Fi),d=null!==a(zi),h=void 0!==n?n:!u&&!!t,g=!!t&&(h||d),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[c,t,e,g]);Gi(d&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=Ui({data:e,colorBy:t,colorScale:o,getColor:vt,categories:f}),i=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},l),e);return p&&("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},[l,s,p,i]);return{legend:p,margin:y,legendPosition:i}}function vr(e,t,o){const[n,i]=d(null),[s,a]=d(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=l(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const mr={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 br(e,t,o){var n,i,r,s,a,l,c;const u=mr[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.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:xr(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function xr(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function kr(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}const wr={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 Ar(e,t){return"function"==typeof t?t(e):e[t]}function Sr(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 Or(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=Ar(o,i);l=Sr(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Ar(o,n);c.push({label:t,value:Sr(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=Sr(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=Sr(o[e[0]],r))}}const u=Object.assign(Object.assign({},wr),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,o)=>t("div",{style:{marginTop:0===o&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},o))]})}}function Cr(o={}){const{fields:n=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=o;return o=>{if(!o||"object"!=typeof o)return null;const u=[];if(i){const e=Ar(o,i);u.push({value:Sr(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Sr(Ar(o,n),i);u.push({label:l?t:void 0,value:s})}):Object.keys(o).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{u.push({label:l?e:void 0,value:Sr(o[e],r)})});const d=Object.assign(Object.assign({},wr),s);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:d,children:u.map((e,o)=>t("div",{style:{marginBottom:u.length-1>o?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},o))}):null}}function jr(){return o=>{var n,i,r,s,a,l,c;const u=o.allSeries;if(!u||0===u.length){const t=null!==(i=null===(n=o.data)||void 0===n?void 0:n.value)&&void 0!==i?i:null===(r=o.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:wr,children:e("div",{children:Sr(t)})})}const d=null!==(l=null!==(s=o.xValue)&&void 0!==s?s:null===(a=o.data)||void 0===a?void 0:a.time)&&void 0!==l?l:null===(c=o.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:wr,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Sr(d)}),u.map((o,n)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:o.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Sr(o.value)})]},n))]})}}function _r(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t,r=o(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:wr,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Or(t):Or())}}function Pr(e){return"string"==typeof e?e:"value"}function Mr(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Lr(e,t){if(!t)return Mr(e);try{const o=t(e);return null==o?Mr(e):o}catch(t){return Mr(e)}}function Tr(e,t){return"function"==typeof t?t(e):e[t]}function Br(o){const n=o.find(e=>"title"===e.role),i=o.filter(e=>"title"!==e.role);return o=>{const r=o.data;if(!r)return null;const s=n?Lr(Tr(r,n.accessor),n.format):null;return t("div",{className:"semiotic-tooltip",style:wr,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((o,n)=>{const i=Lr(Tr(r,o.accessor),o.format);return t("div",{style:n>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[o.label,": "]}),e("span",{children:i})]},n)})]})}}function Dr({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=Tr(u,o),h=Tr(u,n),g=i?Tr(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:wr,children:[e("div",{style:{fontWeight:"bold"},children:Mr(d)}),e("div",{style:{marginTop:4},children:Lr(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||Pr(i),": ",Mr(g)]})]})}}function Ir({componentName:o,message:n,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:o}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),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 Nr extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e(Ir,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Hr;const Rr="undefined"!=typeof process&&"production"!==(null===(Hr=process.env)||void 0===Hr?void 0:Hr.NODE_ENV);function Wr({componentName:t,width:o,height:n,children:i}){return e(Nr,{fallback:i=>e(Ir,{componentName:t,message:i.message,width:o,height:n}),children:i})}const Fr={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"},zr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Er(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Fr),{width:o,height:n}),children:i||"No data available"}):null}function $r(t,o,n){if(!t)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return e("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},zr),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}function Yr(e,t,o,n){if(!Rr)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Gr(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function qr(e,t,o=3){let n,i=o+1;for(const o of t){const t=Gr(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}function Xr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Vr(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=qr(e,t,3))&&void 0!==o?o:null)}function Ur({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=Xr(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Vr(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Kr({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} 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}function Qr({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!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 o=Xr(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=Vr(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Zr(e){const t=Pe(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}function Jr(e){const{data:t,rawData:o,colorBy:n,colorScheme:i,legendInteraction:s,legendPosition:a,selection:c,linkedHover:u,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:A,width:S,height:O}=e,C=void 0===o,j=r(()=>fe(t),[t]),[_,P]=d([]),M=l(e=>{P(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:B,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:N}=fr({selection:c,linkedHover:u,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:L}),H=pr(u,N),R=hr(j,n,i),W=r(()=>{if(!n)return[];const e=new Set;for(const t of j){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[j,n]),F=r(()=>C&&_.length>0?_:W,[C,_,W]),z=vr(s,n,F),E=r(()=>B||(z.legendSelectionHook?z.legendSelectionHook:T),[B,z.legendSelectionHook,T]),$=Zr(c),Y=ur(),G=Ci(),q=r(()=>{if(R)return R;if(!n||0===F.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Y&&Y.length>0?Y:ft,t="__streamCat",o=mt(F.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[R,n,F,i,Y,G]),{legend:X,margin:V,legendPosition:U}=yr({data:j,colorBy:n,colorScale:q,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:F}),K=r(()=>{const e={};return X&&(e.legend=X,e.legendPosition=U),s&&"none"!==s&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),C&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=M),e},[X,U,s,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,C,n,M]),Q=Array.isArray(o)?fe(o):o,Z=$r(w,S,O),J=Z?null:Er(Q,S,O,A);return{data:j,colorScale:R,allCategories:F,legendState:z,effectiveSelectionHook:E,activeSelectionHook:T,customHoverBehavior:D,customClickBehavior:I,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:H,resolvedSelection:$}}function es(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{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.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},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:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function ts(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const os="__forecastSegment";let ns=null;function is(){return ts(this,void 0,void 0,function*(){return ns||(ns=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),ns})}const rs=g(function(t,o){var n,a;const c=i(null);es(o,{variant:"xy",frameRef:c});const u=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,xAccessor:v="x",yAccessor:m="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:k,colorScheme:w,curve:A="linear",showPoints:S=!1,pointRadius:O=3,fillArea:C=!1,areaOpacity:j=.3,lineWidth:_=2,lineGradient:P,tooltip:M,pointIdAccessor:L,annotations:T,directLabel:B,gapStrategy:D="break",anomaly:I,forecast:N,frameProps:H={},selection:R,linkedHover:W,onObservation:F,onClick:z,hoverHighlight:E,hoverRadius:$,chartId:Y,loading:G,emptyContent:q,legendInteraction:X,legendPosition:V,xScaleType:U,yScaleType:K,color:Q,stroke:Z,strokeWidth:J,opacity:ee}=t,{width:te,height:oe,enableHover:ne,showGrid:ie,showLegend:re,title:se,description:ae,summary:le,accessibleTable:ce,xLabel:ue,yLabel:de}=u,he=r(()=>fe(h),[h]);Yr("LineChart",he,"xAccessor",v),Yr("LineChart",he,"yAccessor",m);const ge="string"==typeof v?v:"__semiotic_resolvedX",pe="string"==typeof m?m:"__semiotic_resolvedY",[ye,ve]=d(null),[me,be]=d([]),xe=r(()=>{if(!N&&!I)return he;const e="function"==typeof v,t="function"==typeof m;return e||t?he.map(o=>{const n=Object.assign({},o);return e&&(n.__semiotic_resolvedX=v(o)),t&&(n.__semiotic_resolvedY=m(o)),n}):he},[he,N,I,v,m]),ke=i(N),we=i(I);s(()=>{if(!N&&!I)return void((ke.current||we.current)&&(ve(null),be([]),ke.current=N,we.current=I));let e=!1;const t=N!==ke.current||I!==we.current;if(ke.current=N,we.current=I,t&&(ve(null),be([])),N){const t=b&&"string"==typeof b&&"object"==typeof N?Object.assign(Object.assign({},N),{_groupBy:b}):N;(function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).buildForecast(...e)})})(xe,ge,pe,t,I).then(t=>{e||(ve(t),be(t.annotations))}).catch(()=>{e||(ve(null),be([]))})}else I&&function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).buildAnomalyAnnotations(...e)})}(I).then(t=>{e||(ve(null),be(t))}).catch(()=>{e||be([])});return()=>{e=!0}},[xe,N,I,ge,pe]);const Ae=ye?ye.processedData:he,Se="__compoundGroup",Oe=!(!N||!b),Ce=Oe?Se:N?os:b,je=r(()=>{if(!Oe)return Ae;const e="function"==typeof b?b:e=>e[b];return Ae.map(t=>{const o=Object.assign({},t);return o[Se]=`${e(t)}__${t[os]||"observed"}`,o})},[Ae,Oe,b]),_e=Oe?je:Ae,Pe=r(()=>{if(!N)return;const e=N.upperBounds,t=N.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=ye?ye.processedData:he;for(const e of s){const t="function"==typeof m?m(e):+e[m];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[N,ye,he,m]),Me=l(e=>{const t="function"==typeof v?v(e):e[v],o="function"==typeof m?m(e):e[m];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[v,m]),Le=void 0!==(null===(n=_e[0])||void 0===n?void 0:n[x]),Te=r(()=>{if(Le)return _e;if(Ce){const e=_e.reduce((e,t)=>{const o="function"==typeof Ce?Ce(t):t[Ce];if(!e[o]){const n={[x]:[]};"string"==typeof Ce&&(n[Ce]=o),Oe&&(n[os]=t[os],"string"==typeof b&&(n[b]=t[b])),e[o]=n}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:_e}]},[_e,Ce,x,Le]),{gapProcessedLineData:Be,hasGaps:De}=r(()=>{if("interpolate"===D){let e=!1;const t=[];for(const o of Te){const n=(o[x]||[]).filter(t=>!Me(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[x]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===D){let e=!1;const t=[];for(const o of Te){const n=o[x]||[];let i=[],r=0;const s=Ce&&"string"==typeof Ce?o[Ce]:void 0;for(const a of n)if(Me(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[x]: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({},o),{[x]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===D){let e=!1;const t="string"==typeof m?m:"y",o=[];for(const n of Te){const i=n[x]||[],r=[];for(const o of i)Me(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[x]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Te,hasGaps:!1}},[Te,D,x,Me,Ce,m]),Ie="object"==typeof B?B:{},Ne=Ie.position||"end",He=Ie.fontSize||11,Re=r(()=>{var e;if(!B||!k)return[];const t="function"==typeof k?k:e=>e[k],o=new Set;for(const n of Be){const i=n[x]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Ne?i[i.length-1]:i[0]))&&void 0!==e?e:t(n);if(null==r)continue;const s=r+"";""!==s&&o.add(s)}return Array.from(o)},[B,k,Be,x,Ne]),We=r(()=>{if(!B)return u.marginDefaults;const e=Re.reduce((e,t)=>Math.max(e,t.length*(.6*He)),0),t=e+10,o="end"===Ne?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[o]:Math.max(u.marginDefaults[o]||0,t)})},[B,Re,He,Ne,u.marginDefaults]),Fe=Jr({data:Ae,rawData:h,colorBy:k,colorScheme:w,legendInteraction:X,legendPosition:V,selection:R,linkedHover:W,fallbackFields:k?["string"==typeof k?k:""]:[],unwrapData:!1,onObservation:F,onClick:z,hoverHighlight:E,chartType:"LineChart",chartId:Y,showLegend:(!B||void 0!==re)&&re,userMargin:g,marginDefaults:We,loading:G,emptyContent:q,width:te,height:oe}),ze=Fe.colorScale,Ee=Fe.effectiveSelectionHook,$e=Fe.resolvedSelection,Ye=Fe.customHoverBehavior,Ge=Fe.customClickBehavior,qe=Fe.crosshairProps,Xe=r(()=>(e,t)=>{const o={strokeWidth:_},n=!0===C||Array.isArray(C)&&null!=t&&C.includes(t);return k?ze&&(o.stroke=vt(e,k,ze),n&&(o.fill=o.stroke,o.fillOpacity=j)):(o.stroke=Q||ar,n&&(o.fill=Q||ar,o.fillOpacity=j)),o},[k,ze,_,C,j,Q]),[Ve,Ue]=d(null);s(()=>{if(!N)return void Ue(null);let e=!1;return function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).createSegmentLineStyle(...e)})}(Xe,N).then(t=>{e||Ue(()=>t)}).catch(()=>{e||Ue(null)}),()=>{e=!0}},[Xe,N]);const Ke=Ve||Xe,Qe=r(()=>kr(Ke,{stroke:Z,strokeWidth:J,opacity:ee}),[Ke,Z,J,ee]),Ze=r(()=>Qi(Qe,Ee,$e),[Qe,Ee,$e]),Je=r(()=>{if(S)return e=>{const t={r:O,fillOpacity:1};return k?ze&&(t.fill=vt(e.parentLine||e,k,ze)):t.fill=Q||ar,t}},[S,O,k,ze,Q]),et=Array.isArray(C)?"mixed":C?"area":"line",tt=r(()=>{var e;if(!B||!k)return[];const t="function"==typeof v?v:e=>e[v],o="function"==typeof m?m:e=>e[m],n="function"==typeof k?k:e=>e[k],i=new Map;for(const t of Be){const o=t[x]||[];if(0===o.length)continue;const r="end"===Ne?o[o.length-1]:o[0],s=null!==(e=n(r))&&void 0!==e?e:n(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,n])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(n),["string"==typeof m?m:"y"]:o(n),dx:"end"===Ne?6:-6,dy:0,color:ze?ze(e):ar,fontSize:He}));r.sort((e,t)=>{const o="string"==typeof m?m:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof m?m:"y",o=r[e-1],n=r[e];He+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=He+2)}return r},[B,k,ze,Be,x,v,m,Ne,He]),ot=Fe.margin,nt=b||k,it=r(()=>Br([{label:ue||Pr(v),accessor:v,role:"x",format:p},{label:de||Pr(m),accessor:m,role:"y",format:y},...nt?[{label:Pr(nt),accessor:nt,role:"group"}]:[]]),[v,m,ue,de,nt,p,y]),rt=Ur({componentName:"LineChart",data:Le?(null===(a=Ae[0])||void 0===a?void 0:a[x])||[]:h,accessors:{xAccessor:v,yAccessor:m}}),st=r(()=>Le||Ce||De?Be.flatMap(e=>{const t=e[x]||[];return Ce&&"string"==typeof Ce?t.map(t=>Object.assign(Object.assign({},t),{[Ce]:e[Ce]})):t}):_e,[Be,x,Le,Ce,_e,De]),at=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:et},Array.isArray(C)&&{areaGroups:C}),P&&{lineGradient:P}),null!=$&&{hoverRadius:$}),null!=h&&{data:st}),{xAccessor:v,yAccessor:m,xScaleType:U,yScaleType:K}),Pe&&{yExtent:Pe}),{groupAccessor:"break"===D&&De?"_gapSegment":Ce||void 0,curve:A,lineStyle:Ze}),S&&{pointStyle:Je}),{size:[te,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ot,showAxes:u.showAxes,xLabel:ue,yLabel:de,xFormat:p,yFormat:y,enableHover:ne,showGrid:ie}),Fe.legendBehaviorProps),se&&{title:se}),ae&&{description:ae}),le&&{summary:le}),void 0!==ce&&{accessibleTable:ce}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===M?()=>null:"multi"===M?jr():_r(M)||it}),"multi"===M&&{tooltipMode:"multi"}),(W||F||z||E)&&{customHoverBehavior:Ye}),(F||z||W)&&{customClickBehavior:Ge}),L&&{pointIdAccessor:L}),((null==T?void 0:T.length)||me.length||tt.length)&&{annotations:[...T||[],...me,...tt]}),qe),H);return Fe.earlyReturn?Fe.earlyReturn:rt?e(Ir,{componentName:"LineChart",message:rt,width:te,height:oe}):e(Wr,{componentName:"LineChart",width:te,height:oe,children:e(Ai,Object.assign({ref:c},at))})});function ss(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function as(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function ls(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:_r(t)||o}}rs.displayName="LineChart";const cs=g(function(t,o){var n;const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(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:g="x",yAccessor:f="y",areaBy:p,y0Accessor:y,gradientFill:v=!1,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:C=!1,pointRadius:j=3,tooltip:_,annotations:P,frameProps:M={},selection:L,linkedHover:T,onObservation:B,onClick:D,hoverHighlight:I,chartId:N,loading:H,emptyContent:R,legendInteraction:W,legendPosition:F,color:z,stroke:E,strokeWidth:$,opacity:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=a,oe=r(()=>fe(l),[l]);Yr("AreaChart",oe,"xAccessor",g),Yr("AreaChart",oe,"yAccessor",f);const ne=void 0!==(null===(n=oe[0])||void 0===n?void 0:n[m]),ie=r(()=>{if(ne)return oe;if(p){const e=oe.reduce((e,t)=>{const o="function"==typeof p?p(t):t[p];if(!e[o]){const t={[m]:[]};"string"==typeof p&&(t[p]=o),e[o]=t}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:oe}]},[oe,p,m,ne]),re=Jr({data:oe,rawData:l,colorBy:b,colorScheme:x,legendInteraction:W,legendPosition:F,selection:L,linkedHover:T,fallbackFields:b?["string"==typeof b?b:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:I,chartType:"AreaChart",chartId:N,showLegend:U,userMargin:c,marginDefaults:a.marginDefaults,loading:H,emptyContent:R,width:G,height:q}),se=r(()=>e=>{const t={};if(b){if(re.colorScale){const o=vt(e,b,re.colorScale);t.fill=o,S?(t.stroke=o,t.strokeWidth=O):t.stroke="none"}}else{const e=z||ar;t.fill=e,S?(t.stroke=e,t.strokeWidth=O):t.stroke="none"}return t.fillOpacity=w,t},[b,re.colorScale,z,w,S,O]),ae=r(()=>kr(se,{stroke:E,strokeWidth:$,opacity:Y}),[se,E,$,Y]),le=r(()=>Qi(ae,re.effectiveSelectionHook,re.resolvedSelection),[ae,re.effectiveSelectionHook,re.resolvedSelection]),ce=r(()=>{if(C)return e=>{const t={r:j,fillOpacity:1};return b?re.colorScale&&(t.fill=vt(e.parentLine||e,b,re.colorScale)):t.fill=ar,t}},[C,j,b,re.colorScale]),ue=p||b,de=r(()=>Br([{label:ee||Pr(g),accessor:g,role:"x",format:d},{label:te||Pr(f),accessor:f,role:"y",format:h},...ue?[{label:Pr(ue),accessor:ue,role:"group"}]:[]]),[g,f,ee,te,ue,d,h]),he=Ur({componentName:"AreaChart",data:l,accessors:{xAccessor:g,yAccessor:f}}),ge=r(()=>ne||p?ie.flatMap(e=>{const t=e[m]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):oe,[ie,m,ne,p,oe]),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ge}),{xAccessor:g,yAccessor:f,groupAccessor:p||void 0}),y&&{y0Accessor:y}),v&&{gradientFill:v}),A&&{lineGradient:A}),{curve:k,lineStyle:le}),C&&ce&&{pointStyle:ce}),{size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:a.showAxes,xLabel:ee,yLabel:te,xFormat:d,yFormat:h,enableHover:X}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:V}),re.legendBehaviorProps),ss({title:K,description:Q,summary:Z,accessibleTable:J,className:u,animate:t.animate})),"multi"===_?{tooltipContent:jr(),tooltipMode:"multi"}:ls({tooltip:_,defaultTooltipContent:de})),as({linkedHover:T,onObservation:B,onClick:D,hoverHighlight:I,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),P&&P.length>0&&{annotations:P}),re.crosshairProps),M);return re.earlyReturn?re.earlyReturn:he?e(Ir,{componentName:"AreaChart",message:he,width:G,height:q}):e(Wr,{componentName:"AreaChart",width:G,height:q,children:e(Ai,Object.assign({ref:s},pe))})});cs.displayName="AreaChart";const us=g(function(t,o){var n;const s=i(null),a=br(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:g="x",yAccessor:f="y",areaBy:p,lineDataAccessor:y="coordinates",colorBy:v,colorScheme:m,curve:b="monotoneX",areaOpacity:x=.7,showLine:k=!0,lineWidth:w=2,showPoints:A=!1,pointRadius:S=3,normalize:O=!1,baseline:C="zero",stackOrder:j,tooltip:_,annotations:P,frameProps:M={},selection:L,linkedHover:T,onObservation:B,onClick:D,hoverHighlight:I,chartId:N,loading:H,emptyContent:R,legendInteraction:W,legendPosition:F,color:z,stroke:E,strokeWidth:$,opacity:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=a,oe=r(()=>fe(l),[l]),ne=v||p;es(o,{variant:"xy",frameRef:s});const ie=void 0!==(null===(n=oe[0])||void 0===n?void 0:n[y]),re=r(()=>{if(ie)return oe;if(p){const e=oe.reduce((e,t)=>{const o="function"==typeof p?p(t):t[p];if(!e[o]){const t={[y]:[]};"string"==typeof p&&(t[p]=o),e[o]=t}return e[o][y].push(t),e},{});return Object.values(e)}return[{[y]:oe}]},[oe,p,y,ie]),se=Jr({data:oe,rawData:l,colorBy:ne,colorScheme:m,legendInteraction:W,legendPosition:F,selection:L,linkedHover:T,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:I,chartType:"StackedAreaChart",chartId:N,showLegend:U,userMargin:c,marginDefaults:a.marginDefaults,loading:H,emptyContent:R,width:G,height:q}),ae=r(()=>e=>{const t={};if(ne&&se.colorScale){const o=vt(e,ne,se.colorScale);t.fill=o,k?(t.stroke=o,t.strokeWidth=w):t.stroke="none"}else if(!ne){const e=z||ar;t.fill=e,t.stroke=k?e:"none",k&&(t.strokeWidth=w)}return t.fillOpacity=x,t},[ne,se.colorScale,x,k,w,z]),le=r(()=>kr(ae,{stroke:E,strokeWidth:$,opacity:Y}),[ae,E,$,Y]),ce=r(()=>Qi(le,se.effectiveSelectionHook,se.resolvedSelection),[le,se.effectiveSelectionHook,se.resolvedSelection]),ue=r(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return ne?se.colorScale&&(t.fill=vt(e.parentLine||e,ne,se.colorScale)):t.fill=z||ar,t}},[A,S,ne,se.colorScale,z]),de=p||v,he=r(()=>Br([{label:ee||Pr(g),accessor:g,role:"x",format:d},{label:te||Pr(f),accessor:f,role:"y",format:h},...de?[{label:Pr(de),accessor:de,role:"group"}]:[]]),[g,f,ee,te,de,d,h]),ge=Ur({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:g,yAccessor:f}}),pe=r(()=>ie||p?re.flatMap(e=>{const t=e[y]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):oe,[re,y,ie,p,oe]),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:pe}),{xAccessor:g,yAccessor:f,groupAccessor:p||void 0,curve:b,normalize:O,baseline:O?"zero":C,stackOrder:j,lineStyle:ce}),A&&ue&&{pointStyle:ue}),{size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:a.showAxes,xLabel:ee,yLabel:te,xFormat:d,yFormat:h,enableHover:X}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:V}),se.legendBehaviorProps),ss({title:K,description:Q,summary:Z,accessibleTable:J,className:u,animate:t.animate})),"multi"===_?{tooltipContent:jr(),tooltipMode:"multi"}:ls({tooltip:_,defaultTooltipContent:he})),as({linkedHover:T,onObservation:B,onClick:D,hoverHighlight:I,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),P&&P.length>0&&{annotations:P}),se.crosshairProps),M);return se.earlyReturn?se.earlyReturn:ge?e(Ir,{componentName:"StackedAreaChart",message:ge,width:G,height:q}):e(Wr,{componentName:"StackedAreaChart",width:G,height:q,children:e(Ai,Object.assign({ref:s},ye))})});us.displayName="StackedAreaChart";const ds=g(function(t,o){const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:v,sizeBy:m,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:C={},selection:j,linkedHover:_,linkedBrush:P,onObservation:M,onClick:L,hoverHighlight:T,chartId:B,loading:D,emptyContent:I,legendInteraction:N,legendPosition:H,color:R,stroke:W,strokeWidth:F,opacity:z}=t,{width:E,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=a,J=r(()=>fe(c),[c]),ee=Jr({data:J,rawData:c,colorBy:y,colorScheme:v,legendInteraction:N,legendPosition:H,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:M,onClick:L,hoverHighlight:T,chartType:"Scatterplot",chartId:B,showLegend:q,userMargin:u,marginDefaults:a.marginDefaults,loading:D,emptyContent:I,width:E,height:$}),te=Ki(P),oe=Hi({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 p?p:void 0)}),ne=te?"xyBrush"===oe.brushInteraction.brush?"xy":"xBrush"===oe.brushInteraction.brush?"x":"y":void 0,ie=n.useRef(oe.brushInteraction);ie.current=oe.brushInteraction;const re=l(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;Yr("Scatterplot",J,"xAccessor",f),Yr("Scatterplot",J,"yAccessor",p);const se=r(()=>{if(!m||0===J.length)return;const e=J.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[J,m]),ae=r(()=>e=>{const t={fillOpacity:k};return y?ee.colorScale&&(t.fill=vt(e,y,ee.colorScale)):t.fill=R||ar,t.r=m?bt(e,m,b,se):x,t},[y,ee.colorScale,m,b,se,x,k,R]),le=r(()=>kr(ae,{stroke:W,strokeWidth:F,opacity:z}),[ae,W,F,z]),ce=r(()=>Qi(le,ee.effectiveSelectionHook,ee.resolvedSelection),[le,ee.effectiveSelectionHook,ee.resolvedSelection]),ue=r(()=>Br([{label:Q||Pr(f),accessor:f,role:"x",format:h},{label:Z||Pr(p),accessor:p,role:"y",format:g},...y?[{label:Pr(y),accessor:y,role:"color"}]:[],...m?[{label:Pr(m),accessor:m,role:"size"}]:[]]),[f,p,Q,Z,y,m,h,g]),de=Ur({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(de)return e(Ir,{componentName:"Scatterplot",message:de,width:E,height:$});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({chartType:"scatter"},null!=c&&{data:J}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:m||void 0,sizeRange:b,pointStyle:ce,colorScheme:v,size:[E,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:h,yFormat:g,enableHover:Y,showGrid:G}),ee.legendBehaviorProps),ss({title:X,description:V,summary:U,accessibleTable:K,className:d,animate:t.animate})),ls({tooltip:w,defaultTooltipContent:ue})),as({linkedHover:_,onObservation:M,onClick:L,hoverHighlight:T,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),te&&{brush:{dimension:ne},onBrush:re}),ee.crosshairProps),C);return e(Wr,{componentName:"Scatterplot",width:E,height:$,children:e(Ai,Object.assign({ref:s},he))})});function hs(e,t){return Je(1===t?.5:e/(t-1))}ds.displayName="Scatterplot";const gs=g(function(t,n){var s,a;const l=i(null);es(n,{variant:"xy",frameRef:l});const c=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:v,orderLabel:m,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,stroke:B,strokeWidth:D,opacity:I}=t,{width:N,height:H,enableHover:R,showGrid:W,title:F,description:z,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=c,q=u||[],{safeData:X,orderMap:V}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let o=q;if(v&&q.length>0){const e="function"==typeof v?v:e=>e[v];o=[...q].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[q,v,p,y]);Yr("ConnectedScatterplot",X,"xAccessor",p),Yr("ConnectedScatterplot",X,"yAccessor",y);const U=Jr({data:X,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:O,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:j,hoverHighlight:_,chartType:"ConnectedScatterplot",chartId:P,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:M,emptyContent:L,width:N,height:H}),K=null!==(a=null===(s=U.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==a?a:.5,Q=r(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=U.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=U.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const o=s[t],n=s[t+1],d=hs(t,u),h=!a||!l||l(null!==(i=o.datum)&&void 0!==i?i:o)||l(null!==(r=n.datum)&&void 0!==r?r:n),g=a?h?1:K:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,U.effectiveSelectionHook,K]),Z=r(()=>[Q],[Q]),J=r(()=>(t,n,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 o=a[t],n=a[t+1],i=hs(t,l),d="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,h="number"==typeof(null===(s=n.style)||void 0===s?void 0:s.opacity)?n.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(o,{children:u})},[b]),ee=r(()=>[J],[J]),te=r(()=>e=>{var t,o;const n=V.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?hs(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,V]),oe=r(()=>kr(te,{stroke:B,strokeWidth:D,opacity:I}),[te,B,D,I]),ne=r(()=>Qi(oe,U.effectiveSelectionHook,U.resolvedSelection),[oe,U.effectiveSelectionHook,U.resolvedSelection]),ie=m||("string"==typeof v?v:"Order"),re=r(()=>Br([{label:Y||Pr(p),accessor:p,role:"x",format:g},{label:G||Pr(y),accessor:y,role:"y",format:f},...v?[{label:ie,accessor:v,role:"group"}]:[]]),[p,y,Y,G,v,ie,g,f]),se=Ur({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:X}),{xAccessor:p,yAccessor:y,pointStyle:ne,size:[N,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,showAxes:c.showAxes,xLabel:Y,yLabel:G,xFormat:g,yFormat:f,enableHover:R,showGrid:W}),ss({title:F,description:z,summary:E,accessibleTable:$,className:h,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:re})),as({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:Z,svgPreRenderers:ee}),w&&w.length>0&&{annotations:w}),U.crosshairProps),A);return U.earlyReturn?U.earlyReturn:se?e(Ir,{componentName:"ConnectedScatterplot",message:se,width:N,height:H}):e(Wr,{componentName:"ConnectedScatterplot",width:N,height:H,children:e(Ai,Object.assign({ref:l},ae))})});gs.displayName="ConnectedScatterplot";const fs=g(function(t,o){const n=i(null),s=br(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:c,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",sizeBy:y,sizeRange:v=[5,40],colorBy:m,colorScheme:b,bubbleOpacity:x=.6,bubbleStrokeWidth:k=1,bubbleStrokeColor:w="white",tooltip:A,marginalGraphics:S,pointIdAccessor:O,annotations:C,frameProps:j={},selection:_,linkedHover:P,linkedBrush:M,onObservation:L,onClick:T,hoverHighlight:B,chartId:D,loading:I,emptyContent:N,legendInteraction:H,legendPosition:R,color:W,stroke:F,strokeWidth:z,opacity:E}=t,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=s,ee=r(()=>fe(a),[a]),te=void 0===a,oe=Jr({data:ee,rawData:a,colorBy:m,colorScheme:b,legendInteraction:H,legendPosition:R,selection:_,linkedHover:P,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:B,chartType:"BubbleChart",chartId:D,showLegend:X,userMargin:c,marginDefaults:s.marginDefaults,loading:I,emptyContent:N,width:$,height:Y}),ne=i(null),[ie,re]=d(0),se=l(e=>{if(!te)return;let t=!1;for(const o of e){const e="function"==typeof y?y(o):o[y];null!=e&&isFinite(e)&&(ne.current?(ne.current[0]>e&&(ne.current[0]=e,t=!0),e>ne.current[1]&&(ne.current[1]=e,t=!0)):(ne.current=[e,e],t=!0))}t&&re(e=>e+1)},[te,y]),ae=l(e=>{var t;se([e]),null===(t=n.current)||void 0===t||t.push(e)},[se]),le=l(e=>{var t;se(e),null===(t=n.current)||void 0===t||t.pushMany(e)},[se]);es(o,{variant:"xy",frameRef:n,overrides:{push:ae,pushMany:le,clear:()=>{var e;ne.current=null,re(e=>e+1),null===(e=n.current)||void 0===e||e.clear()}},deps:[ae,le]});const ce=Ki(M);Hi({name:(null==ce?void 0:ce.name)||"__unused_brush__",xField:(null==ce?void 0:ce.xField)||("string"==typeof f?f:void 0),yField:(null==ce?void 0:ce.yField)||("string"==typeof p?p:void 0)});const ue=r(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ee,y,te,ie]),de=r(()=>e=>{const t={fillOpacity:x,strokeWidth:k,stroke:w};return m?oe.colorScale&&(t.fill=vt(e,m,oe.colorScale)):t.fill=W||ar,t.r=bt(e,y,v,ue),t},[m,oe.colorScale,y,v,ue,x,k,w,W]),he=r(()=>kr(de,{stroke:F,strokeWidth:z,opacity:E}),[de,F,z,E]),ge=r(()=>Qi(he,oe.effectiveSelectionHook,oe.resolvedSelection),[he,oe.effectiveSelectionHook,oe.resolvedSelection]),pe=r(()=>Br([{label:Z||Pr(f),accessor:f,role:"x",format:h},{label:J||Pr(p),accessor:p,role:"y",format:g},{label:Pr(y),accessor:y,role:"size"},...m?[{label:Pr(m),accessor:m,role:"color"}]:[]]),[f,p,Z,J,y,m,h,g]),ye=Ur({componentName:"BubbleChart",data:a,accessors:{xAccessor:f,yAccessor:p},requiredProps:{sizeBy:y}});if(ye)return e(Ir,{componentName:"BubbleChart",message:ye,width:$,height:Y});const ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=a&&{data:ee}),{xAccessor:f,yAccessor:p,colorAccessor:m||void 0,sizeAccessor:y,sizeRange:v,pointStyle:ge,colorScheme:b,size:[$,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:h,yFormat:g,enableHover:G,showGrid:q}),oe.legendBehaviorProps),ss({title:V,description:U,summary:K,accessibleTable:Q,className:u,animate:t.animate})),ls({tooltip:A,defaultTooltipContent:pe})),as({linkedHover:P,onObservation:L,onClick:T,hoverHighlight:B,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),S&&{marginalGraphics:S}),O&&{pointIdAccessor:O}),C&&C.length>0&&{annotations:C}),oe.crosshairProps),j);return oe.earlyReturn?oe.earlyReturn:e(Wr,{componentName:"BubbleChart",width:$,height:Y,children:e(Ai,Object.assign({ref:n},ve))})});fs.displayName="BubbleChart";const ps=g(function(t,o){var n;const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(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:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:v,showValues:m=!1,valueFormat:b,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,showLegend:T,legendPosition:B,legendInteraction:D}=t,{width:I,height:N,enableHover:H,title:R,description:W,summary:F,accessibleTable:z,xLabel:E,yLabel:$}=a,Y=$r(M,I,N),G=Y?null:Er(l,I,N,L),q=r(()=>fe(l),[l]),X=function(){var e;const t=sr();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),V=null!==(n=null!=y?y:X)&&void 0!==n?n:"blues",U=null!=T&&T,K=null!=B?B:"right",{margin:Q}=yr({data:q,colorBy:U?"value":void 0,colorScale:void 0,showLegend:U,legendPosition:K,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:Z,customClickBehavior:J,crosshairSourceId:ee}=fr({selection:A,linkedHover:O,fallbackFields:[],onObservation:C,onClick:j,chartType:"Heatmap",chartId:P,hoverHighlight:_,colorByField:void 0});Zr(A);const te=pr(O,ee);vr(D,void 0,[]);const oe=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ne=r(()=>{const e=q.map(oe);return[Math.min(...e),Math.max(...e)]},[q,oe]),ie=r(()=>"custom"===V&&v?v:S({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it}[V]||Xe).domain(ne),[V,v,ne]),re=r(()=>Br([{label:E||Pr(d),accessor:d,role:"x",format:f},{label:$||Pr(h),accessor:h,role:"y",format:p},{label:Pr(g),accessor:g,role:"value",format:b}]),[d,h,E,$,g,f,p,b]),se=Ur({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ae=r(()=>{if(U)return{gradient:{colorFn:e=>ie(e),domain:ne,label:"string"==typeof g?g:"value",format:b}}},[U,ie,ne,g,b]),le=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:q}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==V?V:void 0,showValues:m,heatmapValueFormat:b,size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,showAxes:a.showAxes,xLabel:E,yLabel:$,xFormat:f,yFormat:p,enableHover:H}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ae&&{legend:ae,legendPosition:K}),ss({title:R,description:W,summary:F,accessibleTable:z,className:u,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:re})),as({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,customHoverBehavior:Z,customClickBehavior:J})),k&&k.length>0&&{annotations:k}),te),w);return Y||G||(se?e(Ir,{componentName:"Heatmap",message:se,width:I,height:N}):e(Wr,{componentName:"Heatmap",width:I,height:N,children:e(Ai,Object.assign({ref:s},le))}))});ps.displayName="Heatmap";const ys="__splomIdx",vs={top:4,bottom:4,left:4,right:4};function ms({frameRef:t,cellSize:o,onBrush:n}){const r=i(null),a=o-vs.left-vs.right,l=o-vs.top-vs.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),o=b().extent([[0,0],[a,l]]).on("brush end",e=>{var o;const i=null===(o=t.current)||void 0===o?void 0:o.getScales();if(!i)return;if(!e.selection)return void n(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)]];n(c)});return e.call(o),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[a,l,t,n]),e("svg",{ref:r,width:o,height:o,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${vs.left},${vs.top})`})})}function bs({data:o,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const v=i(null),m=Di({name:h,clientId:`splom-${n}-${r}`}),b=Hi({name:h,xField:n,yField:r}),x=Di({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,o=null==t?void 0:t[ys];void 0!==o&&(k({[ys]:[o]}),null==y||y(t,e.x+vs.left,e.y+vs.top))},[k,y]),S=l(e=>{const t={opacity:c,r:a};return t.fill=u?vt(e,u,d):ar,"hover"===p?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*c):m.isActive&&!m.predicate(e)&&(t.opacity=f),t},[u,d,c,a,p,m.isActive,m.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Ai,{ref:v,chartType:"scatter",data:o,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:S,margin:vs,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(ms,{frameRef:v,cellSize:s,xField:n,yField:r,onBrush:w})]})}function xs({data:o,field:n,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Di({name:u,clientId:"splom-diag-"+n}),f=Di({name:d,clientId:`splom-diag-${n}-hover`}),p="hover"===h?f:g,y=p.isActive,v=p.predicate,m=r(()=>{const e=o.map(e=>e[n]).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(o.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)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const s=Math.min(Math.floor((o-t)/i),a-1);if(d[s]++,y&&!v(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!v(e)||f[s][t]++)}}const p=Math.max(...d,1),m=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})});return{bars:d.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:m,selectedCategoryBars:b,max:p,categories:c}},[o,n,a,s,y,v,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}),m.categories.length>0?m.categoryBars.map((t,o)=>t.map((t,n)=>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):ar,opacity:y?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ar,opacity:y?.3:.6},"bg-"+o)),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>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):ar,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ar,opacity:.7},"sel-"+o)))]})}function ks({label:t,cellSize:o}){return e("svg",{width:o,height:o,children:e("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function ws(o){const{data:i,fields:s,fieldLabels:a={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:v=20,brushMode:m="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:C,chartId:j}=o,_="splom",P="splom-hover",M=b?"hover":m?"brush":"hover",L=Li(e=>e.clearSelection),[T,B]=d(null),D=l(()=>{L(P),B(null)},[L,P]),I=r(()=>(i||[]).map((e,t)=>void 0!==e[ys]?e:Object.assign(Object.assign({},e),{[ys]:t})),[i]),N=hr(I,c,u),H=void 0!==A?A:!!c,R=r(()=>{if(!H||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(I.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):ar})):null},[H,c,I,N]),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:O,style:{position:"relative"},children:[R&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:R.map(o=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:o.color}}),e("span",{style:{fontSize:11},children:o.label})]},o.label))}),t("div",{style:W,onMouseLeave:"hover"===M?D:void 0,children:[s.map((o,i)=>t(n.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[o]||o}),s.map((t,n)=>i===n?"label"===y?e(ks,{label:a[o]||o,cellSize:h},"diag-"+o):e(xs,{data:I,field:o,label:a[o]||o,cellSize:h,bins:v,colorBy:c,colorScale:N,brushSelectionName:_,hoverSelectionName:P,unselectedOpacity:x,mode:M},"diag-"+o):e(bs,{data:I,xField:t,yField:o,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:N,brushSelectionName:_,hoverSelectionName:P,unselectedOpacity:x,showGrid:k,tooltip:w,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(B({datum:e,xField:t,yField:o,colIndex:n,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(B(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${o}-${t}`))]},"row-"+o)),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))]}),T&&"hover"===M&&(()=>{const o=T.datum,n=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=c?"function"==typeof c?c(o):o[c]:null,s=S?"function"==typeof S?S(o):o[S]:"Row "+o[ys];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.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:[n,": ",null!=o[T.xField]?Number(o[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=o[T.yField]?Number(o[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function As(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e(Vi,{selections:i,children:e(ws,Object.assign({},t))})}function Ss({width:t,height:o,margin:n,scales:r,brushDirection:a,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+n.left+n.right,f=o+n.top+n.bottom;return s(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),n="x"===a?v().extent([[0,0],[t,o]]):m().extent([[0,0],[t,o]]);return n.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?r.x:r.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[r,t,o,a,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(d.current.move,o)}else e.call(d.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function Os(o){var n,a;const{data:c,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:v,xLabel:m,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:C,colorScheme:j,curve:_="linear",lineWidth:P=2,fillArea:M=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:B=3,enableHover:D=!0,showGrid:I=!1,showLegend:N,legendPosition:H,tooltip:R,minimap:W={},renderBefore:F=!1,onBrush:z,brushExtent:E,frameProps:$={},loading:Y,emptyContent:G}=o,q=$r(Y,u,h),X=q?null:Er(c,u,h,G),V=r(()=>fe(c),[c]),[U,K]=d(null),Q=null!=E?E:U,Z=l(e=>{E||K(e),null==z||z(e)},[E,z]),J=i(null),[ee,te]=d(null);s(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=J.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?te(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const oe=void 0!==(null===(n=V[0])||void 0===n?void 0:n[O]),ne=r(()=>{if(oe)return V;if(S){const e=V.reduce((e,t)=>{const o="function"==typeof S?S(t):t[S];if(!e[o]){const t={[O]:[]};"string"==typeof S&&(t[S]=o),e[o]=t}return e[o][O].push(t),e},{});return Object.values(e)}return[{[O]:V}]},[V,S,O,oe]),ie=r(()=>oe||S?ne.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):V,[ne,O,oe,S,V]),re=hr(V,C,j),se=r(()=>e=>{const t={strokeWidth:P};return t.stroke=C?vt(e,C,re):ar,M&&(t.fill=t.stroke,t.fillOpacity=L),t},[C,re,P,M,L]),ae=r(()=>W.lineStyle?W.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=C?vt(e,C,re):ar,t},[C,re,W.lineStyle]),le=r(()=>{if(T)return e=>{const t={r:B,fillOpacity:1};return t.fill=C?vt(e.parentLine||e,C,re):ar,t}},[T,B,C,re]),{legend:ce,margin:ue,legendPosition:de}=yr({data:ne,colorBy:C,colorScale:re,showLegend:N,legendPosition:H,userMargin:g}),he=W.height||60,ge=r(()=>{var e,t,o,n,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!==(n=null===(o=W.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n: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",ye=Ur({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(ye)return e(Ir,{componentName:"MinimapChart",message:ye,width:u,height:h});const ve=M?"area":"line",me=r(()=>Br([{label:m||Pr(w),accessor:w,role:"x",format:x},{label:b||Pr(A),accessor:A,role:"y",format:k}]),[w,A,m,b,x,k]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ve,data:ie,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:_,lineStyle:se},T&&{pointStyle:le}),{size:[u,h],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,showAxes:!0,xLabel:m,yLabel:b,xFormat:x,yFormat:k,enableHover:D,showGrid:I}),ce&&{legend:ce,legendPosition:de}),p&&{title:p}),y&&{description:y}),v&&{summary:v}),{tooltipContent:!1===R?()=>null:_r(R)||me}),Q&&{xExtent:Q}),$),xe={chartType:ve,data:ie,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:_,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},ke=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Ai,Object.assign({ref:J},xe)),e(Ss,{width:u-ge.left-ge.right,height:he,margin:ge,scales:ee,brushDirection:pe,extent:Q,onBrush:Z})]},"minimap"),we=e("div",{style:{overflow:"hidden"},children:e(Ai,Object.assign({},be))},"main");return q||X||e(Wr,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[F?ke:we,F?we:ke]})})}As.displayName="ScatterplotMatrix",Os.displayName="MinimapChart";const Cs=g(function(n,s){const a=i(null);es(s,{variant:"xy",frameRef:a});const l=br(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:v,quadrants:m,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:_,pointIdAccessor:P,annotations:M,frameProps:L={},selection:T,linkedHover:B,onObservation:D,onClick:I,hoverHighlight:N,chartId:H,loading:R,emptyContent:W,legendInteraction:F,legendPosition:z,color:E,stroke:$,strokeWidth:Y,opacity:G}=n,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=l,ne=r(()=>fe(c),[c]),ie=Jr({data:ne,rawData:c,colorBy:w,colorScheme:A,legendInteraction:F,legendPosition:z,selection:T,linkedHover:B,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:N,chartType:"QuadrantChart",chartId:H,showLegend:K,userMargin:u,marginDefaults:l.marginDefaults,loading:R,emptyContent:W,width:q,height:X});Yr("QuadrantChart",ne,"xAccessor",f),Yr("QuadrantChart",ne,"yAccessor",p);const re=r(()=>{if(!ne.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(o>y&&(o=y),y>n&&(n=y)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[ne,f,p,y,v]),se=r(()=>{if(!S||0===ne.length)return;const e=ne.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},[ne,S]),ae=r(()=>"function"==typeof f?f:e=>+e[f],[f]),le=r(()=>"function"==typeof p?p:e=>+e[p],[p]),ce=r(()=>e=>{const t={fillOpacity:j};if(w)ie.colorScale&&(t.fill=vt(e,w,ie.colorScale));else{const o=ae(e),n=le(e),i=null!=y?o>=y:void 0,r=null!=v?n>=v:void 0;t.fill=void 0===r||void 0===i?E||ar:r&&i?m.topRight.color:r&&!i?m.topLeft.color:!r&&i?m.bottomRight.color:m.bottomLeft.color}return t.r=S?bt(e,S,O,se):C,t},[w,ie.colorScale,S,O,se,C,j,ae,le,y,v,m,E]),ue=r(()=>kr(ce,{stroke:$,strokeWidth:Y,opacity:G}),[ce,$,Y,G]),de=r(()=>Qi(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=r(()=>{if(!ne.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,f,p,w,S]),ge=r(()=>Br([...he?[{label:he,accessor:he,role:"title"}]:[],{label:te||Pr(f),accessor:f,role:"x",format:h},{label:oe||Pr(p),accessor:p,role:"y",format:g},...w?[{label:Pr(w),accessor:w,role:"color"}]:[],...S?[{label:Pr(S),accessor:S,role:"size"}]:[]]),[he,f,p,te,oe,w,S,h,g]),pe=Ur({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ye=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=y?n.x(y):s/2,c=null!=v?n.y(v):a/2;if(null!=y&&!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:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:s-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:a-d},{config:m.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([])}]},[y,v,m,b]),ve=r(()=>x?[...ye,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=y?o.x(y):i/2,a=null!=v?o.y(v):r/2;(null==y||isFinite(s))&&(null==v||isFinite(a))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,i-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,r-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ye,[ye,x,k,m,y,v]),me=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),be=r(()=>{var n;const i={stroke:b.stroke||"#999",strokeWidth:null!==(n=b.strokeWidth)&&void 0!==n?n:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(n,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!=y?r.x(y):a/2,u=null!=v?r.y(v):l/2;if(null!=y&&!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(o,{children:[[{config:m.topLeft,x:0,y:0,w:d,h:h},{config:m.topRight,x:d,y:0,w:a-d,h:h},{config:m.bottomLeft,x:0,y:h,w:d,h:l-h},{config:m.bottomRight,x:d,y:h,w:a-d,h:l-h}].map((t,o)=>{var n;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!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):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}),x&&t(o,{children:[e("text",{x:8,y:8+k,fill:m.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.topLeft.label}),e("text",{x:a-8,y:8+k,fill:m.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.topRight.label}),e("text",{x:8,y:l-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:m.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.bottomRight.label})]})]})}]},[y,v,m,b,x,k]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:ne}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:de,colorScheme:A,size:[q,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:l.showAxes,xLabel:te,yLabel:oe,xFormat:h,yFormat:g,enableHover:V,showGrid:U}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),Q&&{title:Q}),Z&&{description:Z}),J&&{summary:J}),void 0!==ee&&{accessibleTable:ee}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?ge:_r(_)||ge}),(B||D||I||N)&&{customHoverBehavior:ie.customHoverBehavior}),(D||I||B)&&{customClickBehavior:ie.customClickBehavior}),P&&{pointIdAccessor:P}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:me}),ie.crosshairProps),L),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:be});return ie.earlyReturn?ie.earlyReturn:pe?e(Ir,{componentName:"QuadrantChart",message:pe,width:q,height:X}):e(Wr,{componentName:"QuadrantChart",width:q,height:X,children:e(Ai,Object.assign({ref:a},xe))})});Cs.displayName="QuadrantChart";const js="__ma_unitized",_s="__ma_series";function Ps(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Ms(e,t){return t[0]+e*(t[1]-t[0])}const Ls=g(function(t,o){var s;const a=i(null),l=i([]),c=i(t.series);c.current=t.series,p(o,()=>{const e=()=>{var e;return(null!==(e=c.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!a.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||l.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=r&&isFinite(r)&&a.current.push(Object.assign(Object.assign({},n),{[js]:Ps(r,i),[_s]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!a.current)return;const o=e(),n=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const i=o[t],r=i.extent||l.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},e),{[js]:Ps(s,r),[_s]:i.label||"Series "+(t+1)}))}a.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},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 u=br(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:g,xFormat:f,xAccessor:y="x",series:v,colorScheme:m,curve:b="monotoneX",lineWidth:x=2,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,stroke:D,strokeWidth:I,opacity:N}=t,{width:H,height:R,enableHover:W,showGrid:F,showLegend:z=!0,title:E,description:$,summary:Y,accessibleTable:G,xLabel:q}=u,X=r(()=>fe(d),[d]),V=r(()=>fe(v),[v]),U=V,K=2===V.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||K||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const Q=$r(M,H,R),Z=Q?null:Er(d,H,R,L),J=ur(),ee=r(()=>{let e;if(Array.isArray(m))e=m;else if(J&&J.length>0)e=J;else{const t=ht[m];e=Array.isArray(t)?t:gt}return U.map((t,o)=>t.color||e[o%e.length])},[U,m,J]),te=r(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:oe,extents:ne}=r(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(l.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(X,e.yAccessor));if(l.current=e,!K){const t=[];for(const e of X)for(let o=0;V.length>o;o++){const n=V[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[js]:i,[_s]:te[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of X)for(let n=0;2>n;n++){const i=V[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[js]:Ps(r,e[n]),[_s]:te[n]}))}return{unitizedData:t,extents:e}},[X,V,K,te]),ie=r(()=>{if(K&&ne.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=Ms(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=Ms(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[K,ne,V,te]),re=Jr({data:r(()=>oe.length>0?oe:te.map(e=>({[_s]:e})),[oe,te]),rawData:d,colorBy:_s,colorScheme:ee,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:[_s],unwrapData:!1,onObservation:C,onClick:j,hoverHighlight:_,chartType:"MultiAxisLineChart",chartId:P,showLegend:z,userMargin:h,marginDefaults:K?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:M,emptyContent:L,width:H,height:R});if(re.earlyReturn)return re.earlyReturn;const se=r(()=>{const e=new Map;return te.forEach((t,o)=>e.set(t,ee[o])),t=>({stroke:e.get(t[_s])||ee[0],strokeWidth:x,fill:"none"})},[te,ee,x]),ae=r(()=>kr(se,{stroke:D,strokeWidth:I,opacity:N}),[se,D,I,N]),le=r(()=>Qi(ae,re.effectiveSelectionHook,re.resolvedSelection),[ae,re.effectiveSelectionHook,re.resolvedSelection]),ce=r(()=>{if(!1===k)return()=>null;return _r(k)||(e=>{var t;const o=e.data||e,i=o[_s],r=te.indexOf(i),s=o[js],a=K&&r>=0&&ne[r]?Ms(s,ne[r]):s,l=r>=0&&(null===(t=V[r])||void 0===t?void 0:t.format)?V[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return n.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},n.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[r]||"inherit"}},i),n.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),n.createElement("div",null,`${i}: ${l(a)}`))})},[k,te,ee,ne,K,V,y]),ue=Ur({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),de=K?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:oe}),{xAccessor:y,yAccessor:js,groupAccessor:_s,lineStyle:le,colorScheme:ee,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:u.showAxes}),ie&&{axes:ie}),{xLabel:q}),K?{}:{yLabel:te[0]}),{xFormat:f}),K&&de&&{yExtent:de}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:F,curve:b}),re.legendBehaviorProps),E&&{title:E}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),{tooltipContent:ce}),w&&{annotations:w}),(O||C||j||_)&&{customHoverBehavior:re.customHoverBehavior}),(C||j||O)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),A);return Q||Z||(ue?e(Ir,{componentName:"MultiAxisLineChart",message:ue,width:H,height:R}):e(Wr,{componentName:"MultiAxisLineChart",width:H,height:R,children:e(Ai,Object.assign({ref:a},he))}))});Ls.displayName="MultiAxisLineChart";const Ts=g(function(t,o){const n=i(null);es(o,{variant:"xy",frameRef:n});const s=br(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:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:C,emptyContent:j}=t,{width:_,height:P,enableHover:M,showGrid:L,title:T,description:B,summary:D,accessibleTable:I,xLabel:N,yLabel:H}=s,R=$r(C,_,P),W=R?null:Er(a,_,P,j),F=r(()=>fe(a),[a]),z=null==p||null==y;Yr("CandlestickChart",F,"xAccessor",h),Yr("CandlestickChart",F,"highAccessor",g),Yr("CandlestickChart",F,"lowAccessor",f),z||(Yr("CandlestickChart",F,"openAccessor",p),Yr("CandlestickChart",F,"closeAccessor",y));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=fr({selection:k,linkedHover:w,onObservation:A,onClick:S,chartType:"CandlestickChart",chartId:O}),G=pr(w,Y),q=r(()=>{const e=s.marginDefaults,o="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?o:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},o),l)},[l,s.marginDefaults,t.mode]),X=r(()=>{const e=[{label:N||Pr(h),accessor:h,role:"x",format:u}];return z?(e.push({label:"High",accessor:g,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:g,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:y,format:d})),Br(e)},[h,N,u,d,g,f,p,y,z]),V=Ur({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!z&&{openAccessor:p,closeAccessor:y})}),U=Math.max(2,Math.min(12,Math.round(_/40))),K=_>200?.1:.02,Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=a&&{data:F}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!z&&{openAccessor:p,closeAccessor:y}),v&&{candlestickStyle:v}),{scalePadding:U,extentPadding:K,size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q,showAxes:s.showAxes,xLabel:N,yLabel:H,xFormat:u,yFormat:d,enableHover:M,showGrid:L}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ss({title:T,description:B,summary:D,accessibleTable:I,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:X})),as({linkedHover:w,onObservation:A,onClick:S,customHoverBehavior:E,customClickBehavior:$})),b&&b.length>0&&{annotations:b}),G),x);return R||W||(V?e(Ir,{componentName:"CandlestickChart",message:V,width:_,height:P}):e(Wr,{componentName:"CandlestickChart",width:_,height:P,children:e(Ai,Object.assign({ref:n},Q))}))});function Bs(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function Ds(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=E(e,.25))&&void 0!==t?t:r,median:null!==(o=E(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=E(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function Is(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function Ns(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}Ts.displayName="CandlestickChart";const Hs={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(He(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(He(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(He(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(He(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Bs,donut:Bs,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(o=E(l,.25))&&void 0!==o?o:c,m=null!==(n=E(l,.5))&&void 0!==n?n:(c+u)/2,b=null!==(i=E(l,.75))&&void 0!==i?i:u,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:u,O=h(t.pieceData[0],t.name),C=[];if(v)for(const e of t.pieceData){const o=d(e);if(k>o||o>w){const n=y?t.middle:g(o),i=y?g(o):t.middle;C.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:C}),v)for(const t of C)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...d,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const o=u(r+(t+.5)*a);m+=` L ${e.middle+d[t]/y*v} ${o}`}m+=` L ${e.middle} ${u(s)}`;for(let t=f-1;t>=0;t--){const o=u(r+(t+.5)*a);m+=` L ${e.middle-d[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/y*v}`;m+=` L ${u(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const a=null!==(o=E(t,.25))&&void 0!==o?o:r,l=null!==(n=E(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=E(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Ds(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(He(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:Ds(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(He(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(He(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return f;const m=[],b=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),m.push(e))}const x=m.length>1&&"_default"!==m[0],w=[];let A=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),x||o>A&&(A=o)}if(x)for(const e of w){let t=0,o=0;for(let n=0;m.length>n;n++){const i=e.groups.get(m[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const S=new Map;for(const e of m){const t=w[0].groups.get(e);S.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,C=x?.95*p:.9*t.width,j=k().domain([0,A]).range([0,C]),_=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let P=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,u=0===t,d=n.width,h=.55*d,v=n.x+(d-h)/2,b=new Map;if(x){let e=0;for(const t of m){const n=o.groups.get(t);n&&(e+=j(n.total))}let t=p,i=p;for(let r=0;m.length>r;r++){const a=m[r],l=o.groups.get(a);if(!l)continue;const c=j(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=v,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=v,O.__funnelBarW=c),f.push(He(x,v,c,h,k,O,a)),b.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=j(e),s=p-t/2,a=m[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],d=l?a:n.name,x=g(c,d),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:u,category:l?a:n.name});y&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=v,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=v,w.__funnelBarW=t),f.push(He(s,v,t,h,x,w,d)),b.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&P.size>0){const t=x?m:[m[0]];for(const i of t){const t=P.get(i),r=b.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:_},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(u)}}P=b}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),S=o.x+e*a+l/2,O=m(y),C=m(0)-O,j=c(f.pieces[0],p?h:o.name),_=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:m(y+A)});if(d.push(He(S,O,u,C,j,_,p?h:o.name)),A>0){const e=m(y+A),t=O-e,n=Object.assign({},j),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(He(S,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=d?He(s,o.x,a,o.width,n,null,"__track__"):He(o.x,s,o.width,a,n,null,"__track__");u.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(d){const r=l(t),s=l(t+n);f=He(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=He(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}}return u}};class Rs{constructor(e){this.rExtent=new Le,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Me(e.windowSize),this.getO=Ee(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Fe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=Fe(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Ee(e.stackBy),this.getGroup=Ee(e.groupBy),this.getColor=Ee(e.colorAccessor),this.getConnector=Ee(e.connectorAccessor),this.getDataId=Ee(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=O().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;d=k().domain(s).range([n,o])}else a?(u=O().domain(r).range([0,e.height]).padding(c),d=k().domain(s).range([0,e.width])):(u=O().domain(r).range([0,e.width]).padding(c),d=k().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?k().domain([l,c]).range([0,e.width]):k().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),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.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Hs[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=Is(r.colorScheme,r.themeCategorical,ft),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:Ns(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,Rs.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=C().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),s=wt(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=St(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=St(n.x,e._targetX,s),e.y=St(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=St(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=St(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=St(o.x,e._targetX,s),e.y=St(o.y,e._targetY,s),void 0!==o.w&&(e.w=St(o.w,e._targetW,s),e.h=St(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=St(o.startAngle,e._targetStartAngle,s),e.endAngle=St(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!We(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!We(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!We(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(We(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Ee(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!We(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Fe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=Fe(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!We(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Ee(this.config.stackBy):void 0),"groupBy"in e&&!We(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Ee(this.config.groupBy):void 0),"colorAccessor"in e&&!We(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Ee(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!We(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Ee(this.config.connectorAccessor):void 0)}}function Ws(e,t,o){const n=Bt(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Fs(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function zs(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Ht(Math.atan2(i,n)),a=Ht(e.startAngle),l=Ht(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Es(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function $s(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Ys(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==u?void 0:u.projection),y="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||p?[]:(f||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Gs)(e)})),[u,g,p,f]),m=h&&u&&!p,b=d&&u&&!p;return m||b?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[m&&e("g",{className:"ordinal-grid",children:v.map((t,o)=>e("line",{x1:y?t.pixel:0,y1:y?0:t.pixel,x2:y?t.pixel:i,y2:y?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&e(o,{children:t(o,y?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Gs(e){return Math.round(100*e)/100+""}function qs(n){var s,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C,legendPosition:j="right",foregroundGraphics:_,annotations:P,svgAnnotationRules:M,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:D,children:I}=n,N="radial"===(null==g?void 0:g.projection),H="horizontal"===(null==g?void 0:g.projection),R=!1!==p,W=r(()=>f&&R&&g&&!N?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,R,g,m,N]),F=n.rTickValues,z=n.tickLabelEdgeAlign,E=r(()=>f&&g&&!N?(F||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Gs)(e)})):[],[f,g,b,N,F]),$=i(new Map),Y=i(null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0),G=null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0;Y.current!==G&&(Y.current=G,$.current=new Map);const q=r(()=>{if(!P||0===P.length)return null;const e=Eo(),t="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,n={scales:g?{x:t?g.r:o||g.r,y:t&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:$.current};return P.map((t,o)=>{if(M){const i=M(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[P,M,l,c,g,L,T,B]);return f||k||w||_||q&&q.length>0||x||I?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!N&&!D&&e("g",{className:"ordinal-grid",children:E.map((t,o)=>e("line",{x1:H?t.pixel:0,y1:H?0:t.pixel,x2:H?t.pixel:l,y2:H?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!N&&e("g",{className:"ordinal-axes",children:t(o,H?{children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.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:o.label})})]},"cat-"+n)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),E.map((o,n)=>{const i=z?0===n?"start":n===E.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!D&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,o=0>t||t>c?c:t;return e("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((o,n)=>t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.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:o.label})})]},"cat-"+n)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),q,_,I]}),k&&e("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof k?k:null}),jo({legend:w,totalWidth:u,totalHeight:d,margin:h,legendPosition:j,title:k,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C})]}):null}function Xs({width:t,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!u.current)return;const e=y(u.current).select(".brush-g"),n=b?v():m();return n.extent([[0,0],[t,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=x.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),d.current=null}},[t,o,b]),s(()=>{if(!l||!d.current||!p.current)return;if(!u.current)return;const e=p.current,t=y(u.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1)},[l,b]),e("svg",{ref:u,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Vs(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Us(e,t){const o=W().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}Rs.QUADTREE_THRESHOLD=500;const Ks=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?qt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Us(e,t)):(Vs(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Vs(e,t),ti(e,t)),e.globalAlpha=1}},Qs=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=qt(e,"var(--semiotic-primary, #007bff)"),a=qt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?qt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?qt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Zs=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?qt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Js=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=qt(e,o.style.stroke)||("string"==typeof o.style.fill?qt(e,o.style.fill):o.style.fill)||qt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},ea=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function ta(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function oa(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let na=null;const ia=new Map;function ra(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=ia.get(o);if(void 0!==n)return n;const i=function(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(na||(na=document.createElement("canvas")),na.width=e,na.height=e,na)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ia.set(o,i),i}function sa(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function aa(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function la(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ca=e=>[Js,...e],ua={bar:ca([si]),clusterbar:ca([si]),point:ca([ii]),swarm:ca([ii]),pie:[Ks],donut:[Ks],boxplot:ca([Qs,ii]),violin:ca([Zs]),histogram:ca([si]),ridgeline:ca([Zs]),timeline:ca([si]),funnel:[si,ea,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?ta(i):null!=r?`${ta(i)} (${oa(r)})`:ta(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=ta(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[si,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||qt(e,"var(--semiotic-border, #999)"),n=ra(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=Xt(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,qt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,u=r?la(i):"",d=aa(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,v=y-f/2,m=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),sa(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),sa(e,v,m,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,m+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,m+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,m+3))}e.lineWidth=1}],swimlane:ca([si]),custom:ca([si,ii,Ks,Qs,Zs,ea])},da={top:50,right:40,bottom:60,left:70},ha={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ga({hover:o}){var n,i,r,s,a,l;const c=o.data||{},u=o.stats,d=o.category;if(Array.isArray(c)){const o=d||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:ha,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:ha,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return t("div",{className:"semiotic-tooltip",style:ha,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===o.length&&t("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ha,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ha,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}return t("div",{className:"semiotic-tooltip",style:ha,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const fa=g(function(o,a){var c,u,h,g,f,y,v,m,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:C="value",colorAccessor:j,stackBy:_,groupBy:P,multiAxis:M,timeAccessor:L,valueAccessor:T,categoryAccessor:B,projection:D="vertical",size:I=[600,400],responsiveWidth:N,responsiveHeight:H,margin:R,barPadding:F,roundedTop:z,gradientFill:E,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,showAxes:ve=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:Ce,oFormat:je,rFormat:_e,rTickValues:Pe,tickLabelEdgeAlign:Me,enableHover:Le=!0,hoverAnnotation:Te,tooltipContent:Be,customHoverBehavior:De,annotations:Ie,svgAnnotationRules:Ne,showGrid:He=!1,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:$e,legendCategoryAccessor:Ye,onCategoriesChange:Ge,backgroundGraphics:qe,foregroundGraphics:Xe,title:Ve,className:Ue,background:Ke,centerContent:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:ot,brush:nt,onBrush:it,accessibleTable:rt=!0,description:st,summary:at,customLayout:lt,layoutConfig:ct}=o,ut=i(!0),dt=qn({sizeProp:I,responsiveWidth:N,responsiveHeight:H,userMargin:R,marginDefault:da,foregroundGraphics:Xe,backgroundGraphics:qe,animate:tt,transitionProp:et,themeDirtyRef:ut}),{reducedMotionRef:ht,responsiveRef:gt,size:ft,margin:pt,adjustedWidth:yt,adjustedHeight:vt,resolvedForeground:mt,resolvedBackground:bt,currentTheme:xt,transition:kt,introEnabled:wt,tableId:At,rafRef:St,renderFnRef:Ot,scheduleRender:Ct}=dt,jt=un(),_t=fn(),Pt=r(()=>fe(S),[S]),Mt=null!=xe?xe:Oe,Lt=null!=we?we:Ce,Bt=null!=Ae?Ae:je,Dt=null!=Se?Se:_e,It=i(null),Nt=i(null),Ht=i([]),Wt=i(Ye),Ft=i(Ge);Wt.current=Ye,Ft.current=Ge;const[zt,Et]=d(null),[$t,Yt]=d(null),[Gt,Xt]=d(0),[Vt,Ut]=d(!1),[Kt,Qt]=d(null),Zt=l(()=>{var e,t;Qt(null!==(t=null===(e=no.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Jt=Le||Te,eo="streaming"===A,to=r(()=>{var e,t,o;return{chartType:w,runtimeMode:eo?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:le,projection:D,oAccessor:eo?void 0:O,rAccessor:eo?void 0:C,colorAccessor:j,stackBy:_,groupBy:P,multiAxis:M,timeAccessor:eo?L:void 0,valueAccessor:eo?T||("string"==typeof C||"function"==typeof C?C:void 0):void 0,categoryAccessor:eo?B||O:void 0,rExtent:se,oExtent:ae,barPadding:F,roundedTop:z,gradientFill:E,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:pe,themeCategorical:null===(e=null==xt?void 0:xt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(xt),themeSequential:null===(t=null==xt?void 0:xt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==xt?void 0:xt.colors)||void 0===o?void 0:o.diverging,barColors:ye,decay:Ze,pulse:Je,transition:kt,introAnimation:wt,staleness:ot,customLayout:lt,layoutConfig:ct,layoutMargin:pt}},[w,de,ue,le,D,O,C,j,_,P,M,L,T,B,se,ae,F,z,E,$,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,ne,ie,re,ce,he,ge,pe,ye,Ze,Je,null==kt?void 0:kt.duration,null==kt?void 0:kt.easing,wt,ot,eo,xt,lt,ct,pt]),oo=yn(to),no=i(null);no.current||(no.current=new Rs(oo));const io=l(()=>{var e,t;const o=Wt.current,n=Ft.current;if(!n||!o)return;const i=gi(null!==(t=null===(e=no.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);fi(i,Ht.current)||(Ht.current=i,n(i))},[]);s(()=>{var e;null===(e=no.current)||void 0===e||e.updateConfig(oo),ut.current=!0,Ct()},[oo,Ct]);const ro=i(null);ro.current||(ro.current=new me(e=>{const t=no.current;t&&t.ingest(e)&&(ut.current=!0,Ct())}));const so=l(e=>{var t;null===(t=ro.current)||void 0===t||t.push(e)},[]),ao=l(e=>{var t;null===(t=ro.current)||void 0===t||t.pushMany(e)},[]),lo=l(()=>{var e,t;null===(e=ro.current)||void 0===e||e.clear(),null===(t=no.current)||void 0===t||t.clear(),ut.current=!0,Ct()},[Ct]),co=l(e=>{var t,o;null===(t=ro.current)||void 0===t||t.clearLastData(),null===(o=ro.current)||void 0===o||o.setReplacementData(e)},[]);p(a,()=>({push:so,pushMany:ao,replace:co,remove:e=>{var t,o,n,i;null===(t=ro.current)||void 0===t||t.flush();const r=null!==(n=null===(o=no.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=Nt.current)||void 0===i?void 0:i.data;!!Nt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Nt.current=null,Et(null)),ut.current=!0,Ct()}return r},update:(e,t)=>{var o,n,i;null===(o=ro.current)||void 0===o||o.flush();const r=null!==(i=null===(n=no.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ut.current=!0,Ct()),r},clear:lo,getData:()=>{var e,t,o;return null===(e=ro.current)||void 0===e||e.flush(),null!==(o=null===(t=no.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=no.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[so,ao,co,lo,Ct]),s(()=>{var e;S&&(null===(e=ro.current)||void 0===e||e.setBoundedData(Pt))},[S,Pt]);const{hoverHandlerRef:fo,hoverLeaveRef:po,onPointerMove:mo,onPointerLeave:bo}=dt;fo.current=e=>{if(!Jt)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-pt.left,i=e.clientY-o.top-pt.top;if(0>n||n>yt||0>i||i>vt)return void(Nt.current&&(Nt.current=null,Et(null),De&&De(null),Ct()));const r=no.current;if(!r||0===r.scene.length)return;const s="radial"===D,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Rt(i,t,o,n,r);e&&(s={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"rect":if(null==r.datum)break;e=Ws(r,t,o);break;case"point":if(i)break;e=Fs(r,t,o,n);break;case"wedge":e=zs(r,t,o);break;case"boxplot":e=Es(r,t,o);break;case"violin":e=$s(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-yt/2:n,s?i-vt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Nt.current&&(Nt.current=null,Et(null),De&&De(null),Ct()));const l=li(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w}));Nt.current=l,Et(l),De&&(De(l),ut.current=!0),Ct()},po.current=()=>{Nt.current&&(Nt.current=null,Et(null),De&&(De(null),ut.current=!0),Ct())};const xo=i(-1),ko=i(null),wo=i(null),Ao=l(e=>{const t=no.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(wo.current&&wo.current.version===o)n=wo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";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!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=uo(e),wo.current={version:o,graph:n}}const i=xo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),xo.current=0;const t=n.flat[0];ko.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},yo(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});return Nt.current=o,Et(o),De&&De(o),void Ct()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return xo.current=-1,ko.current=null,Nt.current=null,Et(null),De&&De(null),void Ct();xo.current=s;const a=n.flat[s];ko.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},yo(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});Nt.current=l,Et(l),De&&De(l),Ct()},[De,Ct]),So=l(e=>{xo.current=-1,ko.current=null,mo(e)},[mo]);Ot.current=()=>{var e,t;St.current=0;const o=It.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=no.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(ht.current?r+1e6:r),a=!ht.current&&s,l=ut.current;l&&!s&&(i.computeScene({width:yt,height:vt}),io(),Zt(),ut.current=!1),(l||a)&&o.setAttribute("aria-label",Sn(i.scene,w+" chart"));const c=Vn(),u=ft[0]*c,d=ft[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=ft[0]+"px",o.style.height=ft[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,ft[0],ft[1]);const h=null!==(e=null==ot?void 0:ot.threshold)&&void 0!==e?e:5e3,g=ot&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==ot?void 0:ot.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ke&&!qe){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Ke||(e&&"transparent"!==e?e:null),i=t?qt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,ft[0],ft[1]))}const f="radial"===D;n.save(),n.beginPath(),n.rect(pt.left,pt.top,yt,vt),n.clip(),f?(n.save(),n.translate(pt.left+yt/2,pt.top+vt/2)):n.translate(pt.left,pt.top);const p=lt?ua.custom:ua[w]||[],y={width:yt,height:vt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Yt(i.scales),Xt(e=>e+1)),(null==ot?void 0:ot.showBadge)&&Ut(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(St.current=requestAnimationFrame(()=>Ot.current()))},pn({hydrated:jt,wasHydratingFromSSR:_t,storeRef:no,dirtyRef:ut,renderFnRef:Ot,cleanup:()=>{var e;return null===(e=ro.current)||void 0===e?void 0:e.clear()}}),s(()=>{ut.current=!0,Ct()},[w,yt,vt,ve,Ke,Ct]),vo(ot,no,ut,Ct,Vt,Ut);const Oo=Jt&&zt?Be?Be(zt):e(ga,{hover:zt}):null,Co="radial"===D,jo=Oo?e(zn,{x:zt?Co?zt.x+yt/2:zt.x:0,y:zt?Co?zt.y+vt/2:zt.y:0,containerWidth:yt,containerHeight:vt,margin:pt,className:"stream-ordinal-tooltip",children:Oo}):null;if(ln||!jt&&_t){const o=no.current;o&&S&&(o.ingest({inserts:Pt,bounded:!0}),o.computeScene({width:yt,height:vt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s="radial"===D,a=s?pt.left+yt/2:pt.left,l=s?pt.top+vt/2:pt.top;return t("div",{ref:gt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:N?"100%":ft[0],height:H?"100%":ft[1]},children:[e(Nn,{summary:at}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ft[0],height:ft[1],style:{position:"absolute",left:0,top:0},children:[bt&&e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt}),t("g",{transform:`translate(${a},${l})`,children:[Ke&&e("rect",{x:0,y:0,width:yt,height:vt,fill:Ke}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const u=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",d=e=>`ord-${o.type}-${u}-${i}-${e}`,h=`ord-${o.type}-${u}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.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;for(let o=0;t.length>o;o++)l.push(e("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=an(t.style.fill);l.push(e("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:an(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+u-o} A${o},${o} 0 0 0 ${r+o},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r+o},${l+u} A${o},${o} 0 0 1 ${r},${l+u-o} Z`;break;default:d=`M${r},${l+u} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u} Z`}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:an(t.style.fill),opacity:null!==(r=t.style.opacity)&&void 0!==r?r:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}case"wedge":{const t=o,n=W().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2);t.cornerRadius&&n.cornerRadius(t.cornerRadius);const i=n(sn)||"";return e("path",{d:i,transform:`translate(${t.cx},${t.cy})`,fill:an(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return t("g","vertical"===n.projection?{children:[e("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:an(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:an(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const t=o,n=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:an(t.style.fill),fillOpacity:null!==(l=t.style.fillOpacity)&&void 0!==l?l:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},d("path"))];if(t.iqrLine&&t.bounds){const o=t.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med"))):n.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med")))}return e("g",{children:n},h)}case"connector":return e("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const t=o,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:n,fill:an(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),e(qs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:r,showAxes:ve,showCategoryTicks:be,oLabel:Mt,rLabel:Lt,oFormat:Bt,rFormat:Dt,rTickValues:Pe,tickLabelEdgeAlign:Me,showGrid:He,title:Ve,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:$e,foregroundGraphics:Tt(mt,null===(h=no.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:Ie,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof C?C:void 0,annotationData:null==o?void 0:o.getData()}),Qe&&"radial"===D&&e("div",{style:{position:"absolute",left:pt.left+yt/2,top:pt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe})]})}return t("div",{ref:gt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"group","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:N?"100%":ft[0],height:H?"100%":ft[1],overflow:"visible"},onKeyDown:Ao,children:[rt&&e(Hn,{tableId:At}),rt&&e(Dn,{scene:null!==(f=null===(g=no.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:At,chartTitle:"string"==typeof Ve?Ve:void 0}),e(Nn,{summary:at}),t("div",{role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?So:void 0,onMouseLeave:Jt?bo:void 0,children:[bt&&e("svg",{style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1],pointerEvents:"none"},children:e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt})}),e(Ys,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,showAxes:ve,showGrid:He,rFormat:Dt,rTickValues:Pe}),e("canvas",{ref:It,"aria-label":Sn(null!==(v=null===(y=no.current)||void 0===y?void 0:y.scene)&&void 0!==v?v:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1]}}),e(Rn,{hoverPoint:zt}),e(qs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,showAxes:ve,showCategoryTicks:be,oLabel:Mt,rLabel:Lt,oFormat:Bt,rFormat:Dt,showGrid:He,title:Ve,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:$e,foregroundGraphics:Tt(mt,Kt),annotations:Ie,svgAnnotationRules:Ne,annotationFrame:Gt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof C?C:void 0,annotationData:null===(m=no.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(nt||it)&&"radial"!==D&&e(Xs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,onBrush:it||(()=>{})}),Qe&&"radial"===D&&e("div",{style:{position:"absolute",left:pt.left+yt/2,top:pt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe}),(null==ot?void 0:ot.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ot.badgePosition?{top:4,left:4}:"bottom-left"===ot.badgePosition?{bottom:4,left:4}:"bottom-right"===ot.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Vt?"#dc3545":"#28a745",color:"white"}),children:Vt?"STALE":"LIVE"}),e(Fn,{active:xo.current>=0,hoverPoint:zt,margin:pt,size:ft,shape:null===(b=ko.current)||void 0===b?void 0:b.shape,width:null===(x=ko.current)||void 0===x?void 0:x.w,height:null===(k=ko.current)||void 0===k?void 0:k.h}),jo]})]})});function pa({ref:e,frameRef:t,setup:o}){return p(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}fa.displayName="StreamOrdinalFrame";const ya=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:v=40,roundedTop:m,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:I,strokeWidth:N,opacity:H,showCategoryTicks:R,categoryFormat:W,dataIdAccessor:F}=t,{width:z,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=r(()=>fe(a),[a]),J=Jr({data:Z,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,chartType:"BarChart",chartId:P,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:L,width:z,height:E}),{effectiveLegendProps:ee,effectiveMargin:te}=pa({ref:o,frameRef:s,setup:J});if(J.earlyReturn)return J.earlyReturn;Yr("BarChart",Z,"categoryAccessor",u),Yr("BarChart",Z,"valueAccessor",d);const oe=gr(Z,y,d),ne=ur(),ie=r(()=>new Map,[Z]),re=r(()=>(e,t)=>{const o={};return o.fill=f?vt(e,f,J.colorScale):dr(D,ne,p,void 0,ie),o},[f,J.colorScale,D,ne,p,ie]),se=r(()=>{const e=null==A?void 0:A.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},re(t,o)),e(t,o)||{}):re,{stroke:I,strokeWidth:N,opacity:H})},[re,A,I,N,H]),ae=r(()=>Qi(se,J.effectiveSelectionHook,J.resolvedSelection),[se,J.effectiveSelectionHook,J.resolvedSelection]),le=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[u,d,f,g]),ce=Ur({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ce)return e(Ir,{componentName:"BarChart",message:ce,width:z,height:E});const 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({chartType:"bar"},null!=a&&{data:oe}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ae,size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),F&&{dataIdAccessor:F}),{baselinePadding:x,enableHover:$,showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:g}),W&&{oFormat:W}),{showGrid:Y,showCategoryTicks:R,oSort:y}),ee),ss({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:le})),as({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"BarChart",width:z,height:E,children:e(fa,Object.assign({ref:s},ue))})});ya.displayName="BarChart";const va=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:I,stroke:N,strokeWidth:H,opacity:R,categoryFormat:W}=t,{width:F,height:z,enableHover:E,showGrid:$,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=n,Q=r(()=>fe(a),[a]),Z=p||d,J=Jr({data:Q,rawData:a,colorBy:Z,colorScheme:y,legendInteraction:B,legendPosition:D,selection:O,linkedHover:C,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:M,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:F,height:z});if(J.earlyReturn)return J.earlyReturn;const ee=ur(),te=r(()=>new Map,[Q]),oe=r(()=>(e,t)=>Z?J.colorScale?{fill:vt(e,Z,J.colorScale)}:{}:{fill:dr(I,ee,y,t,te)},[Z,J.colorScale,I,ee,y,te]),ne=r(()=>{const e=null==S?void 0:S.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>{const n=oe(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:oe,{stroke:N,strokeWidth:H,opacity:R})},[oe,S,N,H,R]),ie=r(()=>Qi(ne,J.effectiveSelectionHook,J.resolvedSelection),[ne,J.effectiveSelectionHook,J.resolvedSelection]),re=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),se=Ur({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:ae,effectiveMargin:le}=pa({ref:o,frameRef:s,setup:J}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:E}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:f}),W&&{oFormat:W}),{showGrid:$}),ae),ss({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate})),ls({tooltip:w,defaultTooltipContent:re})),as({linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e(Ir,{componentName:"StackedBarChart",message:se,width:F,height:z}):e(Wr,{componentName:"StackedBarChart",width:F,height:z,children:e(fa,Object.assign({ref:s},ce))})});va.displayName="StackedBarChart";const ma=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:I,strokeWidth:N,opacity:H,categoryFormat:R}=t,{width:W,height:F,enableHover:z,showGrid:E,showLegend:$,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=n,K=r(()=>fe(a),[a]),Q=p||d,Z=Jr({data:K,rawData:a,colorBy:Q,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:$,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:L,width:W,height:F});if(Z.earlyReturn)return Z.earlyReturn;const J=ur(),ee=r(()=>new Map,[K]),te=A.pieceStyle,oe=r(()=>(e,t)=>{const o=Q?Z.colorScale?{fill:vt(e,Q,Z.colorScale)}:{}:{fill:dr(D,J,y,t,ee)};if(te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Q,Z.colorScale,D,J,y,ee,te]),ne=r(()=>kr(oe,{stroke:I,strokeWidth:N,opacity:H}),[oe,I,N,H]),ie=r(()=>Qi(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),se=Ur({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ae,effectiveMargin:le}=pa({ref:o,frameRef:s,setup:Z}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:V,rLabel:U,rFormat:f}),R&&{oFormat:R}),{showGrid:E}),ae),ss({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:re})),as({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return se?e(Ir,{componentName:"GroupedBarChart",message:se,width:W,height:F}):e(Wr,{componentName:"GroupedBarChart",width:W,height:F,children:e(fa,Object.assign({ref:s},ce))})});function ba({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=Ki("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=Hi({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof n?n:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const c=l(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||o||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}ma.displayName="GroupedBarChart";const xa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:v=[3,8],pointRadius:m=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,brush:A,onBrush:S,linkedBrush:O,frameProps:C={},selection:j,linkedHover:_,onObservation:P,onClick:M,hoverHighlight:L,chartId:T,loading:B,emptyContent:D,legendInteraction:I,legendPosition:N,color:H,stroke:R,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:E}=t,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=r(()=>fe(a),[a]),te=Jr({data:ee,rawData:a,colorBy:f,colorScheme:p,legendInteraction:I,legendPosition:N,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:M,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:B,emptyContent:D,width:$,height:Y}),oe=ba({brushProp:A,onBrushProp:S,linkedBrush:O,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const ne=r(()=>{if(!y)return;const e=ee.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ee,y]),ie=ur(),re=r(()=>new Map,[ee]),se=C.pieceStyle,ae=r(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=f?vt(e,f,te.colorScale):dr(H,ie,p,void 0,re),o.r=y?bt(e,y,v,ne):m,se){const n=se(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,te.colorScale,y,v,ne,m,b,H,ie,p,re,se]),le=r(()=>kr(ae,{stroke:R,strokeWidth:W,opacity:F}),[ae,R,W,F]),ce=r(()=>Qi(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),ue=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f||void 0,valueFormat:g}),[u,d,f,g]),de=Ur({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(de)return e(Ir,{componentName:"SwarmPlot",message:de,width:$,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({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[$,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:x,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:g}),E&&{oFormat:E}),{showGrid:q,showCategoryTicks:z}),te.legendBehaviorProps),ss({title:V,description:U,summary:K,accessibleTable:Q,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:ue})),as({linkedHover:_,onObservation:P,onClick:M,hoverHighlight:L,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),w&&w.length>0&&{annotations:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"SwarmPlot",width:$,height:Y,children:e(fa,Object.assign({ref:s},he))})});function ka(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return t("div",{className:"semiotic-tooltip",style:wr,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return t("div",{className:"semiotic-tooltip",style:wr,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:wr,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}xa.displayName="SwarmPlot";const wa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:v=20,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,emptyContent:_,legendInteraction:P,legendPosition:M,color:L,stroke:T,strokeWidth:B,opacity:D,showCategoryTicks:I,categoryFormat:N}=t,{width:H,height:R,enableHover:W,showGrid:F,showLegend:z,title:E,description:$,summary:Y,accessibleTable:G,categoryLabel:q,valueLabel:X}=n,V=r(()=>fe(a),[a]),U=Jr({data:V,rawData:a,colorBy:f,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:l,marginDefaults:n.marginDefaults,loading:j,emptyContent:_,width:H,height:R});if(U.earlyReturn)return U.earlyReturn;const K=ur(),Q=r(()=>new Map,[V]),Z=r(()=>e=>{const t=f?vt(e,f,U.colorScale):dr(L,K,p,void 0,Q);return{fill:t,stroke:t,fillOpacity:.8}},[f,U.colorScale,L,K,p,Q]),J=r(()=>kr(Z,{stroke:T,strokeWidth:B,opacity:D}),[Z,T,B,D]),ee=r(()=>Qi(J,U.effectiveSelectionHook,U.resolvedSelection),[J,U.effectiveSelectionHook,U.resolvedSelection]),te=r(()=>ka(),[]),oe=Ur({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return e(Ir,{componentName:"BoxPlot",message:oe,width:H,height:R});const ne=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:"boxplot"},null!=a&&{data:V}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:q,rLabel:X,rFormat:g}),N&&{oFormat:N}),{showGrid:F,showCategoryTicks:I}),U.legendBehaviorProps),ss({title:E,description:$,summary:Y,accessibleTable:G,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:te})),as({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"BoxPlot",width:H,height:R,children:e(fa,Object.assign({ref:s},ne))})});wa.displayName="BoxPlot";const Aa=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=i(null);es(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:I,stroke:N,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:F}=o,{width:z,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=s,Z=r(()=>fe(l),[l]),J=Jr({data:Z,rawData:l,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:D,selection:O,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,chartType:"Histogram",chartId:M,showLegend:G,userMargin:c,marginDefaults:s.marginDefaults,loading:L,emptyContent:T,width:z,height:E}),ee=ba({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of Z){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[Z,h]),oe=ur(),ne=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=y?vt(e,y,J.colorScale):dr(I,oe,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.8}},[y,J.colorScale,I,oe,v,ne]),re=r(()=>kr(ie,{stroke:N,strokeWidth:H,opacity:R}),[ie,N,H,R]),se=r(()=>Qi(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return t("div",{className:"semiotic-tooltip",style:wr,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Ur({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e(Ir,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:g,normalize:f}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:m,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Q,rFormat:p}),F&&{oFormat:F}),{showGrid:Y,showCategoryTicks:W}),J.legendBehaviorProps),ss({title:q,description:X,summary:V,accessibleTable:U,className:u,animate:o.animate})),ls({tooltip:b,defaultTooltipContent:ae})),as({linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),x&&x.length>0&&{annotations:x}),ee.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"Histogram",width:z,height:E,children:e(fa,Object.assign({ref:a},ce))})});Aa.displayName="Histogram";const Sa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:I,stroke:N,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:F}=t,{width:z,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=r(()=>fe(a),[a]),J=Jr({data:Z,rawData:a,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:D,selection:O,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:M,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:E}),ee=ba({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=ur(),oe=r(()=>new Map,[Z]),ne=r(()=>e=>{const t=y?vt(e,y,J.colorScale):dr(I,te,v,void 0,oe);return{fill:t,stroke:t,fillOpacity:.6}},[y,J.colorScale,I,te,v,oe]),ie=r(()=>kr(ne,{stroke:N,strokeWidth:H,opacity:R}),[ne,N,H,R]),re=r(()=>Qi(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>ka({valueAccessor:d}),[d]),ae=Ur({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return e(Ir,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:m,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:p}),F&&{oFormat:F}),{showGrid:Y,showCategoryTicks:W}),J.legendBehaviorProps),ss({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate})),ls({tooltip:b,defaultTooltipContent:se})),as({linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),x&&x.length>0&&{annotations:x}),ee.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"ViolinPlot",width:z,height:E,children:e(fa,Object.assign({ref:s},le))})});Sa.displayName="ViolinPlot";const Oa=g(function(t,o){var n;const s=br(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);es(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:v="auto",dotRadius:m=5,categoryPadding:b=10,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,chartId:_,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,stroke:D,strokeWidth:I,opacity:N,categoryFormat:H}=t,{width:R,height:W,enableHover:F,showGrid:z,showLegend:E,title:$,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=s,U=r(()=>fe(l),[l]),K=Jr({data:U,rawData:l,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:C,hoverHighlight:j,chartType:"DotPlot",chartId:_,showLegend:E,userMargin:c,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:R,height:W});if(K.earlyReturn)return K.earlyReturn;const Q=gr(U,v,h),Z=ur(),J=r(()=>new Map,[U]),ee=w.pieceStyle,te=r(()=>(e,t)=>{const o={r:m,fillOpacity:.8};if(o.fill=p?vt(e,p,K.colorScale):dr(B,Z,y,void 0,J),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,K.colorScale,m,B,Z,y,J,ee]),oe=r(()=>kr(te,{stroke:D,strokeWidth:I,opacity:N}),[te,D,I,N]),ne=r(()=>Qi(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=r(()=>Dr({categoryAccessor:d,valueAccessor:h,valueFormat:f}),[d,h,f]),re=Ur({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e(Ir,{componentName:"DotPlot",message:re,width:R,height:W});const se=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:"point"},null!=l&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:X,rLabel:V,rFormat:f}),H&&{oFormat:H}),{showGrid:z,oSort:v}),K.legendBehaviorProps),ss({title:$,description:Y,summary:G,accessibleTable:q,className:u,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:ie})),as({linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"DotPlot",width:R,height:W,children:e(fa,Object.assign({ref:a},se))})});Oa.displayName="DotPlot";const Ca=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=5,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:_,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:B,strokeWidth:D,opacity:I,showCategoryTicks:N,categoryFormat:H}=t,{width:R,height:W,enableHover:F,showGrid:z,showLegend:E,title:$,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=n,U=r(()=>fe(a),[a]),K=Jr({data:U,rawData:a,colorBy:y,colorScheme:v,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"RidgelinePlot",chartId:j,showLegend:E,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:P,width:R,height:W});if(K.earlyReturn)return K.earlyReturn;const Q=ur(),Z=r(()=>new Map,[U]),J=r(()=>e=>{const t=y?vt(e,y,K.colorScale):dr(T,Q,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[y,K.colorScale,T,Q,v,Z]),ee=r(()=>kr(J,{stroke:B,strokeWidth:D,opacity:I}),[J,B,D,I]),te=r(()=>Qi(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),oe=r(()=>ka(),[]),ne=Ur({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(Ir,{componentName:"RidgelinePlot",message:ne,width:R,height:W});const 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({chartType:"ridgeline"},null!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:X,rLabel:V,rFormat:p}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:N,oSort:!1,amplitude:f}),K.legendBehaviorProps),ss({title:$,description:Y,summary:G,accessibleTable:q,className:c,animate:t.animate})),ls({tooltip:b,defaultTooltipContent:oe})),as({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"RidgelinePlot",width:R,height:W,children:e(fa,Object.assign({ref:s},ie))})});Ca.displayName="RidgelinePlot";const ja=g(function(t,o){var n,s;const a=br(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,emptyContent:_,legendInteraction:P,legendPosition:M,color:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,showLegend:R,title:W,description:F,summary:z,accessibleTable:E}=a,$=r(()=>fe(c),[c]),Y=f||h,G=Jr({data:$,rawData:c,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:C,showLegend:R,userMargin:u,marginDefaults:a.marginDefaults,loading:j,emptyContent:_,width:I,height:N});if(G.earlyReturn)return G.earlyReturn;const q=ur(),X=r(()=>new Map,[$]),V=r(()=>(e,t)=>Y?G.colorScale?{fill:vt(e,Y,G.colorScale)}:{}:{fill:dr(L,q,p,t,X)},[Y,G.colorScale,L,q,p,X]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},V(t,o)),e(t,o)||{}):V,{stroke:T,strokeWidth:B,opacity:D})},[V,x,T,B,D]),K=r(()=>Qi(U,G.effectiveSelectionHook,G.resolvedSelection),[U,G.effectiveSelectionHook,G.resolvedSelection]),Q=r(()=>Dr({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Z=Ur({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=pa({ref:o,frameRef:l,setup:G}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:$}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),ss({title:W,description:F,summary:z,accessibleTable:E,className:d,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:Q})),as({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(Ir,{componentName:"PieChart",message:Z,width:I,height:N}):e(Wr,{componentName:"PieChart",width:I,height:N,children:e(fa,Object.assign({ref:l},te))})});ja.displayName="PieChart";const _a=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,emptyContent:_,legendInteraction:P,legendPosition:M,color:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,showLegend:R,title:W,description:F,summary:z,accessibleTable:E}=n,$=r(()=>fe(a),[a]),Y=f||u,G=Jr({data:$,rawData:a,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:C,showLegend:R,userMargin:l,marginDefaults:n.marginDefaults,loading:j,emptyContent:_,width:I,height:N});if(G.earlyReturn)return G.earlyReturn;const q=null!=h?h:Math.max(2,.15*Math.min(I,N)),X=ur(),V=r(()=>new Map,[$]),U=x.pieceStyle,K=r(()=>(e,t)=>{let o;if(o=Y?G.colorScale?{fill:vt(e,Y,G.colorScale)}:{}:{fill:dr(L,X,p,t,V)},U){const n=U(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Y,G.colorScale,L,X,p,V,U]),Q=r(()=>kr(K,{stroke:T,strokeWidth:B,opacity:D}),[K,T,B,D]),Z=r(()=>Qi(Q,G.effectiveSelectionHook,G.resolvedSelection),[Q,G.effectiveSelectionHook,G.resolvedSelection]),J=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),ee=Ur({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:te,effectiveMargin:oe}=pa({ref:o,frameRef:s,setup:G}),ne=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:"donut"},null!=a&&{data:$}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:Z,innerRadius:q,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),te),ss({title:W,description:F,summary:z,accessibleTable:E,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:J})),as({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return ee?e(Ir,{componentName:"DonutChart",message:ee,width:I,height:N}):e(Wr,{componentName:"DonutChart",width:I,height:N,children:e(fa,Object.assign({ref:s},ne))})});_a.displayName="DonutChart";const Pa=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=i(null),l="context"===o.mode,{compactMode:c}=s,{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!c,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:C={},className:j,stroke:_,strokeWidth:P,opacity:M}=o,{width:L,height:T,title:B,description:D,summary:I,accessibleTable:N}=s,H=Math.max(d,Math.min(h,u)),R=h-d||1,W=(H-d)/R,{gaugeData:F,pieceStyle:z,gaugeAnnotations:E}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=d;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/R;if(A){const n=(i-d)/R,a=Math.max(0,Math.min(W,(r.value-d)/R)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[u,d,h,g,f,p,W,R,k,A]),$=r(()=>kr(z,{stroke:_,strokeWidth:P,opacity:M}),[z,_,P,M]),Y=w*Math.PI/180,G=180+(360-w)/2,q=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,V=[[Math.cos(X),Math.sin(X)],[Math.cos(X+Y),Math.sin(X+Y)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>Y+.001||V.push([Math.cos(e),Math.sin(e)]);const U=Math.min(...V.map(e=>e[0])),K=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),Z=Math.max(...V.map(e=>e[1])),J=(Q+Z)/2,ee=(U+K)/2,te=Math.max(4,Math.min((L-2*q)/(K-U),(T-2*q)/(Z-Q))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(H,d,h):b;const o=x?x(H):Math.round(H)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),k&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,H,d,h,x,k,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(H):Math.round(H)+""}:null,[l,b,H,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+G*Math.PI/180+W*Y,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,W,G,Y,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const t=-Math.PI/2+G*Math.PI/180+(o.value-d)/R*Y,r=oe-14,s=(i.height||T)/2;return e("text",{x:(i.width||L)/2+Math.cos(t)*r,y:s+Math.sin(t)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?e("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,d,R,G,Y,oe,te]),ue=r(()=>{const e=[...E,...O||[]];return le&&e.push(le),ae&&e.push(ae),e},[E,O,le,ae]),de=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===F.length)return e(Ir,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:F,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:oe,startAngle:G,sweepAngle:w,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:_r(S)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),D&&{description:D}),I&&{summary:I}),void 0!==N&&{accessibleTable:N}),j&&{className:j}),null!=o.animate&&{animate:o.animate}),C);return e(Wr,{componentName:"GaugeChart",width:L,height:T,children:e(fa,Object.assign({ref:a},he))})});Pa.displayName="GaugeChart";const Ma=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=i(null);es(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:v=.3,showLabels:m=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:_,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:B,strokeWidth:D,opacity:I,categoryFormat:N}=o,H="vertical"===y,{width:R,height:W,enableHover:F,showLegend:z,title:E,description:$,summary:Y,accessibleTable:G}=s,q=H?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},X=r(()=>fe(l),[l]),V=f||g,U=!V,K=Jr({data:X,rawData:l,colorBy:V,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"FunnelChart",chartId:j,showLegend:z,userMargin:c,marginDefaults:q,loading:_,emptyContent:P,width:R,height:W});if(K.earlyReturn)return K.earlyReturn;Yr("FunnelChart",X,"stepAccessor",d),Yr("FunnelChart",X,"valueAccessor",h);const Q=ur(),Z=r(()=>new Map,[X]),J=r(()=>{if(U)return T||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[U,T,Q,p]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const o={};if(o.fill=J||(V?vt(e,V,K.colorScale):dr(T,Q,p,t,Z)),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,V,K.colorScale,T,Q,p,Z,ee]),oe=r(()=>kr(te,{stroke:B,strokeWidth:D,opacity:I}),[te,B,D,I]),ne=r(()=>Qi(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:wr,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]),re=Ur({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(re)return e(Ir,{componentName:"FunnelChart",message:re,width:R,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:H?"bar-funnel":"funnel"},null!=l&&{data:X}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ne,size:[R,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),N&&{oFormat:N}),{showGrid:H}),!H&&{connectorOpacity:v}),{showLabels:m}),K.legendBehaviorProps),E&&{title:E}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ie:_r(b)||ie}),(A||S||O||C)&&{customHoverBehavior:K.customHoverBehavior}),(S||O||A)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"FunnelChart",width:R,height:W,children:e(fa,Object.assign({ref:a},se))})});Ma.displayName="FunnelChart";const La={RdBu:rt,PiYG:st,PRGn:at,BrBG:lt,RdYlBu:ct,RdYlGn:ut,Spectral:dt},Ta="__likert_neutral_neg",Ba="__likert_neutral_pos";function Da(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Ia(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Na(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Ta,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Ba,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Ha(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Ta?r=o:o.__likertLevel===Ba?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const Ra=g(function(t,o){const s=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:c,margin:u,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:M,valueFormat:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:I,categoryFormat:N,stroke:H,strokeWidth:R,opacity:W}=t,{width:F,height:z,enableHover:E,showGrid:$,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=s,Q="horizontal"===b,Z=void 0===c,J=!y,ee=function(){var e;const t=sr();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),te=r(()=>x&&Array.isArray(x)&&x.length>=m.length?x:function(e,t){if(0>=e)return[];if(t){const o=La[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(m.length,ee),[x,m.length,ee]),oe=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],te[t]||"#888");return e},[m,te]),{processedData:ne,reAggregate:ie,accumulatorRef:re}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:s,countAccessor:a,isDiverging:c,frameRef:u}){const d=!s,h=r(()=>Da(o,"question"),[o]),g=r(()=>d?Da(n,"score"):null,[d,n]),f=r(()=>d?null:Da(s,"level"),[d,s]),p=r(()=>d?null:Da(a,"count"),[d,a]),y=e||[],v=i([]),m=r(()=>{if(0===y.length)return[];let e=Ia(y,t,h,g,f,p);return c&&(e=Na(e,t),e=Ha(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var o;let n=Ia(e,t,h,g,f,p);c&&(n=Na(n,t),n=Ha(n,t)),null===(o=u.current)||void 0===o||o.replace(n)},[t,h,g,f,p,c,u]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:v,isDiverging:Q,frameRef:a}),se="__likertLevelLabel",ae=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:s="right"}){const a=i(new Set),c=i([]),[u,h]=d(0),g=Ci(),f=ur(),p=l(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=l(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||a.current.has(t)||(a.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=l(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(a.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{a.current=new Set,c.current=[],h(e=>e+1)},[]);Gi(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:ft,s=t,a=i.map(e=>({[s]:e})),l=mt(a,s,r);return Ui({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:vt})},[e,t,n,o,g,f,u]),w=r(()=>{if(k)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[k,s]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:Z,colorBy:se,colorScheme:te,showLegend:Y,legendPosition:I}),le=l(ae.wrapPush(e=>{re.current.push(e),ie(re.current)}),[ae.wrapPush,ie,re]),ce=l(ae.wrapPushMany(e=>{re.current.push(...e),ie(re.current)}),[ae.wrapPushMany,ie,re]);p(o,()=>({push:le,pushMany:ce,remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;re.current=[],ae.resetCategories(),null===(e=a.current)||void 0===e||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}}),[le,ce,ae.resetCategories,re]);const ue=Jr({data:ne,rawData:c,colorBy:se,colorScheme:te,legendInteraction:D,legendPosition:I,selection:O,linkedHover:C,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,chartType:"LikertChart",chartId:M,showLegend:Y,userMargin:u,marginDefaults:s.marginDefaults,loading:T,emptyContent:B,width:F,height:z});if(ue.earlyReturn)return ue.earlyReturn;const de=r(()=>{const e=m.length;return e%2!=0&&oe.get(m[Math.floor(e/2)])||"#888"},[m,oe]),he=S.pieceStyle,ge=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Ta||r===Ba)s={fill:de};else{const e=i||r;s=e&&oe.has(e)?{fill:oe.get(e)}:{fill:"#888"}}if(he){const o=he(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[oe,de,he]),fe=r(()=>kr(ge,{stroke:H,strokeWidth:R,opacity:W}),[ge,H,R,W]),pe=r(()=>Qi(fe,ue.effectiveSelectionHook,ue.resolvedSelection),[fe,ue.effectiveSelectionHook,ue.resolvedSelection]),ye=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),ve=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Ta||o===Ba?ye:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Ta||o===Ba?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:wr},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ye]),me=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!v)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return J?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),Ur({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,f,y,v,m,J]),be=r(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,oe]),xe=r(()=>!1!==Y?Object.assign(Object.assign({},ue.legendBehaviorProps),{legend:{legendGroups:be},legendPosition:I||ue.legendPosition||"bottom"}):ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,I,Y,be]),ke=r(()=>{const e=Object.assign({},ue.margin);if(Z&&!1!==Y){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ae.streamingMarginAdjust)for(const[t,o]of Object.entries(ae.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Q&&100>e.left&&(e.left=100),e},[ue.margin,ae.streamingMarginAdjust,Q,Z,Y,I]),we=r(()=>L||(Q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Q,L]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Q?"horizontal":"vertical",pieceStyle:pe,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ke,barPadding:k,enableHover:E}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:U,rLabel:K||(Q?void 0:"Percentage"),rFormat:we}),N&&{oFormat:N}),{showGrid:$}),xe),G&&{title:G}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:!0===w?ve:_r(w)||ve}),(C||j||_||P)&&{customHoverBehavior:ue.customHoverBehavior}),(j||_||C)&&{customClickBehavior:ue.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return me?e(Ir,{componentName:"LikertChart",message:me,width:F,height:z}):e(Wr,{componentName:"LikertChart",width:F,height:z,children:e(fa,Object.assign({ref:a},Ae))})});Ra.displayName="LikertChart";const Wa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:I,strokeWidth:N,opacity:H,categoryFormat:R,rTickValues:W,tickLabelEdgeAlign:F,showCategoryTicks:z,gradientFill:E,trackFill:$}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=n,te=r(()=>fe(a),[a]),oe=p||d,ne=r(()=>{if(null!=v)return v;if("sparkline"!==t.mode)return 40;const e=new Set(te.map(e=>"function"==typeof u?u(e):e[u])),o=Math.max(1,e.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?G:Y)-2*o)/(o-1))):1},[v,t.mode,te,u,g,Y,G]),ie=Jr({data:te,rawData:a,colorBy:oe,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,chartType:"SwimlaneChart",chartId:P,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:L,width:Y,height:G}),re=ba({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(ie.earlyReturn)return ie.earlyReturn;const se=ur(),ae=r(()=>new Map,[te]),le=A.pieceStyle,ce=r(()=>(e,t)=>{const o=oe?ie.colorScale?{fill:vt(e,oe,ie.colorScale)}:{}:{fill:dr(D,se,y,t,ae)};if(le){const n=le(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[oe,ie.colorScale,D,se,y,ae,le]),ue=r(()=>kr(ce,{stroke:I,strokeWidth:N,opacity:H}),[ce,I,N,H]),de=r(()=>Qi(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ge=Ur({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:pe,effectiveMargin:ye}=pa({ref:o,frameRef:s,setup:ie}),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:te}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ye,barPadding:ne,enableHover:q}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===z?void 0:J,rLabel:ee,rFormat:f}),W&&{rTickValues:W}),null!=F&&{tickLabelEdgeAlign:F}),R&&{oFormat:R}),void 0!==z&&{showCategoryTicks:z}),{showGrid:X}),pe),ss({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:he})),as({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:_,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),b&&b.length>0&&{annotations:b}),E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E}),null!=$&&{trackFill:$}),re.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e(Ir,{componentName:"SwimlaneChart",message:ge,width:Y,height:G}):e(Wr,{componentName:"SwimlaneChart",width:Y,height:G,children:e(fa,Object.assign({ref:s},ve))})});Wa.displayName="SwimlaneChart";const Fa={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},za={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Ea{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?$a(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function $a(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,u,d,h]=e[a];Ya(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;Ya(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Ya(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Ga(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function qa(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],v=[],m=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),v.push(a[b]),m+=a[b].length,s[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(m);for(f=0;v.length>f;f++)for(var k=0;v[f].length>k;k++)x[--m]=v[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=d(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function Xa(e){return e.y0-e.y1>0?"up":"down"}function Va(e,t){return t(e.source)==t(e.target)}function Ua(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function Ka(e){return e.target.x0-e.source.x1}function Qa(e,t){var o=Ja(e),n=Ka(t)/Math.tan(o);return"up"==Xa(e)?e.y1-n:e.y1+n}function Za(e,t){var o=Ja(e),n=Ka(t)/Math.tan(o);return"up"==Xa(e)?e.y1+n:e.y1-n}function Ja(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function el(e,t){return t(e)}function tl(e){return nl(e.source)}function ol(e){return nl(e.target)}function nl(e){return(e.y0+e.y1)/2}function il(e){return e.virtual?0:e.value}function rl(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Va(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Va(e,t)?n+1:n}),o+n}function sl(e){return e.target.depth}function al(e,t){return e.sourceLinks.length?e.depth:t-1}function ll(e,t){return e.y0-t.y0}function cl(e,t){return t.y0-e.y0}function ul(e,t){return e.y1-t.y1}function dl(e,t){return t.y1-e.y1}function hl(e,t){return fl(e.source,t.source)||e.index-t.index}function gl(e,t){return fl(e.target,t.target)||e.index-t.index}function fl(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function pl(e,t){return yl(e)==yl(t)?"bottom"==e.circularLinkType?cl(e,t):ll(e,t):yl(t)-yl(e)}function yl(e){return e.target.column-e.source.column}function vl(e,t){return ml(e)==ml(t)}function ml(e){return e.y0-e.y1>0?"up":"down"}function bl(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=$(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),xl(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),xl(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Va(e,t)&&Ua(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?cl:ll);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?dl:ul),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function xl(e,t,o){e.sort(pl);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Va(e,t)&&Ua(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&kl(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function kl(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function wl(e){return function(){return e}}function Al(e){return e.index}function Sl(e){return e.nodes}function Ol(e){return e.links}function Cl(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=nl(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=nl(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?rl(t,o)-rl(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==rl(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function jl(e,t,o,n,i,r){var s=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=r;l>0;--l)c(a*=.99,o),u();function c(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&rl(i,o)>0){var l=X(i.sourceLinks,ol),c=X(i.targetLinks,tl),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-nl(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=X(i.sourceLinks,ol),g=X(i.targetLinks,tl),f=((h&&g?(h+g)/2:h||g)-nl(i))*t;i.y0+=f,i.y1+=f}})})}function u(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||fl),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function _l(e){e.nodes.forEach(function(e){e.sourceLinks.sort(gl),e.targetLinks.sort(hl)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Pl(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,a=Al,l=al,c=void 0,u=32,d=2,h=Sl,g=Ol;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return V(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=Ga(o,n)),"object"!=typeof i&&(i=e.target=Ga(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=qa(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){el(e,t)!=el(i.source,t)&&el(e,t)!=el(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Va(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,il),q(e.targetLinks,il)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=$(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,g,i),Cl(h,c,a),jl(h,c,a,g,g,u),_l(h),bl(h,a,d,10,8),Cl(h,c,a),jl(h,c,a,g,g,u),_l(h),bl(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return el(o.source,t)==el(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!vl(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=Qa(t,e);return e.y1-o}if(t.target.column>e.target.column)return Qa(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return el(o.target,t)==el(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!vl(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Za(t,e);return e.y0-o}if(t.source.column>e.source.column)return Za(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=$(t,function(e){return e.y0}),s=G(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),o.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),bl(h,a,d,10,8)}(f),f}return f.update=function(e){return _l(e),bl(e,a,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:wl(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:wl(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:wl(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:wl(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],f):[[e,t],[o,n]]},f.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],f):[o-e,n-t]},f}const Ml=e=>{let t,o,n,i,r,s,a,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=ie(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`):(t=e.source.x1,o=e.target.x0,a=ie(t,o),n=a(.5),i=a(.5),r=e.y0-e.sankeyWidth/2,s=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${r}C${n},${r} ${i},${s} ${o},${s}L${o},${l}C${i},${l} ${n},${c} ${t},${c}Z`)};function Ll(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const Tl=new Set,Bl=new WeakMap;function Dl(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Bl.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Bl.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;Tl.has(e)||(Tl.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const Il={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(sl))-1:0},justify:al};function Nl(e){return"string"==typeof e?e:e.id}const Hl={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),v=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Pl().extent(m).links(v).nodes(y).nodeAlign(Il[h]||al).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of v)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of v){const t=Nl(e.source),o=Nl(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=d;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const u="vertical"===o.orientation?"down":"right",d=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(Dl(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(Dl(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=u.fill||i;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?Ll(e):Ml(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===u?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},Rl={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?u++:o?(t.x=o.x,t.y=o.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of d){const n=Wl(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=Fl(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=Fl(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const g=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===o.iterations?0:h?40:g,p=zl(o.nodeSize,o.nodeSizeRange,e),y=e=>p(e);if(f>0){const o=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=se().force("charge",ae().strength(e=>-25*y(e))).force("center",le(a,l).strength(.8)).force("x",ce(a).strength(.15)).force("y",ue(l).strength(.15));if(n.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.force("link",o),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;f>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.edgeStyle,g=zl(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Dl(t,"nodeSize")),n=d?d(Dl(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(Dl(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=g(Dl(o,"nodeSize"));m.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:v,labels:m}}};function Wl(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function Fl(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function zl(e,t,o){var n,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(n=$(s))&&void 0!==n?n:0,l=null!==(i=G(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=k().domain([a,l]).range(r).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?r[0]:c(n)}}const El=qe,$l={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-r,c=n[0]/2,u=n[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=g.get("string"==typeof e.source?e.source:e.source.id),n=g.get(t);if(void 0===o||void 0===n)continue;const i=d(e);p[o][n]=i}const y=he().padAngle(i);s&&y.sortGroups(s);const v=y(p),m=v.groups,b=W().innerRadius(l).outerRadius(a);for(const t of m){const o=e[t.index],n=b.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of v){const o=e[t.source.index].id,n=e[t.target.index].id,i=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);i&&(i.__chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,u=Math.min(n[0],n[1])/2,d=u-l,h=n[0]/2,g=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,y=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:El,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=de().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=f?f(Dl(o,"nodeStyle")).fill||m.get(o.id)||v[t%v.length]:m.get(o.id)||v[t%v.length];const s=f?f(Dl(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=b(t);if(!n)continue;const i=Yl(n,h,g);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(Dl(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===y&&o?l=m.get(o.id)||l:t&&(l=m.get(t.id)||l)}const u=p?p(Dl(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+12;for(const o of e){const e=o.__arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*n,y:g+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Yl(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const Gl=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function ql(e){const[t,o,n]=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*o+.114*n>150?"#222":"#fff"}function Xl(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Vl(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}function Ul(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Gl}function Kl(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Ql(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const Zl={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),l=o.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,u=K(r,a);u.sum(c),u.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=oe();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([o,n]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(u,o,d,h);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([o,n]).padding(r)(e)}(u,o,d,h);break;case"partition":!function(e,t,o,n){var i;Q().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,o,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const n=g[t],r={id:Xl(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?Jl(r,n,o):"treemap"===s||"partition"===s?ec(r,n):"circlepack"===s&&tc(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,u,d,h,g;const f=[],p=[],y=[],v=o.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const r=i(Dl(t,"nodeStyle"));let l=r.fill||Kl(o);if(o.colorByDepth&&void 0!==t.depth){const e=Ul(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;m&&(i+=b,s+=x,a+=b,l+=x);const g=Ql(i,s,a,l,v),f=r(Dl(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=Vl(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(m&&(s+=b,a+=x),m){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===v?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],u=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(Dl(o,"nodeStyle"));let l=a.fill||Kl(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ul(t);l=e[o.depth%e.length]}const u={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Vl(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=n(Dl(c,"nodeStyle")).fill||Kl(t);if(t.colorByDepth&&void 0!==c.depth){const e=Ul(t);f=e[c.depth%e.length]}const p="string"==typeof f?ql(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(Dl(o,"nodeStyle"));let c=l.fill||Kl(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ul(t);c=e[o.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:o.x,cy:o.y,r:e,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Vl(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(Dl(i,"nodeStyle")).fill||Kl(t);if(t.colorByDepth&&void 0!==i.depth){const e=Ul(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?ql(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Jl(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function ec(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function tc(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function oc(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const nc={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),u=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,d=null!==(s=o.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=oc(o);f.metaMap.clear(),n.length=0,i.length=0;const p=new Map;function y(e){var t;const o=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,s,u,d,p){const v=a(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const A=(m+1)/b,S={id:o,depth:d,data:t,parentId:o},O=p?u/h(S)*A:u*A,C=F().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=C(k),_=g(S);for(let t=0;k.length>t;t++){const a=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*_;n.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:a,depth:d,parentId:o,eccentricity:_}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=oc(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Dl(t,"nodeSize")),n=d?d(Dl(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),o="object"==typeof e.target?e.target:v.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(Dl(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=oc(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},ic={sankey:Hl,force:Rl,chord:$l,tree:Zl,cluster:Zl,treemap:Zl,circlepack:Zl,partition:Zl,orbit:nc};function rc(e){return ic[e]}class sc{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Fa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Ea(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Fa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Ea(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},ac(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=Number(u(o))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},ac(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},ac(i)),{data:o}));const s=`${n}\0${i}\0${e}`;this.edges.set(s,{source:n,target:i,value:r,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:s})}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,ac(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,ac(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=rc(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,o,n,i,r,s;const a=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=Is(this.config.colorScheme,this.config.themeCategorical,qe),u={nodes:a,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:Ns(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let d;try{d=this.config.customNetworkLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(n=d.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=d.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=rc(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=rc(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=rc(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return o.tick(n,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),o=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,o),e.x1=St(e._prevX1,e._targetX1,o),e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const u=e-c;a>u&&(t._pulseIntensity=1-u/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=xt(o,a,n),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function ac(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function lc(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=cc(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(r=e,a=o)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){const t=fc(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function cc(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=Bt(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=Ht(Math.atan2(i,n)),a=Ht(e.startAngle),l=Ht(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}let uc=null,dc=null;function hc(){return dc||(uc=document.createElement("canvas"),uc.width=1,uc.height=1,dc=uc.getContext("2d")),dc}function gc(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function fc(e,t,o){switch(e.type){case"bezier":return function(e,t,o){var n,i;if(!e.pathD)return null;const r=gc(e),s=hc();if(!r||!s)return null;try{if(s.isPointInPath(r,t,o)){const r="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,s="object"==typeof(null===(i=e.datum)||void 0===i?void 0:i.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:r&&s?(r.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:o,distance:0}}const a=s.lineWidth;s.lineWidth=10;const l=s.isPointInStroke(r,t,o);if(s.lineWidth=a,l)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=gc(e),i=hc();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function pc(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=i;return t(o,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,o)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),x&&x.filter(e=>"widget"!==e.type).map((t,o)=>{if(k){const i=k(t,o,{width:r,height:s,sceneNodes:b});if(i)return e(n.Fragment,{children:i},"annotation-"+o)}return null}),m]}),d&&"string"==typeof d?e("text",{x:a/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:d}):d?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:d}):null,jo({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:v,title:d,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,o)=>{var n,i,r,s,a,l,u,d,h;const g=b.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(n=g.cx)&&void 0!==n?n:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,m=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-m/2,top:p+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function yc(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function vc(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=yc(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=qt(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function mc(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=qt(e,i)||i,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function bc(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=yc(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function xc(e,t){var o,n;if(!t.pathD)return;e.save();const i=yc(t),r=t.style.stroke||"#999";e.strokeStyle=qt(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}pc.displayName="NetworkSVGOverlay";const kc={top:20,right:80,bottom:20,left:80},wc={top:40,right:40,bottom:40,left:40},Ac=new Set(["chord","force","circlepack","orbit"]),Sc=[800,600],Oc={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 Cc({data:o}){var n,i,r,s,a,l;if("edge"===o.nodeOrEdge){const e=o.data;return e?t("div",{className:"semiotic-tooltip",style:Oc,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=o.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const o=[];let a=u;for(;a;){const e=null!==(s=null!==(i=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&o.unshift(e+""),a=a.parent}o.length>1&&o.shift();const l=o.length-1;return t("div",{className:"semiotic-tooltip",style:Oc,children:[e("div",{children:o.map((o,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===l?e("strong",{children:o}):e("span",{style:{opacity:.7},children:o})]},n))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Oc,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}const jc=g(function(o,n){var a,c,u,h,g,f,y,v,m,b,x,k,w,A,S,O,C,j;const{chartType:_,nodes:P,edges:M,data:L,initialEdges:T,nodeIDAccessor:B="id",sourceAccessor:D="source",targetAccessor:I="target",valueAccessor:N="value",edgeIdAccessor:H,childrenAccessor:R,hierarchySum:F,orientation:z="horizontal",nodeAlign:E="justify",nodePaddingRatio:$=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Q="vertical",edgeType:Z="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:oe=!1,particleStyle:ne,nodeStyle:ie,edgeStyle:re,colorBy:se,colorScheme:ae="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:ue=!1,nodeSize:de=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:pe=!0,labelMode:ye,size:ve=Sc,responsiveWidth:me,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:Ce,customClickBehavior:je,onObservation:_e,chartId:Pe,onTopologyChange:Me,annotations:Le,svgAnnotationRules:Te,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,title:We,foregroundGraphics:Fe,backgroundGraphics:ze,decay:Ee,pulse:$e,transition:Ye,animate:Ge,staleness:qe,thresholds:Xe,accessibleTable:Ve=!0,description:Ue,summary:Ke,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}=o,at=Ac.has(_)?wc:kc,lt=i(!0),ct=qn({sizeProp:ve,responsiveWidth:me,responsiveHeight:be,userMargin:xe,marginDefault:at,foregroundGraphics:Fe,backgroundGraphics:ze,animate:Ge,transitionProp:Ye,themeDirtyRef:lt}),{reducedMotionRef:ut,responsiveRef:dt,size:ht,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:vt,resolvedBackground:mt,transition:bt,introEnabled:xt,tableId:kt,rafRef:wt,renderFnRef:At,scheduleRender:St,currentTheme:Ot}=ct,Ct=un(),jt=fn(),_t=r(()=>fe(P),[P]),Pt=r(()=>Array.isArray(M)?fe(M):M,[M]),Mt=r(()=>Object.assign(Object.assign({},Fa),te),[te]),Lt=r(()=>Object.assign(Object.assign({},za),ne),[ne]),Bt=r(()=>{var e;return{chartType:_,nodeIDAccessor:B,sourceAccessor:D,targetAccessor:I,valueAccessor:N,edgeIdAccessor:H,childrenAccessor:R,hierarchySum:F,orientation:z,nodeAlign:E,nodePaddingRatio:$,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Mt,showParticles:oe,particleStyle:Lt,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:ae,themeCategorical:null===(e=null==Ot?void 0:Ot.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Ot),edgeColorBy:le,edgeOpacity:ce,colorByDepth:ue,nodeSize:de,nodeSizeRange:he,decay:Ee,pulse:$e,transition:bt,introAnimation:xt,staleness:qe,thresholds:Xe,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}},[_,B,D,I,N,R,F,z,E,$,Y,G,q,X,V,U,K,Q,Z,J,ee,Mt,oe,Lt,ie,re,ge,pe,ye,se,ae,le,ce,ue,de,he,Ee,$e,null==bt?void 0:bt.duration,null==bt?void 0:bt.easing,xt,qe,Xe,Qe,Ze,Je,et,tt,ot,nt,it,Ot,rt,st]),Dt=yn(Bt),It=i(null),Nt=i(0),Ht=i(0),Rt=i(!1),Wt=i(null);Wt.current||(Wt.current=new sc(Dt));const[Ft,zt]=d(null),[Et,$t]=d(0),[Yt,Gt]=d(0),[Xt,Vt]=d(!1),[Ut,Kt]=d(null),Qt=i(null),Zt=i(new Map),Jt=i(0),eo=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ae)?ae:gt;Zt.current.set(t+"",e[Jt.current++%e.length])}return Zt.current.get(t+"")}}if(Zt.current.has(e.id))return Zt.current.get(e.id);const t=Array.isArray(ae)?ae:gt,o=se?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[se,ae]),to=(null===(a=null==Ot?void 0:Ot.colors)||void 0===a?void 0:a.border)||(null===(c=null==Ot?void 0:Ot.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==Ot?void 0:Ot.colors)||void 0===u?void 0:u.primary)||"#999",oo=l(e=>{if("function"==typeof le)return le(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===le&&o?eo(o):t?eo(t):to},[le,eo,to]),no=l(e=>{if(!(null==ne?void 0:ne.colorBy))return oo(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===Lt.colorBy&&o?eo(o):t?eo(t):to},[null==ne?void 0:ne.colorBy,Lt.colorBy,eo,oo,to]),io="sankey"===_&&oe||!!$e||null!==(g=null===(h=Wt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;s(()=>{var e;null===(e=Wt.current)||void 0===e||e.updateConfig(Dt),lt.current=!0,St()},[Dt,St]);const ro=l(()=>{var e,t;Kt(null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);s(()=>{var e;const t=Wt.current;if(t){t.buildScene([pt,yt]),ro();for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);lt.current=!0,St()}},[Ot,pt,yt,St,ro]);const so=l(()=>{var e;const t=Wt.current;if(!t)return;t.runLayout([pt,yt]),t.buildScene([pt,yt]),ro(),lt.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);const o=Array.isArray(ae)?ae:gt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];Zt.current.has(t.id)||Zt.current.set(t.id,o[e%o.length])}if(Jt.current=n.length,$t(t.layoutVersion),Me){const{nodes:e,edges:o}=t.getLayoutData();Me(e,o)}},[pt,yt,Me,ae,ro]),ao=l(e=>{if(null==e||"object"!=typeof e)return;const t=Wt.current;t&&(t.ingestEdge(e)&&so(),St())},[so,St]),lo=l(e=>{const t=Wt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&so(),St()},[so,St]),co=l(()=>{var e;null===(e=Wt.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,$t(0),zt(null),Qt.current=null,lt.current=!0,St()},[St]),fo=l(()=>{const e=Wt.current;e&&(e.tension+=999,so(),St())},[so,St]);p(n,()=>({push:ao,pushMany:lo,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=Wt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=Qt.current)||void 0===n?void 0:n.data)?"function"==typeof B?B(Qt.current.data):Qt.current.data[B]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,zt(null)),Zt.current.delete(e),so(),lt.current=!0,St()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=Wt.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(Qt.current&&"edge"===Qt.current.nodeOrEdge){const o=Qt.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!H||!o||("function"==typeof H?H:e=>null==e?void 0:e[H])(o)===e,n&&(Qt.current=null,zt(null))}so(),lt.current=!0,St()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=Wt.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(lt.current=!0,St()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=Wt.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(so(),lt.current=!0,St()),r},clear:co,getTopology:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Wt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:fo,getTension:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[ao,lo,co,fo,so,St]);const yo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),mo=yo?L||(Array.isArray(M)?void 0:M):void 0;s(()=>{var e;const t=Wt.current;if(t)if(yo&&mo)t.ingestHierarchy(mo,[pt,yt]),t.buildScene([pt,yt]),ro(),lt.current=!0,St();else{const o=_t,n=Array.isArray(Pt)?Pt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[pt,yt]),t.buildScene([pt,yt]),ro();for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill+"");const i=Array.isArray(ae)?ae:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];Zt.current.has(t.id)||Zt.current.set(t.id,i[e%i.length])}Jt.current=r.length,lt.current=!0,St()}},[_t,Pt,L,mo,yo,pt,yt,Dt,St,ae,ro]),s(()=>{T&&T.length>0&&lo(T)},[]);const bo=l(e=>{if(Ce&&Ce(e),_e){const t=Date.now();_e(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[Ce,_e,Pe]),xo=l(e=>{if(je&&je(e),_e){const t=Date.now();_e(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[je,_e,Pe]),{hoverHandlerRef:ko,hoverLeaveRef:wo,onPointerMove:Ao,onPointerLeave:So}=ct;ko.current=e=>{if(!Se)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return void(Qt.current&&(Qt.current=null,zt(null),bo&&(bo(null),lt.current=!0),St()));const r=Wt.current;if(!r)return;const s=lc(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,zt(null),bo&&(bo(null),lt.current=!0),St()));const a=li(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,zt(a),bo&&(bo(a),lt.current=!0),St()},wo.current=()=>{Qt.current&&(Qt.current=null,zt(null),bo&&(bo(null),lt.current=!0),St())};const Oo=i(()=>{});Oo.current=e=>{if(!je&&!_e)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return;const r=Wt.current;if(!r)return;const s=lc(r.sceneNodes,r.sceneEdges,n,i);xo(s?li(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const Co=l(e=>Oo.current(e),[]),jo=i(-1),_o=i(null),Po=i(-1),Mo=l(e=>{var t;const o=Wt.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)"circle"===l.type&&null!=l.cx?a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"}):"rect"===l.type&&null!=l.x?a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"}):"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=uo(n),r=jo.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),jo.current=0,Po.current=-1;const t=i.flat[0];_o.current={shape:t.shape,w:t.w,h:t.h};const o=li(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,zt(o),bo&&(bo(o),lt.current=!0),void St()}const s=ho(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return go(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=po(t.source),s=po(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=go(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],Po);if(null===a)return;if(e.preventDefault(),0>a)return jo.current=-1,_o.current=null,Po.current=-1,Qt.current=null,zt(null),bo&&(bo(null),lt.current=!0),void St();jo.current=a;const l=i.flat[a];_o.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qt.current=c,zt(c),bo&&(bo(c),lt.current=!0),St()},[bo,St]),Lo=l(e=>{jo.current=-1,_o.current=null,Ao(e)},[Ao]);At.current=()=>{var e,t,o,n,i,r,s;wt.current=0;const a=It.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Wt.current;if(!c)return;const u=performance.now(),d=Nt.current?Math.min((u-Nt.current)/1e3,.1):.016;Nt.current=u;const h=c.advanceTransition(ut.current?u+1e6:u),g=!ut.current&&h,f=!ut.current&&c.tickAnimation([pt,yt],d);(h||lt.current||f)&&c.buildScene([pt,yt]);const p=Vn();if(!Xn(a,ht,ft,p))return;if(l.clearRect(-ft.left,-ft.top,ht[0],ht[1]),Ae){const e=qt(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,pt,yt))}Ee&&c.applyDecay(),$e&&c.applyPulse(u),Xe&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==qe?void 0:qe.threshold)&&void 0!==e?e:5e3,v=qe&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(v&&(l.globalAlpha=null!==(t=null==qe?void 0:qe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":vc(e,o);break;case"line":mc(e,o);break;case"ribbon":bc(e,o);break;case"curved":xc(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Jn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),ei(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!v){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:za.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:za.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,Lt);const t=.5*(null!==(o=Lt.speedMultiplier)&&void 0!==o?o:1);let n;if(Lt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:za.radius,l=null!==(s=n.opacity)&&void 0!==s?s:za.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(l){if("function"==typeof n.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?n.color(l,t):qt(e,"var(--semiotic-secondary, #666)")}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:i(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,Lt,no)}}v&&(l.globalAlpha=1);const m=lt.current;if(lt.current=!1,m||g||f){const e=It.current;e&&e.setAttribute("aria-label",On(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=m||g||f||Rt.current;b&&u-Ht.current>=33?(Gt(e=>e+1),Ht.current=u,Rt.current=!1):Rt.current=!!b,(io||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Rt.current)&&(wt.current=requestAnimationFrame(()=>At.current()))},pn({hydrated:Ct,wasHydratingFromSSR:jt,storeRef:Wt,dirtyRef:lt,renderFnRef:At}),s(()=>{lt.current=!0,St()},[_,pt,yt,Ae,St]),vo(qe,Wt,lt,St,Xt,Vt);const To=Se&&Ft?e(zn,{x:Ft.x,y:Ft.y,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(Ft):e(Cc,{data:Ft})}):null;if(ln||!Ct&&jt){const o=Wt.current;if(o){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),t=e?L||(Array.isArray(M)?void 0:M):void 0;if(e&&t)o.ingestHierarchy(t,[pt,yt]),o.buildScene([pt,yt]);else{const e=_t,t=Array.isArray(Pt)?Pt:[];(e.length>0||t.length>0)&&(o.ingestBounded(e,t,[pt,yt]),o.buildScene([pt,yt]))}}const n=null!==(f=null==o?void 0:o.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==o?void 0:o.sceneEdges)&&void 0!==y?y:[],r=null!==(v=null==o?void 0:o.labels)&&void 0!==v?v:[];return t("div",{ref:dt,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ue||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1]},children:[e(Nn,{summary:Ke}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ht[0],height:ht[1],style:{position:"absolute",left:0,top:0},children:[mt&&e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt}),t("g",{transform:`translate(${ft.left},${ft.top})`,children:[Ae&&e("rect",{x:0,y:0,width:pt,height:yt,fill:Ae}),i.map((t,o)=>function(t,o){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),n.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=W().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(sn)||"";return e("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),r.map((t,o)=>function(t,o){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e(pc,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:r,sceneNodes:n,title:We,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Tt(vt,null===(m=Wt.current)||void 0===m?void 0:m.customLayoutOverlays),annotations:Le,svgAnnotationRules:Te,annotationFrame:0})]})}const Bo=Wt.current;return t("div",{ref:dt,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ue||("string"==typeof We?We:"Network chart"),tabIndex:0,style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1],overflow:"visible"},onKeyDown:Mo,children:[Ve&&e(Hn,{tableId:kt}),Ve&&e(In,{nodes:null!==(b=null==Bo?void 0:Bo.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==Bo?void 0:Bo.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:kt,chartTitle:"string"==typeof We?We:void 0}),e(Nn,{summary:Ke}),t("div",{role:"img","aria-label":Ue||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?Lo:void 0,onMouseLeave:Se?So:void 0,onClick:je||_e?Co:void 0,children:[mt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ht[0],height:ht[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt})}),e("canvas",{ref:It,"aria-label":On(null!==(w=null===(k=null==Bo?void 0:Bo.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==Bo?void 0:Bo.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Rn,{hoverPoint:Ft}),e(pc,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:(null==Bo?void 0:Bo.labels)||[],sceneNodes:null==Bo?void 0:Bo.sceneNodes,title:We,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Tt(vt,Ut),annotations:Le,svgAnnotationRules:Te,annotationFrame:Yt}),e(Fn,{active:jo.current>=0,hoverPoint:Ft,margin:ft,size:ht,shape:null===(O=_o.current)||void 0===O?void 0:O.shape,width:null===(C=_o.current)||void 0===C?void 0:C.w,height:null===(j=_o.current)||void 0===j?void 0:j.h}),To,(null==qe?void 0:qe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===qe.badgePosition?{top:4,left:4}:"bottom-left"===qe.badgePosition?{bottom:4,left:4}:"bottom-right"===qe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Xt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Xt?"STALE":"LIVE"})]})]})});jc.displayName="StreamNetworkFrame";const _c=g(function(t,o){var n;const s=i(null);es(o,{variant:"network",frameRef:s});const a=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:C,frameProps:j={},onObservation:_,onClick:P,chartId:M,selection:L,linkedHover:T,loading:B,emptyContent:D,legendInteraction:I,legendPosition:N,stroke:H,strokeWidth:R,opacity:W}=t,F=null!==(n=null!=h?h:g)&&void 0!==n?n:"id",{width:z,height:E,enableHover:$,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=a,K=r(()=>fe(l),[l]),Q=r(()=>fe(c),[c]),Z=$r(B,z,E),J=Z?null:Er(void 0===l?void 0:K,z,E,D),ee=hr(K,v,m),te=r(()=>{if(!v)return[];const e=new Set;for(const t of K){const o="function"==typeof v?v(t):t[v];null!=o&&e.add(o+"")}return Array.from(e)},[K,v]),oe=vr(I,v,te),ne=ur(),ie=r(()=>new Map,[]),re=r(()=>{if(Array.isArray(m))return m;if(ne&&ne.length>0)return ne;const e=ht[m];return Array.isArray(e)?e:gt},[m,ne]),se=r(()=>e=>{const t={};return t.fill=v?vt(e.data||e,v,ee):dr(void 0,ne,m,void 0,ie),"number"==typeof b&&(t.r=b),t},[v,ee,b,ne,m,ie]),ae=r(()=>kr(se,{stroke:H,strokeWidth:R,opacity:W}),[se,H,R,W]),le=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ce=r(()=>kr(le,{stroke:H,strokeWidth:R,opacity:W}),[le,H,R,W]),ue=r(()=>{if(G&&y)return"function"==typeof y?y:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==o?o:e[y])&&void 0!==n?n:e.id}},[G,y]),{legend:de,margin:he,legendPosition:ge}=yr({data:K,colorBy:v,colorScale:ee,showLegend:Y,legendPosition:N,userMargin:u,defaults:a.marginDefaults}),{customHoverBehavior:pe,customClickBehavior:ye}=fr({selection:L,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:_,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),ve=Qr({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:F}});return ve?e(Ir,{componentName:"ForceDirectedGraph",message:ve,width:z,height:E}):Z||J||e(Wr,{componentName:"ForceDirectedGraph",width:z,height:E,children:e(jc,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:K},null!=c&&{edges:Q},{size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he,nodeIDAccessor:F,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ae,edgeStyle:ce,colorBy:v,colorScheme:re,nodeSize:b,nodeSizeRange:x,nodeLabel:ue,showLabels:G,enableHover:$,tooltipContent:!1===C?()=>null:_r(C)||void 0,customHoverBehavior:T||_||P?pe:void 0,customClickBehavior:_||P?ye:void 0,legend:de,legendPosition:ge},I&&"none"!==I&&{legendHoverBehavior:oe.onLegendHover,legendClickBehavior:oe.onLegendClick,legendHighlightedCategory:oe.highlightedCategory,legendIsolatedCategories:oe.isolatedCategories},{className:d,title:q,description:X,summary:V,accessibleTable:U},null!=t.animate&&{animate:t.animate},j))})});function Pc(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function Mc(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function Lc(e){return"function"==typeof e?e:t=>t[e]||1}function Tc({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}_c.displayName="ForceDirectedGraph";const Bc=g(function(t,o){const n=i(null);es(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",padAngle:m=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:C,chartId:j,selection:_,linkedHover:P,loading:M,emptyContent:L,legendInteraction:T,stroke:B,strokeWidth:D,opacity:I}=t,{width:N,height:H,enableHover:R,showLabels:W=!0,title:F,description:z,summary:E,accessibleTable:$}=s,Y=r(()=>fe(l),[l]),G=r(()=>fe(a),[a]),q=$r(M,N,H),X=q?null:Er(void 0===l?void 0:Y,N,H,L),V=r(()=>Mc(G,Y,d,h),[G,Y,d,h]),U=hr(V,p,y),K=r(()=>{if(!p)return[];const e=new Set;for(const t of V){const o="function"==typeof p?p(t):t[p];null!=o&&e.add(o+"")}return Array.from(e)},[V,p]),Q=vr(T,p,K),Z=ur(),J=r(()=>new Map,[]),ee=r(()=>{if(Array.isArray(y))return y;if(Z&&Z.length>0)return Z;const e=ht[y];return Array.isArray(e)?e:gt},[y,Z]),te=V.length>0,oe=r(()=>{if(te)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(p)i.fill=vt(e.data||e,p,U);else{const r=Array.isArray(y)?y:ht[y]||gt,s=Array.isArray(r)?r:gt,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[te,p,U,y]),ne=r(()=>oe?kr(oe,{stroke:B,strokeWidth:D,opacity:I}):void 0,[oe,B,D,I]),ie=r(()=>{if(te)return Tc({edgeColorBy:v,colorBy:p,colorScale:U,nodeStyleFn:ne||(e=>({fill:dr(void 0,Z,y,void 0,J)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[te,v,p,U,ne,w,Z,y,J]),re=r(()=>ie?kr(ie,{stroke:B,strokeWidth:D,opacity:I}):void 0,[ie,B,D,I]),se=r(()=>{if(!W)return;const e=k||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[W,k,f]),ae=Object.assign(Object.assign({},s.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:le,customClickBehavior:ce}=fr({selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:O,onClick:C,chartType:"ChordDiagram",chartId:j}),ue=Qr({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return ue?e(Ir,{componentName:"ChordDiagram",message:ue,width:N,height:H}):q||X||e(Wr,{componentName:"ChordDiagram",width:N,height:H,children:e(jc,Object.assign({ref:n,chartType:"chord"},V.length>0&&{nodes:V},null!=l&&{edges:Y},{size:[N,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,padAngle:m,groupWidth:b,sortGroups:x,nodeStyle:ne,edgeStyle:re,colorBy:p,colorScheme:ee,edgeColorBy:v,edgeOpacity:w,nodeLabel:se,showLabels:W,enableHover:R,tooltipContent:!1===A?()=>null:_r(A)||void 0,customHoverBehavior:P||O||C?le:void 0,customClickBehavior:O||C?ce:void 0},T&&"none"!==T&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:u,title:F,description:z,summary:E,accessibleTable:$},null!=t.animate&&{animate:t.animate},S))})});Bc.displayName="ChordDiagram";const Dc=g(function(t,o){const n=i(null);es(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:a,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",orientation:m="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:C={},onObservation:j,onClick:_,chartId:P,selection:M,linkedHover:L,loading:T,emptyContent:B,legendInteraction:D,stroke:I,strokeWidth:N,opacity:H}=t,{width:R,height:W,enableHover:F,showLabels:z=!0,title:E,description:$,summary:Y,accessibleTable:G}=s,q=r(()=>fe(l),[l]),X=r(()=>fe(a),[a]),V=$r(T,R,W),U=V?null:Er(void 0===l?void 0:q,R,W,B),K=r(()=>Mc(X,q,d,h),[X,q,d,h]),Q=hr(K,p,y),Z=r(()=>{if(!p)return[];const e=new Set;for(const t of K){const o="function"==typeof p?p(t):t[p];null!=o&&e.add(o+"")}return Array.from(e)},[K,p]),J=vr(D,p,Z),ee=ur(),te=r(()=>new Map,[]),oe=r(()=>{if(Array.isArray(y))return y;if(ee&&ee.length>0)return ee;const e=ht[y];return Array.isArray(e)?e:gt},[y,ee]),ne=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?vt(e.data||e,p,Q):dr(void 0,ee,y,void 0,te),t},[p,Q,ee,y,te]),ie=r(()=>kr(ne,{stroke:I,strokeWidth:N,opacity:H}),[ne,I,N,H]),re=r(()=>Tc({edgeColorBy:v,colorBy:p,colorScale:Q,nodeStyleFn:ie,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[v,p,Q,ie,A]),se=r(()=>kr(re,{stroke:I,strokeWidth:N,opacity:H}),[re,I,N,H]),ae=r(()=>{if(!z)return;const e=w||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[z,w,f]),le=Object.assign(Object.assign({},s.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:ce,customClickBehavior:ue}=fr({selection:M,linkedHover:L,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:j,onClick:_,chartType:"SankeyDiagram",chartId:P}),de=Qr({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return de?e(Ir,{componentName:"SankeyDiagram",message:de,width:R,height:W}):V||U||e(Wr,{componentName:"SankeyDiagram",width:R,height:W,children:e(jc,Object.assign({ref:n,chartType:"sankey"},K.length>0&&{nodes:K},null!=l&&{edges:q},{size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,orientation:m,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:ie,edgeStyle:se,colorBy:p,colorScheme:oe,edgeColorBy:v,edgeOpacity:A,edgeSort:S,nodeLabel:ae,showLabels:z,enableHover:F,tooltipContent:!1===O?()=>null:_r(O)||void 0,customHoverBehavior:L||j||_?ce:void 0,customClickBehavior:j||_?ue:void 0},D&&"none"!==D&&{legendHoverBehavior:J.onLegendHover,legendClickBehavior:J.onLegendClick,legendHighlightedCategory:J.highlightedCategory,legendIsolatedCategories:J.isolatedCategories},{className:u,title:E,description:$,summary:Y,accessibleTable:G},null!=t.animate&&{animate:t.animate},C))})});function Ic(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:v=5,tooltip:m,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,legendInteraction:C,stroke:j,strokeWidth:_,opacity:P}=t,{width:M,height:L,enableHover:T,showLabels:B=!0,title:D,description:I,summary:N,accessibleTable:H}=o,R=$r(O,M,L),W=r(()=>Pc(null!=n?n:null,c),[n,c]),F=hr(W,f?void 0:h,g),z=r(()=>{if(!h||f)return[];const e=new Set;for(const t of W){const o="function"==typeof h?h(t):t[h];null!=o&&e.add(o+"")}return Array.from(e)},[W,h,f]),E=vr(C,f?void 0:h,z),$=ur(),Y=r(()=>new Map,[]),G=r(()=>{if(Array.isArray(g))return g;if($&&$.length>0)return $;const e=ht[g];return Array.isArray(e)?e:gt},[g,$]),q=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?vt(e.data||e,h,F):dr(void 0,$,g,void 0,Y),t},[h,f,F,$,g,Y]),X=r(()=>kr(q,{stroke:j,strokeWidth:_,opacity:P}),[q,j,_,P]),V=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),U=r(()=>kr(V,{stroke:j,strokeWidth:_,opacity:P}),[V,j,_,P]),K=r(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Lc(u)},[a,u]),Q=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:Z,customClickBehavior:J}=fr({selection:A,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w}),ee=Kr({componentName:"TreeDiagram",data:n});return ee?e(Ir,{componentName:"TreeDiagram",message:ee,width:M,height:L}):R||e(Wr,{componentName:"TreeDiagram",width:M,height:L,children:e(jc,Object.assign({chartType:a},null!=n&&{data:n},{size:[M,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,treeOrientation:l,edgeType:p,nodeStyle:X,edgeStyle:U,colorBy:h,colorScheme:G,colorByDepth:f,nodeSize:v,nodeLabel:B?y||d:void 0,showLabels:B,enableHover:T,tooltipContent:!1===m?()=>null:_r(m)||void 0,customHoverBehavior:S||x||k?Z:void 0,customClickBehavior:x||k?J:void 0},C&&"none"!==C&&{legendHoverBehavior:E.onLegendHover,legendClickBehavior:E.onLegendClick,legendHighlightedCategory:E.highlightedCategory,legendIsolatedCategories:E.isolatedCategories},{className:s,title:D,description:I,summary:N,accessibleTable:H},null!=t.animate&&{animate:t.animate},b))})}function Nc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:v,tooltip:m,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:O,legendInteraction:C,stroke:j,strokeWidth:_,opacity:P}=t,{width:M,height:L,enableHover:T,showLabels:B=!0,title:D,description:I,summary:N,accessibleTable:H}=o,R=$r(O,M,L),{activeSelectionHook:W,customHoverBehavior:F,customClickBehavior:z}=fr({selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:w,onClick:A,chartType:"Treemap",chartId:S}),E=Zr(x),$=l(e=>{if(!e)return F(null);const t=e.data||e;F({data:(null==t?void 0:t.data)||t})},[F]),Y=r(()=>Pc(null!=n?n:null,a),[n,a]),G=hr(Y,g?void 0:d,h),q=r(()=>{if(!d||g)return[];const e=new Set;for(const t of Y){const o="function"==typeof d?d(t):t[d];null!=o&&e.add(o+"")}return Array.from(e)},[Y,d,g]),X=vr(C,g?void 0:d,q),V=ur(),U=r(()=>new Map,[]),K=r(()=>{if(Array.isArray(h))return h;if(V&&V.length>0)return V;const e=ht[h];return Array.isArray(e)?e:gt},[h,V]),Q=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:d?vt(e.data||e,d,G):dr(void 0,V,h,void 0,U),t},[d,g,G,V,h,U]),Z=r(()=>kr(Q,{stroke:j,strokeWidth:_,opacity:P}),[Q,j,_,P]),J=r(()=>W?e=>{var t;const o=Object.assign({},Z(e));if(W.isActive)if(W.predicate(e.data||e))(null==E?void 0:E.selectedStyle)&&Object.assign(o,E.selectedStyle);else{const e=null!==(t=null==E?void 0:E.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==E?void 0:E.unselectedStyle)&&Object.assign(o,E.unselectedStyle)}return o}:Z,[Z,W,E]),ee=r(()=>Lc(c),[c]),te=void 0!==v?v:!B||"parent"!==f&&"all"!==f?void 0:18,oe=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),ne=Kr({componentName:"Treemap",data:n});return ne?e(Ir,{componentName:"Treemap",message:ne,width:M,height:L}):R||e(Wr,{componentName:"Treemap",width:M,height:L,children:e(jc,Object.assign({chartType:"treemap"},null!=n&&{data:n},{size:[M,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,nodeIDAccessor:u,childrenAccessor:a,hierarchySum:ee,padding:y,paddingTop:te,nodeStyle:J,colorBy:d,colorScheme:K,colorByDepth:g,nodeLabel:B?p||u:void 0,showLabels:B,labelMode:f,enableHover:T,tooltipContent:!1===m?()=>null:_r(m)||void 0},(k||w||A)&&{customHoverBehavior:$},(w||A)&&{customClickBehavior:z},C&&"none"!==C&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories},{className:s,title:D,description:I,summary:N,accessibleTable:H},null!=t.animate&&{animate:t.animate},b))})}function Hc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:v={},onObservation:m,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S,stroke:O,strokeWidth:C,opacity:j}=t,{width:_,height:P,enableHover:M,showLabels:L=!0,title:T,description:B,summary:D,accessibleTable:I}=o,N=$r(A,_,P),H=r(()=>Pc(null!=n?n:null,a),[n,a]),R=hr(H,h?void 0:u,d),W=r(()=>{if(!u||h)return[];const e=new Set;for(const t of H){const o="function"==typeof u?u(t):t[u];null!=o&&e.add(o+"")}return Array.from(e)},[H,u,h]),F=vr(S,h?void 0:u,W),z=ur(),E=r(()=>new Map,[]),$=r(()=>{if(Array.isArray(d))return d;if(z&&z.length>0)return z;const e=ht[d];return Array.isArray(e)?e:gt},[d,z]),Y=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:u?vt(e.data||e,u,R):dr(void 0,z,d,void 0,E),t},[u,h,R,f,z,d,E]),G=r(()=>kr(Y,{stroke:O,strokeWidth:C,opacity:j}),[Y,O,C,j]),q=r(()=>Lc(l),[l]),X=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:V,customClickBehavior:U}=fr({selection:k,linkedHover:w,fallbackFields:u?["string"==typeof u?u:""]:[],unwrapData:!0,onObservation:m,onClick:b,chartType:"CirclePack",chartId:x}),K=Kr({componentName:"CirclePack",data:n});return K?e(Ir,{componentName:"CirclePack",message:K,width:_,height:P}):N||e(Wr,{componentName:"CirclePack",width:_,height:P,children:e(jc,Object.assign({chartType:"circlepack"},null!=n&&{data:n},{size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:q,padding:p,nodeStyle:G,colorBy:u,colorScheme:$,colorByDepth:h,nodeLabel:L?g||c:void 0,showLabels:L,enableHover:M,tooltipContent:!1===y?()=>null:_r(y)||void 0,customHoverBehavior:w||m||b?V:void 0,customClickBehavior:m||b?U:void 0},S&&"none"!==S&&{legendHoverBehavior:F.onLegendHover,legendClickBehavior:F.onLegendClick,legendHighlightedCategory:F.highlightedCategory,legendIsolatedCategories:F.isolatedCategories},{className:s,title:T,description:B,summary:D,accessibleTable:I},null!=t.animate&&{animate:t.animate},v))})}Dc.displayName="SankeyDiagram",Ic.displayName="TreeDiagram",Nc.displayName="Treemap",Hc.displayName="CirclePack";const Rc=pt;function Wc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:C,onClick:j,chartId:_,selection:P,linkedHover:M,loading:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,title:R,description:W,summary:F,accessibleTable:z}=o,E=$r(L,I,N),$=hr(r(()=>Pc(n,a),[n,a]),d?void 0:c,u),Y=ur(),G=r(()=>new Map,[]),q=r(()=>{if(Array.isArray(u))return u;if(Y&&Y.length>0)return Y;const e=ht[u];return Array.isArray(e)?e:gt},[u,Y]),X=r(()=>{if(Array.isArray(u))return u;const e=ht[u];return Array.isArray(e)?e:gt},[u]),V=r(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?X[0]:Rc[(e.depth||0)%Rc.length]:c?vt(e.data||e,c,$):dr(void 0,Y,u,void 0,G),o.opacity=n?1:.85,o},[c,d,$,X,Y,u,G]),U=r(()=>kr(V,{stroke:T,strokeWidth:B,opacity:D}),[V,T,B,D]),K=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:Z,customClickBehavior:J}=fr({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:C,onClick:j,chartType:"OrbitDiagram",chartId:_}),ee=r(()=>{if(Z)return e=>{Z(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[Z]),te=r(()=>{if(J)return e=>{J(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[J]),oe=Kr({componentName:"OrbitDiagram",data:n});return oe?e(Ir,{componentName:"OrbitDiagram",message:oe,width:I,height:N}):E||e(Wr,{componentName:"OrbitDiagram",width:I,height:N,children:e(jc,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:U,edgeStyle:K,colorBy:c,colorScheme:q,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&H,tooltipContent:k?void 0:!1===w?()=>null:_r(w)||void 0,customHoverBehavior:M||C||j?ee:void 0,customClickBehavior:C||j?te:void 0,foregroundGraphics:A,annotations:S,className:s,title:R,description:W,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:z},null!=t.animate&&{animate:t.animate},O))})}Wc.displayName="OrbitDiagram";const Fc={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},zc={opacity:.7,marginRight:4};function Ec(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function $c(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Yc(e={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=e;return e=>{var s;const a=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,l=Ec(a,o,"time"),c=Ec(a,n,"value");return t("div",{className:"semiotic-tooltip",style:Fc,children:[t("div",{children:[t("span",{style:zc,children:[i,":"]}),$c(l)]}),t("div",{children:[t("span",{style:zc,children:[r,":"]}),$c(c)]})]})}}function Gc(e,t){var o;return null!=e?e:Math.max(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0,200)}const qc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:C,opacity:j,background:_,tooltipContent:P,tooltip:M,onHover:L,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,transition:W,linkedHover:F,selection:z,onObservation:E,chartId:$,loading:Y,emptyContent:G,emphasis:q,legendPosition:X}=t,V=u.showAxes,U=u.enableHover,K=null!=h?h:u.marginDefaults,Q=null!=d?d:[u.width,u.height],Z=null!==(c=null!=P?P:M)&&void 0!==c?c:Yc({timeAccessor:b,valueAccessor:x}),J=i(null),{customHoverBehavior:ee}=fr({selection:z,linkedHover:F,unwrapData:!0,onObservation:E,chartType:"RealtimeLineChart",chartId:$}),te=l(e=>{L&&L(e),ee(e)},[L,ee]);p(o,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=$r(Y,Q[0],Q[1]),ne=oe?null:Er(m,Q[0],Q[1],G),ie={stroke:S,strokeWidth:O,strokeDasharray:C};null!=j&&(ie.opacity=j);const re=Gc(v,m);return oe||ne||e(Ai,{ref:J,chartType:"line",runtimeMode:"streaming",size:Q,margin:K,className:q?`${g||""} semiotic-emphasis-${q}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:ie,showAxes:V,background:_,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,transition:W,pointIdAccessor:t.pointIdAccessor,legendPosition:X})});qc.displayName="RealtimeLineChart";const Xc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,showAxes:t.showAxes,enableHover:null!=t.enableHover?!!t.enableHover:void 0,linkedHover:t.linkedHover}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,categoryAccessor:O,colors:C,fill:j,stroke:_,strokeWidth:P,opacity:M,gap:L,background:T,tooltipContent:B,tooltip:D,onHover:I,annotations:N,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,linkedHover:F,selection:z,decay:E,pulse:$,staleness:Y,transition:G,onObservation:q,chartId:X,loading:V,emptyContent:U,emphasis:K,legendPosition:Q,brush:Z,onBrush:J,linkedBrush:ee}=t,te=u.showAxes,oe=u.enableHover,ne=null!=g?g:u.marginDefaults,ie=null!=h?h:[u.width,u.height],re=null!==(c=null!=B?B:D)&&void 0!==c?c:Yc({timeAccessor:x,valueAccessor:k}),se=i(null),{customHoverBehavior:ae}=fr({selection:z,linkedHover:F,unwrapData:!0,onObservation:q,chartType:"RealtimeTemporalHistogram",chartId:X}),le=l(e=>{I&&I(e),ae(e)},[I,ae]),ce=!0===Z?{dimension:"x",snap:"bin"}:"x"===Z?{dimension:"x"}:"object"==typeof Z?Z:void 0,ue=Ki(ee),de=Hi(Object.assign({name:(null==ue?void 0:ue.name)||"__unused_hist_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof x?x:"time")},(null==ue?void 0:ue.yField)?{yField:ue.yField}:{})),he=i(de.brushInteraction);he.current=de.brushInteraction;const ge=l(e=>{if(J&&J(e),q&&q(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:X}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:X}),ue){const t=he.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[J,q,X,ue]);p(o,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=se.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=se.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const fe=$r(V,ie[0],ie[1]),pe=fe?null:Er(b,ie[0],ie[1],U),ye={};null!=j&&(ye.fill=j),null!=_&&(ye.stroke=_),null!=P&&(ye.strokeWidth=P),null!=M&&(ye.opacity=M),null!=L&&(ye.gap=L);const ve=K?`${f||""} semiotic-emphasis-${K}`.trim():f,me=Gc(m,b);return fe||pe||e(Ai,{ref:se,chartType:"bar",runtimeMode:"streaming",size:ie,margin:ne,className:ve,arrowOfTime:y,windowMode:v,windowSize:me,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,binSize:d,categoryAccessor:O,barColors:C,barStyle:ye,showAxes:te,background:T,hoverAnnotation:oe,tooltipContent:re,customHoverBehavior:le,annotations:N,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,decay:E,pulse:$,staleness:Y,transition:G,pointIdAccessor:t.pointIdAccessor,legendPosition:Q,brush:ce||(ee?{dimension:"x"}:void 0),onBrush:ce||ee?ge:void 0})});Xc.displayName="RealtimeTemporalHistogram";const Vc=Xc,Uc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:C,fill:j,opacity:_,stroke:P,strokeWidth:M,background:L,tooltipContent:T,tooltip:B,onHover:D,annotations:I,svgAnnotationRules:N,tickFormatTime:H,tickFormatValue:R,linkedHover:W,selection:F,onObservation:z,chartId:E,loading:$,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=u.showAxes,V=u.enableHover,U=null!=h?h:u.marginDefaults,K=null!=d?d:[u.width,u.height],Q=null!==(c=null!=T?T:B)&&void 0!==c?c:Yc({timeAccessor:b,valueAccessor:x}),Z=i(null),{customHoverBehavior:J}=fr({selection:F,linkedHover:W,unwrapData:!0,onObservation:z,chartType:"RealtimeSwarmChart",chartId:E}),ee=l(e=>{D&&D(e),J(e)},[D,J]);p(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=$r($,K[0],K[1]),oe=te?null:Er(m,K[0],K[1],Y),ne={};null!=C&&(ne.radius=C),null!=j&&(ne.fill=j),null!=_&&(ne.opacity=_),null!=P&&(ne.stroke=P),null!=M&&(ne.strokeWidth=M);const ie=G?`${g||""} semiotic-emphasis-${G}`.trim():g,re=Gc(v,m);return te||oe||e(Ai,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:K,margin:U,className:ie,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:ne,showAxes:X,background:L,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:I,svgAnnotationRules:N,tickFormatTime:H,tickFormatValue:R,legendPosition:q,pointIdAccessor:t.pointIdAccessor})});Uc.displayName="RealtimeSwarmChart";const Kc=g(function(o,n){var r,s,a,c,u;const d=br(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:C,connectorStroke:j,connectorWidth:_,gap:P,stroke:M,strokeWidth:L,opacity:T,background:B,tooltipContent:D,tooltip:I,onHover:N,annotations:H,svgAnnotationRules:R,tickFormatTime:W,tickFormatValue:F,linkedHover:z,selection:E,onObservation:$,chartId:Y,loading:G,emptyContent:q,emphasis:X,legendPosition:V}=o,U=d.showAxes,K=d.enableHover,Q=null!=g?g:d.marginDefaults,Z=null!=h?h:[d.width,d.height],J=null!==(u=null!=D?D:I)&&void 0!==u?u:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r,s;const a=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null,l=Ec(a,n,"time"),c=null!==(s=null==a?void 0:a.delta)&&void 0!==s?s:Ec(a,i,"value"),u=null==a?void 0:a.cumEnd,d="number"==typeof c?0>c?$c(c):"+"+$c(c):$c(c);return t("div",{className:"semiotic-tooltip",style:Fc,children:[t("div",{children:[e("span",{style:zc,children:"x:"}),$c(l)]}),t("div",{children:[e("span",{style:zc,children:"Δ:"}),d]}),null!=u&&t("div",{children:[e("span",{style:zc,children:"total:"}),$c(u)]})]})}}({timeAccessor:x,valueAccessor:k}),ee=i(null),{customHoverBehavior:te}=fr({selection:E,linkedHover:z,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:Y}),oe=l(e=>{N&&N(e),te(e)},[N,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ee.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=$r(G,Z[0],Z[1]),ie=ne?null:Er(b,Z[0],Z[1],q),re={};null!=O&&(re.positiveColor=O),null!=C&&(re.negativeColor=C),null!=j&&(re.connectorStroke=j),null!=_&&(re.connectorWidth=_),null!=P&&(re.gap=P),null!=M&&(re.stroke=M),null!=L&&(re.strokeWidth=L),null!=T&&(re.opacity=T);const se=X?`${f||""} semiotic-emphasis-${X}`.trim():f,ae=Gc(m,b);return ne||ie||e(Ai,{ref:ee,chartType:"waterfall",runtimeMode:"streaming",size:Z,margin:Q,className:se,arrowOfTime:y,windowMode:v,windowSize:ae,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:re,showAxes:U,background:B,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:oe,annotations:H,svgAnnotationRules:R,tickFormatTime:W,tickFormatValue:F,legendPosition:V,pointIdAccessor:o.pointIdAccessor})});Kc.displayName="RealtimeWaterfallChart";const Qc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,categoryAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,heatmapXBins:O=20,heatmapYBins:C=20,aggregation:j="count",background:_,tooltipContent:P,tooltip:M,onHover:L,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,linkedHover:W,selection:F,onObservation:z,chartId:E,loading:$,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=u.showAxes,V=u.enableHover,U=null!=h?h:u.marginDefaults,K=null!=d?d:[u.width,u.height],Q=null!==(c=null!=P?P:M)&&void 0!==c?c:Yc({timeAccessor:b,valueAccessor:x}),Z=i(null),{customHoverBehavior:J}=fr({selection:F,linkedHover:W,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:E}),ee=l(e=>{L&&L(e),J(e)},[L,J]);p(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=$r($,K[0],K[1]),oe=te?null:Er(m,K[0],K[1],Y),ne=G?`${g||""} semiotic-emphasis-${G}`.trim():g,ie=Gc(v,m);return te||oe||e(Ai,{ref:Z,chartType:"heatmap",runtimeMode:"streaming",size:K,margin:U,className:ne,arrowOfTime:f,windowMode:y,windowSize:ie,data:m,timeAccessor:b,valueAccessor:x,categoryAccessor:k,xExtent:w,yExtent:A,extentPadding:S,heatmapXBins:O,heatmapYBins:C,heatmapAggregation:j,showAxes:X,background:_,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,legendPosition:q,pointIdAccessor:t.pointIdAccessor})});Qc.displayName="RealtimeHeatmap";const[Zc]=be(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Jc(e,t){return ts(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),eu(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);tu(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(tu(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function eu(e,t){var o;const n=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const n=r.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,i.length)>e;e++)eu(n[e],i[e])}function tu(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const ou={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"}},nu={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},iu={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},ru=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],su=["vertical","horizontal"],au={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},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({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{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:su},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),iu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ou),{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({},ou),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},ou),{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({},ou),iu),{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({},ou),iu),{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({},ou),{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({},ou),{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:su},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({},ou),{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({},ou),{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({},ou),{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({},ou),{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({},ou),{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({},ou),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ou),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},ou),{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({},ou),{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({},ou),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ou),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function lu(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function cu(e,t){const o=[],n=au[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(au).join(", ")}`]};for(const i of n.required)null==t[i]&&o.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=n.props[e];if(t){if(!lu(i,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;o.push(`"${e}" should be ${n}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&o.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(n.props),r=new Set(i);for(const n of Object.keys(t))if(void 0!==t[n]&&!r.has(n)){const t=qr(n,i),r=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${i.join(", ")}.`;o.push(r)}if("array"===n.dataShape){const i=t.data,r={};for(const e of n.dataAccessors){const o=t[e];"string"==typeof o&&(r[e]=o)}const s=Ur({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&o.push(s)}else if("object"===n.dataShape){const n=Kr({componentName:e,data:t.data});n&&o.push(n)}else if("network"===n.dataShape){const i=Qr({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});i&&o.push(i)}return{valid:0===o.length,errors:o}}const uu=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),du=new Set(["data","nodes","edges"]),hu="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function gu(e,t,o){if(!au[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(au).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(uu.has(e)||!n&&du.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=hu(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})}function fu(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!au[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:hu(e.props)}}function pu(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function yu(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}function vu(e){return ts(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?mu(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function mu(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function bu(){const o=function(){const e=n.useContext(xn);return e?()=>e.setVisible(e=>!e):null}();return o?e("button",{className:"semiotic-chart-action",onClick:o,title:"Data summary","aria-label":"Toggle data summary",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const xu={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function ku({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function wu({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const Au=n.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:u,controls:d,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:v,style:m},b){const x=n.useRef(null),k=n.useRef(null),[w,A]=n.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),C=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,j=!0===(null==c?void 0:c.dataSummary),_="object"==typeof(null==c?void 0:c.export)?c.export:{},P="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",M=n.useCallback(e=>ts(this,void 0,void 0,function*(){k.current&&(yield Jc(k.current,Object.assign(Object.assign({},_),e)))}),[_]),L=n.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=n.useCallback(e=>ts(this,void 0,void 0,function*(){u&&(yield vu(u,e||P||"json"))}),[u,P]);n.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),n.useImperativeHandle(b,()=>({export:M,toggleFullscreen:L,copyConfig:T,element:x.current}),[M,L,T]);const B=i||r||d||S||O||C||j||p,D=h?e(ku,{height:l}):g?e(wu,{error:g}):f?e(Nr,{children:s}):s;return I=t(o,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(v?" "+v:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),m),children:[B&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[d,S&&e("button",{className:"semiotic-chart-action",onClick:()=>M(),title:"Export chart","aria-label":"Export chart",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),j&&e(bu,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:Su,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(o,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),C&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:xu[p].bg,color:xu[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[D,y]})]})]}),j?e(kn,{children:I}):I;var I}),Su={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Ou({children:t,columns:o="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof o?o:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${o}, 1fr)`,gap:r,width:"100%"},a),children:n.Children.map(t,t=>n.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function Cu({children:o,context:n,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:o}),e("div",{style:h,children:n})]})}Ou.displayName="ChartGrid",Cu.displayName="ContextLayout";function ju({children:o,position:n="right",size:r=300,trigger:a="click",chartId:c,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[v,m]=d(null),[b,x]=d(null),[k,w]=d(!1),[A,S]=d(!1),O=i(null),C=i(void 0),j="click"===a?["click","click-end"]:["hover","hover-end"],{latest:_}=Wi({types:j,chartId:c,limit:1}),P=void 0!==u?u:_;s(()=>{if(P)if("click"===P.type||"hover"===P.type){const e=P;m(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(C.current),C.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==P.type&&"hover-end"!==P.type||M()},[P]),s(()=>{null==f||f(k)},[k,f]);const M=l(()=>{S(!0),w(!1),clearTimeout(C.current),C.current=setTimeout(()=>{S(!1),m(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(C.current),[]),!v&&!A)return null;const L=v&&b?o(v,b):null;if(null===L&&!A)return null;const T=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${n}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:_u,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const _u={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};ju.displayName="DetailsPanel";const Pu=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Mu=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Lu=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Tu=new Set(["LineChart","AreaChart","StackedAreaChart"]),Bu=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Du(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[o,n,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(o)+.7152*r(n)+.0722*r(i)}function Iu(e,t){const o=Du(e),n=Du(t);return null===o||null===n?null:(Math.max(o,n)+.05)/(Math.min(o,n)+.05)}const Nu=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Hu(e,t){const o=[],n=cu(e,t);for(const e of n.errors)o.push({severity:"error",code:"VALIDATION",message:e,fix:""});return au[e]?(function(e,t,o){const n=au[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&o.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"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&o.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,o),function(e,t,o){const n=t.width,i=t.height;if(void 0===n||"number"==typeof n&&n>0||o.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||o.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,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&o.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,o),function(e,t,o){const n=au[e];if(!n||"array"!==n.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 n.dataAccessors){const n=t[e];"string"==typeof n&&(n in r||o.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,o),function(e,t,o){Pu.has(e)&&Array.isArray(t.data)&&o.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,o),function(e,t,o){Mu.has(e)&&(t.edges||t.data||o.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,o),function(e,t,o){const n=au[e];if(!n||"array"!==n.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&&o.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,o),function(e,t,o){t.linkedHover&&!t.selection&&o.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,o),function(e,t,o){var n;if(!Lu.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&o.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!==(n=i[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,o),function(e,t,o){if(!Tu.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=t.yAccessor||"y";"string"==typeof i&&n.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&o.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,o),function(e,t,o){var n,i;const r=null!==(n=t.width)&&void 0!==n?n: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||o.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||o.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,o),function(e,t,o){var n;const i=au[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 o=0;a>o;o++){const i=null===(n=r[o])||void 0===n?void 0:n[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&o.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,o),function(e,t,o){if(!Bu.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&o.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} 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,o),function(e,t,o){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const i=n.bottom;"number"==typeof i&&70>i&&o.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,o),function(e,t,o){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&o.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,o),function(e,t,o){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=n[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const r=i[n];"string"==typeof r&&o.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" 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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Iu(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const i=n.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=Iu(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n="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;n||i||r||o.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,o),function(e,t,o){const n=[];for(const e of Nu)"function"==typeof t[e]&&n.push(e);n.length>0&&o.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.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,o),{ok:o.every(e=>"warning"===e.severity),diagnoses:o}):{ok:0===o.length,diagnoses:o}}function Ru(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function Wu(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function Fu(e){return"nominal"===e||"ordinal"===e}function zu(e){return"quantitative"===e||"temporal"===e}const Eu={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},$u={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},Yu={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Gu(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f;const p=[],{type:y,markProps:v}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}(e,["type"])}}(e.mark),m=e.encoding||{},b=m.x,x=m.y,k=m.color,w=m.size,A=m.theta,S=m.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const C={};e.width&&(C.width=e.width),e.height&&(C.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(C.title=j),(null==k?void 0:k.field)&&(C.colorBy=k.field,null===(n=k.scale)||void 0===n?void 0:n.scheme)){const e=Eu[k.scale.scheme];e&&(C.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(C.pointOpacity=S.value);const _=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(_||P)){const e=P?x:b,t=P?b:x,o=Yu[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(O,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const o of O){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}O=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(C.data=O),(null==b?void 0:b.bin)?(C.valueAccessor=b.field,(null==x?void 0:x.field)&&(C.categoryAccessor=x.field),(null===(i=b.axis)||void 0===i?void 0:i.title)&&(C.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(C.valueAccessor=x.field,(null==b?void 0:b.field)&&(C.categoryAccessor=b.field),(null===(r=x.axis)||void 0===r?void 0:r.title)&&(C.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(s=null==b?void 0:b.bin)||void 0===s?void 0:s.maxbins)||(null===(a=null==x?void 0:x.bin)||void 0===a?void 0:a.maxbins):void 0;return t&&(C.bins=t),Xu(e,C,p)}let M;switch(y){case"bar":M=function(e,t,o,n,i,r,s){var a,l,c,u,d,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",Fu(null==e?void 0:e.type)&&zu(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):zu(null==e?void 0:e.type)&&Fu(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(b,x,k,C,O,_,P);break;case"line":if(M="LineChart",qu(b,x,C,_,P),(null==k?void 0:k.field)&&(C.lineBy=k.field),v.interpolate){const e=$u[v.interpolate];e&&(C.curve=e)}!0===v.point&&(C.showPoints=!0),O&&(C.data=O);break;case"area":if((null==k?void 0:k.field)?(M="StackedAreaChart",C.areaBy=k.field):M="AreaChart",qu(b,x,C,_,P),v.interpolate){const e=$u[v.interpolate];e&&(C.curve=e)}void 0!==v.opacity&&(C.areaOpacity=v.opacity),O&&(C.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(M="BubbleChart",C.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(C.sizeRange=w.scale.range)):M="Scatterplot",qu(b,x,C,_,P),O&&(C.data=O);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(C.xAccessor=b.field),(null==x?void 0:x.field)&&(C.yAccessor=x.field),(null==k?void 0:k.field)&&(C.valueAccessor=k.field,delete C.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(C.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(C.yLabel=x.axis.title),O&&(C.data=O);break;case"arc":v.innerRadius&&v.innerRadius>0?(M="DonutChart",C.innerRadius=v.innerRadius):M="PieChart",(null==A?void 0:A.field)?C.valueAccessor=A.field:(null==x?void 0:x.field)&&(C.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(C.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(C.categoryAccessor=b.field),O&&(C.data=O);break;case"tick":M="DotPlot",Fu(null==b?void 0:b.type)?(C.categoryAccessor=b.field,(null==x?void 0:x.field)&&(C.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(C.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(C.valueLabel=x.axis.title)):Fu(null==x?void 0:x.type)?(C.categoryAccessor=x.field,(null==b?void 0:b.field)&&(C.valueAccessor=_?"value":b.field),C.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(C.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(C.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(C.categoryAccessor=b.field),(null==x?void 0:x.field)&&(C.valueAccessor=P?"value":x.field)),O&&(C.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),M="Scatterplot",qu(b,x,C,_,P),O&&(C.data=O)}return Xu(M,C,p)}function qu(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function Xu(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}export{cs as AreaChart,ya as BarChart,wa as BoxPlot,fs as BubbleChart,Ts as CandlestickChart,Oi as CategoryColorProvider,Au as ChartContainer,Ou as ChartGrid,Bc as ChordDiagram,Hc as CirclePack,gs as ConnectedScatterplot,Cu as ContextLayout,ju as DetailsPanel,_a as DonutChart,Oa as DotPlot,_c as ForceDirectedGraph,Ma as FunnelChart,Pa as GaugeChart,ma as GroupedBarChart,ps as Heatmap,Aa as Histogram,Ra as LikertChart,rs as LineChart,Vi as LinkedCharts,Os as MinimapChart,Ls as MultiAxisLineChart,Cr as MultiLineTooltip,Wc as OrbitDiagram,ja as PieChart,Cs as QuadrantChart,Qc as RealtimeHeatmap,Vc as RealtimeHistogram,qc as RealtimeLineChart,Uc as RealtimeSwarmChart,Kc as RealtimeWaterfallChart,Ca as RidgelinePlot,Dc as SankeyDiagram,ds as Scatterplot,As as ScatterplotMatrix,us as StackedAreaChart,va as StackedBarChart,xa as SwarmPlot,Wa as SwimlaneChart,rr as ThemeProvider,Zc as TooltipProvider,Ic as TreeDiagram,Nc as Treemap,Sa as ViolinPlot,mu as configToJSX,vu as copyConfig,Wu as deserializeSelections,Hu as diagnoseConfig,Jc as exportChart,fu as fromConfig,yu as fromURL,Gu as fromVegaLite,Ru as serializeSelections,gu as toConfig,pu as toURL,Hi as useBrushSelection,Ci as useCategoryColors,Wi as useChartObserver,Ri as useFilteredData,Ii as useLinkedHover,Di as useSelection,sr as useTheme,cu as validateProps};
2
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as a,useCallback as l,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as v,brushY as m,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as S,scaleBand as O}from"d3-scale";import{quadtree as j}from"d3-quadtree";import{curveNatural as C,curveBasis as _,curveStepAfter as P,curveStepBefore as M,curveStep as L,curveCatmullRom as T,curveCardinal as B,curveMonotoneY as D,curveMonotoneX as I,line as N,area as H,curveLinear as R,arc as W,pie as E}from"d3-shape";import{bin as F,quantile as z,min as $,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Q,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as oe}from"d3-hierarchy";import ne from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as se,forceManyBody as ae,forceCenter as le,forceX as ce,forceY as ue}from"d3-force";import{ribbon as de,chord as he}from"d3-chord";const ge=Object.freeze([]);function fe(e){if(!e)return ge;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}function pe(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function ye(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function ve({width:t,height:o,totalWidth:n,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),j=i(O);j.current=O;const C=i(!1),_=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),n="x"===c?v():"y"===c?m():b();return n.extent([[0,0],[t,o]]),n.on("brush end",i=>{if(C.current)return;const r=S.current;if(!r)return;if(!i.selection)return _.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(o),r.y.invert(0)]}else if("y"===c){const[e,o]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(e)]}else{const[[e,t],[o,n]]=i.selection;s=[r.x.invert(e),r.x.invert(o)],a=[r.y.invert(n),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=j.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[pe(e[0],t),ye(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const o=r.x(s[0]),a=r.x(s[1]);if(C.current=!0,"x"===c)e.call(n.move,[o,a]);else if("xy"===c){const t=i.selection;e.call(n.move,[[o,t[0][1]],[a,t[1][1]]])}C.current=!1}const l={x:s,y:a};_.current=l,A.current(l)}),e.call(n),w.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[t,o,c,g,h,p]),s(()=>{if(!(x&&u&&w.current&&_.current))return;if(!k.current)return;if("y"===c)return;const e=_.current,t=u.x.domain()[0],o=y(k.current).select(".brush-g");if(t>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,_.current=null,void A.current(null);let n=e.x[0],i=!1;if(t>e.x[0]){if(n=t,"bin"===g){const e=j.current;e&&e.length>0?n=ye(t,e):h&&h>0&&(n=Math.ceil(t/h)*h)}if(n>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,_.current=null,void A.current(null);i=!0}const r=u.x(n),s=u.x(e.x[1]);if(C.current=!0,"x"===c)o.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(w.current.move,[[r,t],[s,n]])}if(C.current=!1,i){const t={x:[n,e.x[1]],y:e.y};_.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:n,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class me{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=fe(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=fe(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function be(t){let o=null;const n=()=>(o||(o=u(null)),o),s=xe(t);return[function({children:o,initialState:s}){const a=i(s),l=r(()=>xe(t,a.current),[]),c=n();return e(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=a(o))&&void 0!==t?t:s,u=i(e);u.current=e;const d=l(()=>u.current(r.getState()),[r]),h=l(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function xe(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Oe={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}},je={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Ce(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return je;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Oe:Se;return we(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 we(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_e,Pe]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:Ce(e.theme,t)}))}}));class Me{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 o of e){const e=this.push(o);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 o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+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),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 Le{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Te(e,t,o,n,i){const r=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=r.get(l);if(c||(c={start:l,end:l+n,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 Be(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const 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 De(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(!Number.isFinite(e)||!Number.isFinite(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 Ie(e,t,o,n){var i,r,s;const a=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const i of t)e+=o(i,n)||0;a.set(n,-e/2)}else if("wiggle"===n){e.length>0&&a.set(e[0],0);for(let n=1;e.length>n;n++){const r=e[n-1],s=e[n];let l=0,c=0,u=0;for(const e of t){const t=o(e,s)||0;l+=(2*u+t)*(t-(o(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(c>0?l/(2*c):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=n/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function Ne(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(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 He(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function Re(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,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 We(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Ee(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function Fe(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function ze(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function $e(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ge(e){const t=e.map($e),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return Ye(e,o,n)}if(e>=1){const[e,n,i]=t[o];return Ye(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return Ye(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qe=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ot=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),nt=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),st=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),at=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ut=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),dt=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Qe,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 vt(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||yt.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):gt[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%gt.length]}function mt(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return x().domain(n).range(o).unknown("#999");const r=ht[o]||ht.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:gt;return x().domain(n).range(e).unknown("#999")}}function bt(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function xt(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}function kt(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,o){return e+(t-e)*o}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function jt(e,t,o){var n,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 o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ct(e,t,o){if(!e.getBounds||!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o),r=e.getY(o);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(o),a=e.scales.x(t);if(s&&0!==s)n.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);n.push([a,t]),i.push([a,t])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:e.resolveBoundsStyle(o,t[0]),datum:t,group:o,interactive:!1}}function _t(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=Ne(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const Pt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it},Mt=new Map;class Lt{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Me(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Ee(e.timeAccessor||e.xAccessor,"time"),this.getY=Ee(e.valueAccessor||e.yAccessor,"value")):(this.getX=Ee(e.xAccessor,"x"),this.getY=Ee(e.yAccessor,"y")),this.getGroup=ze(e.groupAccessor),this.getCategory=ze(e.categoryAccessor),this.getSize=e.sizeAccessor?Ee(e.sizeAccessor,"size"):void 0,this.getColor=ze(e.colorAccessor),this.getBounds=e.boundsAccessor?Ee(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?Ee(e.y0Accessor,"y0"):void 0,this.getPointId=ze(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Ee(e.openAccessor,"open"):void 0,this.getHigh=Ee(e.highAccessor,"high"),this.getLow=Ee(e.lowAccessor,"low"),this.getClose=o?Ee(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Ee(this.config.timeAccessor||this.config.xAccessor,"time"):Ee(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o)))}else for(const o 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(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e))))}return!0}computeScene(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),m=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(o=p.xExtent[0])&&void 0!==o?o:m[0],null!==(n=p.xExtent[1])&&void 0!==n?n:m[1]]:m,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1];if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(a=p.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(v),o=new Map,n=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const o of e.data){const e=this.getX(o),s=this.getY(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),n.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}o.set(e.key,t),s.set(e.key,a)}const a=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(n.push(t),r+=null!==(u=s.get(t))&&void 0!==u?u:0);f=[...n.reverse(),...o]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(e))&&void 0!==o?o:0)-(null!==(n=s.get(t))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=Ie(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(d=t.get(o))&&void 0!==d?d:0,n=null!==(h=r.get(o))&&void 0!==h?h:0;i>e&&(i=e),e+n>s&&(s=e+n)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=a>0?a*p.extentPadding:1;S=[i-l,s+l]}else S=[0,i+(i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,o,n,i){const r=Te(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(y,this.getY),o=t-e,n=o>0?o*p.extentPadding:1;S=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!O&&S[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),o=this.getBounds(e);null!=t&&!Number.isNaN(t)&&o&&(t+o>S[1]&&(S[1]=t+o),S[0]>t-o&&(S[0]=t-o))}const e=S[1]-S[0],t=e>0?e*p.extentPadding:1,o=null===(g=p.yExtent)||void 0===g?void 0:g[0],n=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=o?S[0]:S[0]-t,null!=n?S[1]:S[1]+t],"log"===p.yScaleType&&0>=S[0]&&b[0]>0&&(S[0]=null!=o?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const j="streaming"===p.runtimeMode,C=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(_=p.arrowOfTime)||"down"===_?"y":"x")){const t="right"===p.arrowOfTime?[C,e.width-C]:[e.width-C,C];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-C,C])}}else{const t="down"===p.arrowOfTime?[C,e.height-C]:[e.height-C,C];this.scales={x:k().domain(S).range([C,e.width-C]),y:k().domain(x).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)};this.scales={x:t(p.xScaleType,x,[C,e.width-C]),y:t(p.yScaleType,S,[e.height-C,C])}}var _;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Lt.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=j().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)},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,n,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 o,n,i,r,s,a,l;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(n=c.themeSemantic)&&void 0!==n?n:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var o,n;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(n=null===(o=c.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==n?n:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.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 n){const o=Ct(e,t.data,t.key);o&&i.push(o)}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=Be(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return _t(e,n,i),i}(d,t);case"area":return function(e,t){const o=e.groupData(t),n=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=De(t.data,e.scales,e.getX,e.getY,i,o,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),n.push(s)}return _t(e,o,n),n}(d,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=De(t.data,e.scales,e.getX,e.getY,r,o,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),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=Be(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return _t(e,o,n),n}(d,t);case"stackedarea":return function(e,t){var o,n,i,r;const s=e.groupData(t),a=null!==(o=e.config.stackOrder)&&void 0!==o?o:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const o of s){let n=0;for(const t of o.data){const o=e.getX(t),i=e.getY(t);Number.isFinite(o)&&Number.isFinite(i)&&(n+=i)}t.set(o.key,n)}const o=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(n.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else if("desc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else{const e=[...s].sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)}),r=[],a=[];let l=0,c=0;for(const o of e)c>l?(r.push(o),l+=null!==(n=t.get(o.key))&&void 0!==n?n:0):(a.push(o),c+=null!==(i=t.get(o.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of d){let o=0;for(const n of e)o+=(null===(l=h.get(n.key))||void 0===l?void 0:l.get(t))||0;g.set(t,o||1)}}const f=Ie(d,e.map(e=>e.key),(e,t)=>{var o;return(null===(o=h.get(e))||void 0===o?void 0:o.get(t))||0},a),p=[],y=new Map,v=new Map;for(const e of d)v.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const o of e){const e=h.get(o.key),n=[],a=[],l=new Map;for(const o of d){let i=e.get(o)||0;const s=v.get(o);r&&(i/=g.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),v.set(o,c),l.set(o,c)}y.set(o.key,l);const c={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const o of s){const n=h.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=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};_t(e,s,g,o)}return g}(d,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,u=Ne(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(d,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n: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=Ee(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const v=new Int32Array(y),m=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;v[g]++;const y=c(n);m[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===v[e])continue;let t;switch(l){case"sum":t=m[e];break;case"mean":t=m[e]/v[e];break;default:t=v[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=o.width/s,A=o.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,j=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===v[n])continue;let i;switch(l){case"sum":i=m[n];break;case"mean":i=m[n]/v[n];break;default:i=v[n]}const r=(i-b)/k;j.push(Re(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:v[n],sum:m[n],xCenter:u+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return j}(e,t,o);if(0===t.length)return[];const n=Ee(e.config.valueAccessor,"value"),i=Fe(e.config.xAccessor,"x"),r=Fe(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 o=t[e],n=i(o),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,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()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){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),v=new Float64Array(t.length),m=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,v[f]=d,m[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=v[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 Pt?e:"blues";let o=Mt.get(t);if(o)return o;o=Array(256);const n=Pt[t]||Xe;for(let e=0;256>e;e++)o[e]=n(e/255);return Mt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=o.width/u,j=o.height/d,C=e.config.showValues,_=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=v[e];if(!isFinite(t))continue;const o=y[e],n=o%u;P.push(Re(n*O,(d-1-(o-n)/u)*j,O,j,A[Math.min((t-k)*S+.5|0,255)],m[e],C?{value:t,showValues:!0,valueFormat:_}:void 0))}return P}(d,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(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 o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.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===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),v=y>g+1?g:0,m=Math.min(h,p)+v/2,b=Math.max(y-v,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(He(m,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(He(m,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(l=d.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=null!==(r=null!==(n=c.fill)&&void 0!==n?n: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,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=d;if(e.getCategory){const t=e.getCategory(o);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:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return u;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=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,v=null==h?void 0:h.stroke,m=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 n=g[t],i=e.getX(n),r=e.getY(n),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+o.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),S=d.y(s),O=Math.min(A,S),j=Math.abs(A-S),C={fill:0>r?p:f,stroke:v,strokeWidth:m};null!=b&&(C.opacity=b),u.push(He(k,O,w,j,C,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(d,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;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!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=xt(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=xt(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=xt(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=xt(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){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;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=kt(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=kt(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-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,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],u=jt(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.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?o.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?n.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&&n.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,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=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=jt(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:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o: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,o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,j,C,_,P,M,L,T,B,D,I,N,H,R,W,E,F,z,$,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],M=jt(e,r,t);if(!M)continue;if(r._transitionKey=M,"line"===r.type||"area"===r.type){const e=i.get(M);if(e){if(U.add(M),"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=n.get(M);if("point"===r.type)if(L){V.add(M);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(M);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!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p: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(M);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m: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(M);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(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!==(P=null===(_=r.style)||void 0===_?void 0:_.opacity)&&void 0!==P?P: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 n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(M=t.opacity)&&void 0!==M?M:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={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};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(D=t.w)&&void 0!==D?D:0,h:null!==(I=t.h)&&void 0!==I?I:0,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(H=t.w)&&void 0!==H?H:0,h:null!==(R=t.h)&&void 0!==R?R:0,fill:"#999",datum:null,style:{opacity:null!==(W=t.opacity)&&void 0!==W?W:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(E=t.openY)&&void 0!==E?E:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(z=t.highY)&&void 0!==z?z:n,lowY:null!==($=t.lowY)&&void 0!==$?$:n,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};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:Ot(),duration:q}),o}(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},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const u=At(e,o.activeTransition),d=wt(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=St(o.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==o.w&&(e.w=St(o.w,e._targetW,d)),void 0!==o.h&&(e.h=St(o.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),e.y=St(o.y,e._targetY,d),void 0!==o.w&&(e.w=St(o.w,e._targetW,d)),void 0!==o.h&&(e.h=St(o.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=St(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=St(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=St(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=St(o.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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=St(t[n][0],o[n][0],d),e.path[n][1]=St(t[n][1],o[n][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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=St(t[o][0],n[o][0],d),e.topPath[o][1]=St(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(o[t][0],i[t][0],d),e.bottomPath[t][1]=St(o[t][1],i[t][1],d)}}if(u>=1){for(const e of o.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 o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.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,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}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 o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.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 o=(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)||ft;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Lt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}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]),o=this.getPointId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);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 o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!We(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),u=l||!We(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Ee(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Ee(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Ee(this.config.xAccessor,"x"),this.getY=Ee(this.config.yAccessor,"y")),s=!0,a=!0)}if("groupAccessor"in e&&!We(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ze(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!We(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ze(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!We(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Ee(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!We(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ze(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!We(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Ee(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),"boundsAccessor"in e&&!We(e.boundsAccessor,r.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?Ee(this.config.boundsAccessor,"bounds"):void 0,s=!0,a=!0),"pointIdAccessor"in e&&!We(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ze(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!We(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!We(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!We(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!We(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Ee(this.config.openAccessor,"open"):void 0,this.getHigh=Ee(this.config.highAccessor,"high"),this.getLow=Ee(this.config.lowAccessor,"low"),this.getClose=t?Ee(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Tt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Bt(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function Dt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function It(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Nt(e,t){const o=It(e);if(!o)return!1;const n=It(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Ht(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Rt(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+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-o,a=Math.sqrt(r*r+s*s);Dt(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}Lt.GROUP_COLOR_MAP_CAP=1e3,Lt.QUADTREE_THRESHOLD=500;const Wt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Et=new WeakMap;let Ft=0,zt=!1,$t=null,Yt=null,Gt=null;function qt(e,t){var o,n;if(!t)return t;const i=Wt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(zt)return;if("undefined"==typeof window||"undefined"==typeof document)return;zt=!0;const e=()=>{Ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&($t=new MutationObserver(e),$t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Yt=window.matchMedia("(prefers-color-scheme: dark)"),Gt=e,"function"==typeof Yt.addEventListener?Yt.addEventListener("change",Gt):"function"==typeof Yt.addListener&&Yt.addListener(Gt)}catch(e){}}();let s=Et.get(r);s&&s.version===Ft||(s={version:Ft,map:new Map},Et.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}function Xt(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)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 Vt(e){switch(e){case"monotoneX":return I;case"monotoneY":return D;case"cardinal":return B;case"catmullRom":return T;case"step":return L;case"stepBefore":return M;case"stepAfter":return P;case"basis":return _;case"natural":return C;default:return null}}function Ut(e,t,o){return null==t?o:"string"!=typeof t?t:qt(e,t)||o}function Kt(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=Xt(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function Qt(e,t,o,n,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,n,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const Zt=new WeakMap;function Jt(e,t){const o=Vt(t);if(!o)return e;const n=Zt.get(e);if(n)return n;const i=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let i=null;const r={moveTo(e,t){i=[e,t],n.push([e,t])},lineTo(e,t){i=[e,t],n.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void n.push([a,l]);const[c,u]=i;for(let i=1;o>=i;i++){const d=i/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return N().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return Zt.set(e,i),i}function eo(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Rt(i,t,o,n,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=oo(r,t,o,n);break;case"line":e=no(r,t,o,n);break;case"rect":if(null==r.datum)break;e=ro(r,t,o);break;case"heatcell":e=so(r,t,o);break;case"area":if(!1===r.interactive)break;e=lo(r,t,o);break;case"candlestick":e=ao(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function to(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=co(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+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 oo(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function no(e,t,o,n=30){var i,r,s,a;if(0===e.path.length)return null;const l=co(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let n=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=io(t,o,i,r,a,l);n>c&&(n=c)}d=n}else{const e=t-c,n=o-u;d=Math.sqrt(e*e+n*n)}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,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function io(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function ro(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function so(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function ao(e,t,o){const n=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function lo(e,t,o){if(0===e.topPath.length)return null;const n=co(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function co(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function uo(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.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(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.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===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}function ho(e,t){var o,n;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!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}function go(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);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=o.groups.indexOf(n);return o.groups.length-1>e?fo(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?fo(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function fo(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function po(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function yo(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function vo(e,t,o,n,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),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,i,n])}const mo={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 bo(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,mo[o])(n(e,t)),i}function xo(){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 ko(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const wo=(o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===d||void 0===d&&null!=s;return f.forEach((o,d)=>{const b=bo(o,d,h,g),x=ko(o,r,s),k=s&&s.size>0&&s.has(o.label);p.push(t("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(d+("ArrowDown"===e.key?1:-1)+f.length)%f.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(xo,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),y+=22}),p};function Ao({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let t=0;64>=t;t++){const o=t/64;c.push(e("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(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+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:n,height:o,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+n,y:o+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 o=t/64;h.push(e("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(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 So(o){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"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:t,width:o,customClickBehavior:n,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:o,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:wo(t,n,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:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===d||void 0===d&&null!=s;p.forEach((o,d)=>{const k=bo(o,d,g,f),w=ko(o,r,s),A=s&&s.size>0&&s.has(o.label),S=26+7*o.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):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&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(d+("ArrowRight"===e.key?1:-1)+p.length)%p.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(o);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*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(xo,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),v+=S});let k=0,w=0;for(const e of p){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=m+1;return{items:y,offset:k,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,u,n,d,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((t,i)=>{const r=o[i];r.label&&(y.push(e("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),y.push(e("g",{className:"legend-item",transform:`translate(${p},0)`,children:t.items},"legend-group-"+i)),p+=t.offset+5,o[i+1]&&y.push(e("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,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 Oo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function jo(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Co(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),e("g",{transform:`translate(${f}, ${p})`,children:jo(o)?e(Ao,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):Oo(o)?e(So,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):o})}function _o(e){return"string"==typeof e?{type:e}:e}function Po({orient:o,config:n,values:i,scale:s,size:a,length:l}){const c=function(e){var t,o,n,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),u="top"===o||"bottom"===o,d=r(()=>{if(0===i.length)return null;const n=s.domain(),r=a-8;if("boxplot"===c.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!n)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=n,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="top"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:u,y1:m+v*(p+f/2),x2:y,y2:m+v*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*p,x2:u,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*p,x2:y,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(n,i),y:"top"===o?m-p-f:m+p,width:Math.abs(i-n),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===o?m-p-f:m+p,x2:r,y2:"top"===o?m-p:m+p+f,stroke:c.fill,strokeWidth:2})]})}{const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="left"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:m+v*(p+f/2),y1:u,x2:m+v*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:u,x2:m+v*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:y,x2:m+v*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===o?m-p-f:m+p,y:Math.min(n,i),width:f,height:Math.abs(i-n),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===o?m-p-f:m+p,y1:r,x2:"left"===o?m-p:m+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=F().domain(n).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-"+o,children:d.map((t,n)=>{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"===o?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===o?-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},n)}})});if("violin"===c.type){const t=r/2+4,n=[];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);n.push(u?`${a},${"top"===o?-(t-i):t-i}`:`${"left"===o?-(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);n.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+o,children:e("polygon",{points:n.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,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${n},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===o?-n-4:n+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,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${n}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===o?-n-4:n+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-"+o,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,o,u,4]);return d?e("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function Mo(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Lo(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function To(o,n,i,r){if(!o)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=o;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?d?[a]:Mo(a,u):[],v=s?d?[s]:Mo(s,u):[],m="leftRight"===h?"end"===f?-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:f,fontWeight:"bold",children:y.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:v.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-label"));let w=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const t=Math.min(u,120);let o=0,n=t;"end"===f?(o=-t,n=0):"middle"===f&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=t;"bottom"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Bo(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e("path",{d:Lo((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function Do(t,o,n,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,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),u=e/2,d=n/2,h=t*d>o*u?u/t:d/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*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 Io(e){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=e,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=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;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&Do(m,b,c,h,x,u),!v.has("subject")&&Bo(x,u,h,o,n),!v.has("note")&&To(l,m,b,h)]}))}function No(t){var o,n;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!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e(Io,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Io,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ho(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n: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 Ro(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n: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 Wo(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.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)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ho(e,o),c=Ro(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Eo(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Fo={linear:R,monotoneX:I,monotoneY:D,step:L,stepAfter:P,stepBefore:M,basis:_,cardinal:B,catmullRom:T};function zo(o){return function(o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,j,C,_,P,M,L,T,B,D,I,N,W,E,F,z,$,Y,G,q,X,V,K,Q,Z,J,ee,te;switch(o.type){case"label":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Eo(r,s,i)?e(No,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Eo(r,s,i)?e(No,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=Ho(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.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:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Ro(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.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:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:Ho(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ro(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=U(r),a=o.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:Ho(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ro(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.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:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const t=i.data||[],r="function"==typeof o.filter?t.filter(o.filter):o.field&&null!=o.value?t.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,n)=>{const r=Ho(t,i),a=Ro(t,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(t):o.r||6,c="function"==typeof o.style?o.style(t):o.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Ho(o,i),r=Ro(o,i);return e(No,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.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,v=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||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(d=o.bandwidth)&&void 0!==d?d:.3):("polynomial"===m?ne.polynomial(p,{order:o.order||2}):ne.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),k=o.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:k,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.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:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m: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=o.upperAccessor||"upperBounds",u=o.lowerAccessor||"lowerBounds",d=o.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=Fo[i.curve||"linear"]||R,f=H().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=o.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),o.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(j=i.scales)||void 0===j?void 0:j.time,l=null!==(_=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==_?_:null===(P=i.scales)||void 0===P?void 0:P.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!==(M=o.threshold)&&void 0!==M?M:2,f=u-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(L=o.fillOpacity)&&void 0!==L?L:.1,m=o.anomalyColor||"#ef4444",b=null!==(T=o.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,o)=>{const n=Ho(t,i),r=Ro(t,i);return null==n||null==r?null:e("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(D=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==D?D:null===(I=i.scales)||void 0===I?void 0:I.time,c=null!==(W=null===(N=i.scales)||void 0===N?void 0:N.y)&&void 0!==W?W:null===(E=i.scales)||void 0===E?void 0:E.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"===(o.method||"linear")){const e=ne.polynomial(u,{order:o.order||2}).equation;d=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=u.length;let t=0,o=0,n=0,i=0;for(const[e,r]of u)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-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),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(F=o.confidence)&&void 0!==F?F:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(z=o.steps)&&void 0!==z?z: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),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`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`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(d(x))}`,C=o.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:o.fill||"#6366f1",fillOpacity:null!==($=o.fillOpacity)&&void 0!==$?$:.15,stroke:"none"}),e("polyline",{points:`${j} ${O}`,fill:"none",stroke:C,strokeWidth:null!==(Y=o.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=o.strokeDasharray)&&void 0!==G?G:"6,3"}),o.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:o.label})]},"ann-"+n)}case"widget":{let t=null,r=null;if(null!=o.px&&null!=o.py)t=o.px,r=o.py;else{const e=Wo(o,n,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!Eo(t,r,i))return null;const s=null!==(q=o.dx)&&void 0!==q?q:0,a=null!==(X=o.dy)&&void 0!==X?X:0,l=null!==(V=o.width)&&void 0!==V?V:32,c=null!==(K=o.height)&&void 0!==K?K:32,u=null!==(Q=o.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:o.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-"+n)}case"text":{const t=Wo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(Z=i.scales)||void 0===Z?void 0:Z.o,a=null===(J=i.scales)||void 0===J?void 0:J.x,l=null===(ee=i.scales)||void 0===ee?void 0:ee.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=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(te=o.opacity)&&void 0!==te?te:.15,f=o.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}),f&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),f&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}}}let $o={positions:new Map};const Yo=new Set;function Go(){for(const e of Yo)e()}function qo(e,t){const o=$o.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Xo(e,t){const o=$o.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Vo(){return $o}function Uo(e){return Yo.add(e),()=>Yo.delete(e)}const Ko={positions:new Map};function Qo(){return()=>{}}function Zo(){return Ko}function Jo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function en(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function tn(o){const{width:n,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f}=o,p=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||g||on,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(n/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:c.x(e),label:o(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 nn(a,Math.max(55,l+8))},[c,d,g,n]),y=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||f||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(c.y.ticks(Math.min(n,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i]),v=h&&c,m=u&&c;if(!v&&!m)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=m&&(!b||!1!==b.baseline),w=m&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,S=(null==x?void 0:x.jaggedBase)||!1,O="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:[v&&(()=>{var o,r;const s=Jo(null===(o=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),a=Jo(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:[p.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+o)),y.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+o))]})})(),k&&!A&&e("line",{x1:0,y1:i,x2:n,y2:i,stroke:O,strokeWidth:1}),A&&e("path",{d:en("bottom",n,i),fill:"none",stroke:O,strokeWidth:1}),w&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:O,strokeWidth:1}),S&&e("path",{d:en("left",n,i),fill:"none",stroke:O,strokeWidth:1})]})})}function on(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nn(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function rn(n){var a,l;const{width:u,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:A,title:S,legend:O,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:_,legendIsolatedCategories:P,legendPosition:M="right",foregroundGraphics:L,marginalGraphics:T,xValues:B,yValues:D,annotations:I,svgAnnotationRules:N,xAccessor:H,yAccessor:R,annotationData:W,pointNodes:E,curve:F,underlayRendered:z,canvasObscuresUnderlay:$=!0,linkedCrosshairName:Y,linkedCrosshairSourceId:G,children:q}=n,X=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||k||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=p.x.ticks(Math.min(n,Math.max(2,Math.floor(u/70)))),r=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:p.x(e),label:o(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 c=nn(s,l);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),(null==t?void 0:t.includeMax)&&c.length>0){const e=p.x.domain()[1],t=p.x(e),n=c[c.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,c.length,r);l>t-n&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:t,label:i})}}return c},[y,p,v,k,u]),V=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||w||on,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=nn(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(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=p.y.domain()[1],t=p.y(e),n=i[i.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e);22>Math.abs(t-n)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[y,p,v,w,d]),U=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"right"===e.orient);if(!t)return[];const o=t.tickFormat||w||on,n=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,v,w,d]),K=i(new Map),Q=i(null!==(a=null==I?void 0:I.length)&&void 0!==a?a:0),Z=null!==(l=null==I?void 0:I.length)&&void 0!==l?l:0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=r(()=>{if(!I||0===I.length)return null;const e=zo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:H,yAccessor:R,width:u,height:d,data:W,frameType:"xy",pointNodes:E,curve:F,stickyPositionCache:K.current};return I.map((o,n)=>{if(N){const i=N(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[I,N,u,d,H,R,W,p,E,F]),ee=function(e){var t;const o=c(e?Uo:Qo,e?Vo:Zo,e?Vo:Zo);return e&&null!==(t=o.positions.get(e))&&void 0!==t?t:null}(Y);return s(()=>{if(!(null==ee?void 0:ee.locked)||!Y)return;const e=e=>{"Escape"===e.key&&Xo(Y)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ee?void 0:ee.locked,Y]),y||S||O||L||T||J&&J.length>0||A||q||ee?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 S?S:"XY Chart"}),e("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[A&&p&&(!z||$)&&(()=>{var o,n;const i=Jo(null===(o=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),r=Jo(null===(n=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return t("g",{className:"stream-grid",children:[X.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+o)),V.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),y&&p&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!n||!1!==n.baseline,s=!i||!1!==i.baseline,a=(null==n?void 0:n.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,c=null==i?void 0:i.landmarkTicks,h=null==n?void 0:n.landmarkTicks,g="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&X.length>1&&(()=>{const e=u/Math.max(X.length-1,1),t=X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!z||$)&&s&&!l&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:g,strokeWidth:1}),(!z||$)&&l&&e("path",{d:en("bottom",u,d),fill:"none",stroke:g,strokeWidth:1}),X.map((o,n)=>{const i=!!c&&("function"==typeof c?c(o.value,n):Nt(o.value,n>0?X[n-1].value:void 0));return t("g",{transform:`translate(${o.pixel},${d})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:o.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:o.label})})]},"xtick-"+n)}),m&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!z||$)&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:g,strokeWidth:1}),(!z||$)&&a&&e("path",{d:en("left",u,d),fill:"none",stroke:g,strokeWidth:1}),V.map((o,n)=>{const i=!!h&&("function"==typeof h?h(o.value,n):Nt(o.value,n>0?V[n-1].value:void 0));return t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},children:o.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:o.label})})]},"ytick-"+n)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${d/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===U.length)return null;const i=n.landmarkTicks,r=n.label||x;return t(o,{children:[!1!==n.baseline&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:g,strokeWidth:1}),U.map((o,n)=>{const r=!!i&&("function"==typeof i?i(o.value,n):Nt(o.value,n>0?U[n-1].value:void 0));return t("g",{transform:`translate(${u},${o.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"},children:o.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:o.label})})]},"ytick-r-"+n)}),r&&e("text",{x:u+f.right-15,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${u+f.right-15}, ${d/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),J,T&&p&&B&&D&&t(o,{children:[T.top&&e("g",{transform:"translate(0, 0)",children:e(Po,{orient:"top",config:_o(T.top),values:B,scale:p.x,size:f.top,length:u})}),T.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(Po,{orient:"bottom",config:_o(T.bottom),values:B,scale:p.x,size:f.bottom,length:u})}),T.left&&e("g",{transform:"translate(0, 0)",children:e(Po,{orient:"left",config:_o(T.left),values:D,scale:p.y,size:f.left,length:d})}),T.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Po,{orient:"right",config:_o(T.right),values:D,scale:p.y,size:f.right,length:d})})]}),L,ee&&ee.sourceId!==G&&(null==p?void 0:p.x)&&(()=>{const t=p.x(ee.xValue);if(null==t||0>t||t>u)return null;const o=ee.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),q]}),S&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof S?S:null}),Co({legend:O,totalWidth:h,totalHeight:g,margin:f,legendPosition:M,title:S,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:_,legendIsolatedCategories:P})]}):null}const sn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function an(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ln="undefined"==typeof window||"undefined"==typeof document,cn="undefined"!=typeof window?h:s;function un(){const[e,t]=d(!1);return cn(()=>{t(!0)},[]),e}const dn=()=>()=>{},hn=()=>!1,gn=()=>!0;function fn(){const e=c(dn,hn,gn);return i(e).current}function pn(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;cn(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=i(l);c.current=l,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function yn(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return mn(e,t);if(!bn(e)||!bn(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!mn(o,i))return!1}else{if(!bn(o)||!bn(i))return!1;if(!vn(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function vn(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function mn(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function bn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const xn=n.createContext(null);function kn({children:t}){const[o,i]=n.useState(!1),r=n.useMemo(()=>({visible:o,setVisible:i}),[o]);return e(xn.Provider,{value:r,children:t})}function wn(){return n.useContext(xn)}const An={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Sn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],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(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}function On(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const jn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Cn={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"},_n={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Pn={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)"},Mn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ln={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)"},Bn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Dn({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),u=wn(),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||d||c(!0)},[l,d]),y=n.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!o||0===o.length)return r?e("span",{id:r,tabIndex:-1,style:An}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:p,style:An,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O;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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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!==(o=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n: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!==(f=C.cy)&&void 0!==f?f:C.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(p=C.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=C.cx)&&void 0!==v?v:C.x,y:null!==(m=C.cy)&&void 0!==m?m: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!==(O=null===(S=C.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return j}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];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 o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${jn(e.min)} to ${jn(e.max)}, mean ${jn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.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:Cn,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Pn,children:"×"}),e("div",{role:"note",style:_n,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Mn,children:[t("caption",{style:Bn,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ln,children:"type"}),w.map(t=>e("th",{style:Ln,children:t},t))]})}),e("tbody",{children:x.map((o,n)=>t("tr",{children:[e("td",{style:Tn,children:o.label}),w.map(t=>{return e("td",{style:Tn,children:(n=o.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":jn(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},n))})]})]})}function In({nodes:o,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,u,d,h,g,f,p,y,v,m,b,x,k;const[w,A]=n.useState(!1),S=wn(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,j=w||O,C=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,_=n.useRef(null),P=n.useCallback(()=>{w||O||A(!0)},[w,O]),M=n.useCallback(e=>{var t;O||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!o||0===o.length)return s?e("span",{id:s,tabIndex:-1,style:An}):null;if(!j)return e("div",{id:s,tabIndex:-1,onFocus:P,style:An,role:"region","aria-label":C,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",o.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(o)?o:[],T=Array.isArray(i)?i:[],B=new Map,D=new Map,I=new Map,N=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,o="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,n="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";D.set(e,(null!==(h=D.get(e))&&void 0!==h?h:0)+1),N.set(e,(null!==(g=N.get(e))&&void 0!==g?g:0)+i)}if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),I.set(e,(null!==(p=I.get(e))&&void 0!==p?p:0)+i)}}const H=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const o=null!==(v=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==v?v:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=B.get(n))&&void 0!==m?m:0,r=null!==(b=D.get(n))&&void 0!==b?b:0,s=null!==(x=I.get(n))&&void 0!==x?x:0,a=null!==(k=N.get(n))&&void 0!==k?k:0;H.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}H.sort((e,t)=>t.degree-e.degree);let R=0,W=0;if(H.length>0){let e=0;for(const t of H)e+=t.degree,t.degree>W&&(W=t.degree);R=e/H.length}const E=T.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),F=[`${H.length} nodes, ${T.length} edges.`];H.length>0&&F.push(`Mean degree: ${jn(R)}, max degree: ${W}.`);const z=H.slice(0,5);return t("div",{ref:_,id:s,tabIndex:-1,onBlur:M,style:Cn,role:"region","aria-label":C,children:[e("button",{type:"button",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Pn,children:"×"}),e("div",{role:"note",style:_n,children:F.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+r,style:Mn,children:[t("caption",{style:Bn,children:["Top ",z.length," of ",H.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ln,children:"id"}),e("th",{style:Ln,children:"degree"}),e("th",{style:Ln,children:"in"}),e("th",{style:Ln,children:"out"}),E&&e("th",{style:Ln,children:"w. degree"}),E&&e("th",{style:Ln,children:"w. in"}),E&&e("th",{style:Ln,children:"w. out"})]})}),e("tbody",{children:z.map((o,n)=>t("tr",{children:[e("td",{style:Tn,children:o.id}),e("td",{style:Tn,children:o.degree}),e("td",{style:Tn,children:o.inDeg}),e("td",{style:Tn,children:o.outDeg}),E&&e("td",{style:Tn,children:jn(o.wDegree)}),E&&e("td",{style:Tn,children:jn(o.wInDeg)}),E&&e("td",{style:Tn,children:jn(o.wOutDeg)})]},n))})]})]})}function Nn({summary:t}){return t?e("div",{role:"note",style:An,children:t}):null}function Hn({tableId:t}){return e("a",{href:"#"+t,style:An,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.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,An)},children:"Skip to data table"})}function Rn({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="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:An,children:o})}const Wn="var(--semiotic-focus, #005fcc)";function En({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:Wn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Wn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Wn,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 Fn({x:t,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=n.useRef(null),[d,h]=n.useState(null);n.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-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function zn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function $n(e,t,o){const n=i(null),[r,a]=d(null);return s(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;a(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}const Yn="undefined"==typeof window?s:h;function Gn(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function qn(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),zn(e,e=>t(e.matches))},[]),e}(),o=i(t);o.current=t;const[a,c]=$n(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,g=c[1]-u.top-u.bottom,f=Gn(e.foregroundGraphics,c,u),p=Gn(e.backgroundGraphics,c,u),y=Pe(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),j=i(0),C=l(()=>{j.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),_=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(C))},[C]),P=l(()=>{O.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const M=e.themeDirtyRef;return Yn(()=>{M&&(Ft++,M.current=!0,w())},[y,w,M]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:a,size:c,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:_,onPointerLeave:P}}function Xn(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,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(n,0,0,n,0,0),i.translate(o.left,o.top),i}function Vn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Un(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function Kn(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const Qn=(e,t,o,n)=>{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,n.width*l,n.height),e.clip());const c=a.style.stroke||"#007bff",u=qt(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 v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Kn(e,a.path,u,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Vt(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=u;const m=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])*m,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(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function j(){S&&(e.stroke(),S=!1)}for(let C=0;a.path.length>C;C++){const[_,P]=a.path[C],M=g[C],L=Un(M,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(_,P);else{const T=[];for(const B of h){const D=B.value;(w>D||D>M)&&(D>w||M>D)||w===D||M===D||T.push({t:(D-w)/(M-w)})}T.sort((e,t)=>e.t-t.t);for(const I of T){const H=x+(_-x)*I.t,R=k+(P-k)*I.t,W=Un(w+(M-w)*Math.min(I.t+1e-4,1),h,u);e.lineTo(H,R),j(),O(W,H,R)}e.lineTo(_,P)}x=_,k=P,w=M,A=L}else O(L,_,P),x=_,k=P,w=M,A=L}j()}else{e.beginPath();const E=a.strokeGradient&&a.path.length>=2?Qt(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=E||u,f)N().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[F,z]=a.path[0];e.moveTo(F,z);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=Ut(e,a.style.fill,a.style.fill),f&&!p)N().x(e=>e[0]).y(e=>e[1]).curve(f).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],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Zn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Jn(e,t,o=.3){Zn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ei(e,t,o=.6){var n,i,r,s,a;if(!Zn(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n: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*o,e.stroke()}function ti(e,t,o,n=.35){Zn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function oi(e,t){const o=Vt(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=H().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const ni=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,n.width*a,n.height),e.clip());const l=t.style.fill||"#4e79a7",c=t._decayOpacities;if(c&&c.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1])*o,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.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1]),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.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(oi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=Kt(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,o,0,n);e.fillStyle=i||l,e.globalAlpha=u}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*u,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(oi(e,t),ti(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const o=t.strokeGradient&&t.topPath.length>=2?Qt(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Vt(t.curve);if(e.beginPath(),n)N().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 o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),o&&e.restore(),e.globalAlpha=1}},ii=(e,t,o,n)=>{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 o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Ut(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Ut(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),ei(e,t),e.globalAlpha=1}}finally{e.restore()}}};function ri(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const si=(e,t,o,n)=>{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)ai(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=ri(t),i=t.fillGradient&&"string"==typeof o?Kt(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=ri(t),i=t.fillGradient&&"string"==typeof o?Kt(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Jn(e,t),e.globalAlpha=1}};function ai(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;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+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}function li(e,t,o,n){return Object.assign({data:e,x:t,y:o,__semioticHoverData:!0},n)}function ci(e){const[t,o,n]=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*o+.114*n>128?"#000":"#fff"}function ui(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const di=(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=qt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Jn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):ui(t.value),n=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=ci(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},hi=(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;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=qt(e,t.wickColor)||t.wickColor,c=60>n.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 o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=qt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&d(),e.restore()}};function gi(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}function fi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}const pi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function yi(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${pi[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${pi[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const vi={line:[ni,Qn,ii],area:[ni,ii],stackedarea:[ni,ii],scatter:[ii],bubble:[ii],heatmap:[di],bar:[si],swarm:[ii],waterfall:[(e,t,o,n)=>{var i,r,s;si(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=qt(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 n=a[t],i=a[t+1];if(!(null===(r=n.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const l=o.y(n.datum.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[hi],mixed:[ni,Qn,ii],custom:[ni,si,di,Qn,ii,hi]},mi={top:20,right:20,bottom:30,left:40},bi={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 xi(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const ki={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 wi({hover:o}){var n,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",a=null!==(n=o.data)&&void 0!==n?n:{},l=null!==(i=a.y)&&void 0!==i?i:a.value,c=null!==(r=a.x)&&void 0!==r?r:a.time;return t("div",{className:"semiotic-tooltip",style:ki,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}const Ai=g(function(o,a){var c,u,h,g,y,v,m,b,x,k,w,A,S;const{chartType:O,runtimeMode:j,data:C,chunkThreshold:_,chunkSize:P,xAccessor:M,yAccessor:L,colorAccessor:T,sizeAccessor:B,groupAccessor:D,lineDataAccessor:I,curve:N,normalize:H,baseline:R,stackOrder:W,binSize:E,valueAccessor:F,arrowOfTime:z="right",windowMode:$="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Q=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:oe,lineStyle:ne,pointStyle:ie,areaStyle:re,barStyle:se,waterfallStyle:ae,swarmStyle:le,barColors:ce,colorScheme:ue,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,gradientFill:pe,lineGradient:ye,areaGroups:be,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,showAxes:je=!0,axes:Ce,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:Le,yFormat:Te,tickFormatTime:Be,tickFormatValue:De,hoverAnnotation:Ie,tooltipContent:Ne,customHoverBehavior:He,customClickBehavior:Re,enableHover:We,hoverRadius:Ee=30,tooltipMode:Fe,annotations:ze,svgAnnotationRules:$e,showGrid:Ye,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,legendCategoryAccessor:Qe,onCategoriesChange:Ze,backgroundGraphics:Je,foregroundGraphics:et,canvasPreRenderers:tt,svgPreRenderers:ot,title:nt,categoryAccessor:it,brush:rt,onBrush:st,decay:at,pulse:lt,transition:ct,animate:ut,staleness:dt,heatmapAggregation:ht,heatmapXBins:gt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,marginalGraphics:vt,pointIdAccessor:mt,xScaleType:bt,yScaleType:xt,accessibleTable:kt=!0,description:wt,summary:At,linkedCrosshairName:St,linkedCrosshairSourceId:Ot,customLayout:jt,layoutConfig:Ct}=o,_t=f().replace(/:/g,""),Pt=i(!1),Mt=qn({sizeProp:Q,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:mi,animate:ut,transitionProp:ct,themeDirtyRef:Pt}),Bt=un(),Dt=fn(),{reducedMotionRef:It,responsiveRef:Nt,size:Ht,currentTheme:Rt,transition:Wt,introEnabled:Et,tableId:Ft,rafRef:zt,renderFnRef:$t,scheduleRender:Yt}=Mt;let Gt=Mt.margin;if(vt){const e=60,t=Object.assign({},Mt.margin);vt.top&&e>t.top&&(t.top=e),vt.bottom&&e>t.bottom&&(t.bottom=e),vt.left&&e>t.left&&(t.left=e),vt.right&&e>t.right&&(t.right=e),Gt=t}const Xt="function"==typeof et?et({size:Ht,margin:Gt}):et,Vt="function"==typeof Je?Je({size:Ht,margin:Gt}):Je,Ut=Ht[0]-Gt.left-Gt.right,Kt=Ht[1]-Gt.top-Gt.bottom,Qt=r(()=>fe(C),[C]),Zt=null!=Ie?Ie:We,oo=i(null),no=i(null),[io,ro]=d(0),[so,ao]=d(null),lo=i(null),fo=i(null),[po,mo]=d(null),bo=i(bi.primary),xo=i([]),ko=i(Qe),wo=i(Ze);ko.current=Qe,wo.current=Ze;const[Ao,So]=d(!1),[Oo,jo]=d([]),[Co,_o]=d([]),Po="streaming"===j||["bar","swarm","waterfall"].includes(O),Mo=r(()=>{var e,t,o;return{chartType:O,runtimeMode:Po?"streaming":"bounded",windowSize:Y,windowMode:$,arrowOfTime:Po?z:"right",extentPadding:V,scalePadding:U,xAccessor:M,yAccessor:L,timeAccessor:Po?G:void 0,valueAccessor:F,colorAccessor:T,sizeAccessor:B,groupAccessor:D||(I?"_lineGroup":void 0),categoryAccessor:it,lineDataAccessor:I,xScaleType:bt,yScaleType:xt,xExtent:q,yExtent:X,sizeRange:K,binSize:E,normalize:H,baseline:R,stackOrder:W,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,gradientFill:!0===pe?{topOpacity:.8,bottomOpacity:.05}:!1===pe?void 0:pe,areaGroups:be?new Set(be):void 0,lineGradient:ye,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,lineStyle:ne,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:ae,colorScheme:ue,barColors:ce,barStyle:se,annotations:ze,decay:at,pulse:lt,transition:Wt,introAnimation:Et,staleness:dt,heatmapAggregation:ht,heatmapXBins:gt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,pointIdAccessor:mt,curve:N,themeCategorical:null===(e=null==Rt?void 0:Rt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Rt),themeSequential:null===(t=null==Rt?void 0:Rt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Rt?void 0:Rt.colors)||void 0===o?void 0:o.diverging,customLayout:jt,layoutConfig:Ct,layoutMargin:Gt}},[O,Y,$,z,V,U,M,L,G,F,bt,xt,T,B,D,it,I,q,X,K,E,H,R,W,de,he,ge,pe,ye,be,xe,we,Ae,Se,Oe,ne,ie,re,le,ae,se,ue,ce,ze,at,lt,null==Wt?void 0:Wt.duration,null==Wt?void 0:Wt.easing,Et,dt,ht,gt,ft,pt,yt,Po,mt,N,Rt,jt,Ct,Gt]),Lo=yn(Mo),To=i(null);To.current||(To.current=new Lt(Lo));const Bo=l(()=>{var e,t;const o=ko.current,n=wo.current;if(!n||!o)return;const i=gi(null!==(t=null===(e=To.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);fi(i,xo.current)||(xo.current=i,n(i))},[]);s(()=>{var e;null===(e=To.current)||void 0===e||e.updateConfig(Lo),Pt.current=!0,Yt()},[Lo,Yt]);const Do=i(null);Do.current||(Do.current=new me(e=>{const t=To.current;t&&t.ingest(e)&&(Pt.current=!0,Yt())},{chunkThreshold:_,chunkSize:P})),s(()=>{var e;null===(e=Do.current)||void 0===e||e.updateChunkOptions({chunkThreshold:_,chunkSize:P})},[_,P]);const Io=l(e=>{var t;null===(t=Do.current)||void 0===t||t.push(e)},[]),No=l(e=>{var t;null===(t=Do.current)||void 0===t||t.pushMany(e)},[]),Ho=l(()=>{var e,t;null===(e=Do.current)||void 0===e||e.clear(),null===(t=To.current)||void 0===t||t.clear(),Pt.current=!0,Yt()},[Yt]);p(a,()=>({push:Io,pushMany:No,remove:e=>{var t,o,n;null===(t=Do.current)||void 0===t||t.flush();const i=null!==(n=null===(o=To.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(lo.current&&i.some(e=>{var t;return e===(null===(t=lo.current)||void 0===t?void 0:t.data)})&&(lo.current=null,mo(null)),Pt.current=!0,Yt()),i},update:(e,t)=>{var o,n,i;null===(o=Do.current)||void 0===o||o.flush();const r=null!==(i=null===(n=To.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Pt.current=!0,Yt()),r},clear:Ho,getData:()=>{var e,t,o;return null===(e=Do.current)||void 0===e||e.flush(),null!==(o=null===(t=To.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=To.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=To.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Io,No,Ho,Yt]),s(()=>{var e,t;if(C){if(I&&Qt.length>0&&"object"==typeof Qt[0]&&null!==Qt[0]){const t="string"==typeof I?I:"coordinates";if(Array.isArray(Qt[0][t])){const o=[];for(const e of Qt){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=Do.current)||void 0===e||e.setBoundedData(o))}}null===(t=Do.current)||void 0===t||t.setBoundedData(Qt)}},[C,Qt,I]);const{hoverHandlerRef:Ro,hoverLeaveRef:Wo,onPointerMove:Eo,onPointerLeave:Fo}=Mt;Ro.current=e=>{var t,o,n;if(!Zt)return;const i=oo.current;if(!i)return;const r=i.getBoundingClientRect(),s=e.clientX-r.left-Gt.left,a=e.clientY-r.top-Gt.top;if(0>s||s>Ut||0>a||a>Kt)return void(lo.current&&(lo.current=null,fo.current=null,mo(null),He&&(He(null),Pt.current=!0),Yt()));const l=To.current;if(!l||0===l.scene.length)return;const c=eo(l.scene,s,a,Ee,l.quadtree,l.maxPointRadius),u="multi"===Fe,d=()=>{lo.current&&(lo.current=null,fo.current=null,mo(null),He&&He(null),Yt())};if(!c&&!u)return void d();const h=u||!c?s:c.x,g=u||!c?a:c.y;let f=li(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},h,g);if(u&&l.scene.length>0&&l.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=to(Jt(e.path,e.curve),t,o);if(null===r)continue;const s=co(e.path,t);n.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=Jt(e.topPath,e.curve),s=Jt(e.bottomPath,e.curve),a=to(r,t,o);if(null===a)continue;const l=to(s,t,o),c=co(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(l.scene,h,Math.max(Ee,Ut));if(e.length>0){const t=l.scales.y.invert,o=l.scales.x.invert,n=bo.current,i=o?o(h):h;if(c)f.xValue=i,f.xPx=h;else{const e={xValue:i};"string"==typeof M&&(e[M]=i),f=li(e,h,g,{xValue:i,xPx:h})}f.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:e.datum}})}}c||(null===(o=f.allSeries)||void 0===o?void 0:o.length)?(lo.current=f,fo.current=null!==(n=null==c?void 0:c.node)&&void 0!==n?n:null,mo(f),He&&(He(f),Pt.current=!0),Yt()):d()},Wo.current=()=>{lo.current&&(lo.current=null,fo.current=null,mo(null),He&&(He(null),Pt.current=!0),Yt())};const zo=i(()=>{});zo.current=e=>{if(!Re)return;const t=oo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Gt.left,i=e.clientY-o.top-Gt.top;if(0>n||n>Ut||0>i||i>Kt)return void Re(null);const r=To.current;if(!r||0===r.scene.length)return void Re(null);const s=eo(r.scene,n,i,Ee,r.quadtree,r.maxPointRadius);Re(s?li(s.datum||{},s.x,s.y):null)};const $o=l(e=>zo.current(e),[]),Yo=i(-1),Go=i(null),qo=i(null),Xo=l(e=>{const t=To.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(qo.current&&qo.current.version===o)n=qo.current.graph;else{const e=function(e){var t,o,n;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,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,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++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});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!==(n=r.group)&&void 0!==n?n:"_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;n=uo(e),qo.current={version:o,graph:n}}const i=Yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Yo.current=0;const t=n.flat[0];Go.current={shape:t.shape,w:t.w,h:t.h};const o=yo(t);return lo.current=o,mo(o),He&&He(o),void Yt()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Yo.current=-1,Go.current=null,lo.current=null,fo.current=null,mo(null),He&&He(null),void Yt();Yo.current=s;const a=n.flat[s];Go.current={shape:a.shape,w:a.w,h:a.h};const l=yo(a);lo.current=l,mo(l),He&&He(l),Yt()},[He,Yt]),Vo=l(e=>{Yo.current=-1,Go.current=null,Eo(e)},[Eo]);$t.current=()=>{var e,t;zt.current=0;const o=oo.current,n=no.current;if(!o||!n)return;const i=To.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(It.current?r+1e6:r),a=!It.current&&s,l=Pt.current||s;l&&!a&&(i.computeScene({width:Ut,height:Kt}),Bo());const c=Vn(),u=function(e){if(!e)return bi;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||bi.axisStroke,tickText:s||bi.tickText,crosshair:s?xi(s,"66"):bi.crosshair,hoverFill:c?xi(c,"4D"):bi.hoverFill,hoverStroke:s?xi(s,"99"):bi.hoverStroke,pointRing:c||bi.pointRing,primary:r||bi.primary}:bi}(o);bo.current=u.primary;const d=null!==(e=null==dt?void 0:dt.threshold)&&void 0!==e?e:5e3,h=dt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=Xn(o,Ht,Gt,c);if(e){if(e.clearRect(-Gt.left,-Gt.top,Ht[0],Ht[1]),h&&(e.globalAlpha=null!==(t=null==dt?void 0:dt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==oe&&!Je){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=oe||(t&&"transparent"!==t?t:null),i=n?qt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Gt.left,-Gt.top,Ht[0],Ht[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ut,Kt),e.clip()),tt&&i.scales)for(const t of tt)e.save(),t(e,i.scene,i.scales,{width:Ut,height:Kt}),e.restore();const n=jt?vi.custom:vi[O];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:Ut,height:Kt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Xn(n,Ht,Gt,c);if(e&&(e.clearRect(-Gt.left,-Gt.top,Ht[0],Ht[1]),Zt&&lo.current&&i.scales&&function(e,t,o,n,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,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,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 o=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 o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,lo.current,Ut,Kt,"object"==typeof Zt?Zt:{},fo.current,u),fo.current&&Array.isArray(Ie))){const t=Ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s=o.group;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,fo.current,t,u)}}l&&o&&o.setAttribute("aria-label",Sn(i.scene,O+" chart"));const g=Pt.current;if(Pt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!so||e(so.x.domain()[0])!==e(i.scales.x.domain()[0])||e(so.x.domain()[1])!==e(i.scales.x.domain()[1])||e(so.y.domain()[0])!==e(i.scales.y.domain()[0])||e(so.y.domain()[1])!==e(i.scales.y.domain()[1])||so.x.range()[0]!==i.scales.x.range()[0]||so.x.range()[1]!==i.scales.x.range()[1]||so.y.range()[0]!==i.scales.y.range()[0]||so.y.range()[1]!==i.scales.y.range()[1])&&ao(i.scales),vt){const e=i.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof L?L:e=>e[L||"y"];jo(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),_o(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&ze&&ze.length>0&&ro(e=>e+1),(null==dt?void 0:dt.showBadge)&&So(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(zt.current=requestAnimationFrame(()=>$t.current()))},pn({hydrated:Bt,wasHydratingFromSSR:Dt,storeRef:To,dirtyRef:Pt,renderFnRef:$t,cleanup:()=>{var e;return null===(e=Do.current)||void 0===e?void 0:e.clear()}}),s(()=>{Pt.current=!0,Yt()},[O,Ut,Kt,je,oe,ne,tt,Yt]),vo(dt,To,Pt,Yt,Ao,So);const Uo=r(()=>{if(Le||Be)return;const e=To.current;return(null==e?void 0:e.xIsDate)&&so?yi(so.x.domain()):void 0},[Le,Be,so]),Ko=Le||Be||Uo,Qo=Zt&&po?Ne?Ne(po):e(wi,{hover:po}):null,Zo=Qo?e(Fn,{x:po.x,y:po.y,containerWidth:Ut,containerHeight:Kt,margin:Gt,className:"stream-frame-tooltip",children:Qo}):null,Jo=Go.current,en=e(En,{active:Yo.current>=0,hoverPoint:po,margin:Gt,size:Ht,shape:null==Jo?void 0:Jo.shape,width:null==Jo?void 0:Jo.w,height:null==Jo?void 0:Jo.h}),on=(e,t,o,n)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null},nn=on(M,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),sn=on(L,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),cn=nn.key,dn=sn.key,hn=ze&&ze.length>0,gn=e=>{if(!e||!hn||!nn.fn&&!sn.fn)return e;let t=!1;const o=e.map(e=>{const o=nn.fn&&nn.key&&!(nn.key in e),n=sn.fn&&sn.key&&!(sn.key in e);if(!o&&!n)return e;t=!0;const i=Object.assign({},e);return o&&(i[nn.key]=nn.fn(e)),n&&(i[sn.key]=sn.fn(e)),i});return t?o:e};if(ln||!Bt&&Dt){const o=To.current;o&&C&&(o.ingest({inserts:Qt,bounded:!0}),o.computeScene({width:Ut,height:Kt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s=Ko||(()=>{if((null==o?void 0:o.xIsDate)&&r)return yi(r.x.domain())})();return t("div",{ref:Nt,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":wt||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1]},children:[e(Nn,{summary:At}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Vt}),t("g",{transform:`translate(${Gt.left},${Gt.top})`,children:[oe&&e("rect",{x:0,y:0,width:Ut,height:Kt,fill:oe}),ot&&r&&ot.map((t,o)=>e(n.Fragment,{children:t(i,r,{width:Ut,height:Kt})},"svgpre-"+o)),i.map((o,n)=>function(o,n,i){var r,s,a,l,c;switch(o.type){case"line":{const t=o;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-"+n)}case"area":{const c=o;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const o=`${i?i+"-":""}area-clip-${n}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:o,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:an(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${o})`})]},"area-"+n)}return e("path",{d:u,fill:an(c.style.fill),fillOpacity:null!==(l=null!==(a=c.style.fillOpacity)&&void 0!==a?a:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+n)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:an(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+n)}case"rect":{const t=o;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:an(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+n)}case"heatcell":{const i=o;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const o=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:o})]},"heatcell-"+n)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+n)}case"candlestick":{const i=o,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-"+n)}default:return null}}(o,n,_t)).filter(Boolean)]})]}),e(rn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:r,showAxes:je,axes:Ce,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:s,yFormat:Te||De,showGrid:Ye,title:nt,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,foregroundGraphics:Tt(Xt,null===(h=To.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:vt,xValues:[],yValues:[],annotations:ze,svgAnnotationRules:$e,annotationFrame:0,xAccessor:cn,yAccessor:dn,annotationData:gn(null==o?void 0:o.getData()),pointNodes:null==o?void 0:o.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,linkedCrosshairName:St,linkedCrosshairSourceId:Ot})]})}return t("div",{ref:Nt,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":wt||("string"==typeof nt?nt:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1],overflow:"visible"},onKeyDown:Xo,children:[kt&&e(Hn,{tableId:Ft}),kt&&e(Dn,{scene:null!==(y=null===(g=To.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:Ft,chartTitle:"string"==typeof nt?nt:void 0}),e(Nn,{summary:At}),t("div",{role:"img","aria-label":wt||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Zt?Vo:void 0,onMouseLeave:Zt?Fo:void 0,onClick:Re?$o:void 0,children:[Vt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ht[0],height:Ht[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Vt})}),e(tn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:so,showAxes:je,axes:Ce,showGrid:Ye,xFormat:Ko,yFormat:Te||De}),e("canvas",{ref:oo,"aria-label":Sn(null!==(m=null===(v=To.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:no,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Rn,{hoverPoint:po}),e(rn,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,scales:so,showAxes:je,axes:Ce,xLabel:_e,yLabel:Pe,yLabelRight:Me,xFormat:Ko,yFormat:Te||De,showGrid:Ye,title:nt,legend:Ge,legendHoverBehavior:qe,legendClickBehavior:Xe,legendHighlightedCategory:Ve,legendIsolatedCategories:Ue,legendPosition:Ke,foregroundGraphics:Tt(Xt,null===(b=To.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:vt,xValues:Oo,yValues:Co,annotations:ze,svgAnnotationRules:$e,annotationFrame:io,xAccessor:cn,yAccessor:dn,annotationData:gn(null===(x=To.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=To.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==oe&&!Je,linkedCrosshairName:St,linkedCrosshairSourceId:Ot}),(rt||st)&&e(ve,{width:Ut,height:Kt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Gt,dimension:null!==(w=null==rt?void 0:rt.dimension)&&void 0!==w?w:"xy",scales:so,onBrush:null!=st?st:()=>{},binSize:E,snap:null==rt?void 0:rt.snap,binBoundaries:null!==(A=null==rt?void 0:rt.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=To.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==rt?void 0:rt.snapDuring,streaming:"streaming"===j}),(null==dt?void 0:dt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===dt.badgePosition?{top:4,left:4}:"bottom-left"===dt.badgePosition?{bottom:4,left:4}:"bottom-right"===dt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ao?"#dc3545":"#28a745",color:"white"}),children:Ao?"STALE":"LIVE"}),en,Zo]})]})});Ai.displayName="StreamXYFrame";const Si=u(null);function Oi({colors:t,categories:o,colorScheme:n="category10",children:i}){const s=r(()=>{if(t)return t;if(o){const e=Array.isArray(n)?n:ht[n]||gt,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,n]);return e(Si.Provider,{value:s,children:i})}function ji(){return a(Si)}function Ci(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function _i(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Ci(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Pi(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Oi.displayName="CategoryColorProvider";const[Mi,Li]=be(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Pi(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Pi(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Ti,Bi]=be(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Di(e){const t=f(),o=e.clientId||t,{name:n}=e,i=Li(e=>e.selections.get(n)),s=Li(e=>e.setClause),a=Li(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?_i(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:l(()=>{a(n,o)},[a,n,o]),clientId:o}}function Ii(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Di({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}function Ni(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Hi(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=Di({name:t}),u=o&&n?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Ni(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Ni(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,o,n,a,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}function Ri(e,t,o){const n=Li(e=>e.selections.get(t));return r(()=>{if(!n||0===n.clauses.size)return e;const t=_i(n,o);return e.filter(t)},[e,n,o])}function Wi(e={}){const{limit:t=50,types:o,chartId:n}=e,i=Bi(e=>e.version),s=Bi(e=>e.observations),a=Bi(e=>e.clearObservations),l=r(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[s,o,n,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const Ei=u(!1),Fi=u(null),zi="undefined"==typeof window?s:h;function $i(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function Yi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function Gi(e){const t=a(Fi),o=f(),n=$i(e),r=i([]);Yi(r.current,n)||(r.current=n);const s=r.current;zi(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),zi(()=>{t&&t.registerCategories(o,s)},[t,o,s])}function qi({selections:e}){const t=Li(e=>e.setResolution);return s(()=>{for(const[o,n]of Object.entries(e))n.resolution&&t(o,n.resolution)},[e,t]),null}function Xi({categoryColors:t,interaction:o,selectionName:n,field:a}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=Ii({name:n,fields:[a]}),f=Di({name:n,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[v,m]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===o&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[o,p,a]);const k=l(e=>{"highlight"===o&&(e?(m(e.label),g.onHover({[a]:e.label})):(m(null),g.onHover(null)))},[o,a,g]),w=l(e=>{"isolate"===o&&y(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===u.length?new Set:o})},[o,u.length]),[A,[S]]=$n([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(So,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===o?k:void 0,customClickBehavior:"isolate"===o?w:void 0,highlightedCategory:v,isolatedCategories:p})})})}function Vi({children:o,selections:n,showLegend:s,legendPosition:a="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:u="category"}){const h=ji(),[g,f]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const o=$i(t);f(t=>{var n;return Yi(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),v=r(()=>{const e=[];for(const t of Object.values(g))for(const o of t)e.push(o);return $i(e)},[g]),m=r(()=>{var e;const t=null!=h?h:{},o=p.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of v)t[e]||o[e]||(o[e]=gt[n%gt.length],n++);const i=Object.assign({},t);for(const n of v)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[h,v]),b=void 0===s||s,x=b&&Object.keys(m).length>0;return e(Mi,{children:t(Ti,{children:[n&&e(qi,{selections:n}),e(Fi.Provider,{value:y,children:e(Oi,{colors:m,children:t(Ei.Provider,{value:x,children:[b&&"top"===a&&e(Xi,{categoryColors:m,interaction:l,selectionName:c,field:u}),o,b&&"bottom"===a&&e(Xi,{categoryColors:m,interaction:l,selectionName:c,field:u})]})})})]})})}function Ui({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(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?n(s,t,o):o?o(i):ft[r%ft.length];return{label:i+"",color:a}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:a,label:""}]}}function Ki(e){return e?"string"==typeof e?{name:e}:e:null}function Qi(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}const Zi={light:Se,dark:Oe,"high-contrast":je,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Ji(e){return Zi[e]}const er=n.createContext(void 0),tr="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function or(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Ji(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function nr({theme:e}){const t=Pe(e=>e.setTheme),o=Pe(e=>e.theme),i=n.useRef(o);i.current=o;const r=n.useRef(null);n.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=i.current===je?Se:i.current,t("high-contrast")),zn(o,e=>{var o,n;e.matches?(r.current=i.current===je?null!==(o=r.current)&&void 0!==o?o:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===je?"high-contrast":t)}(t,null!==(n=r.current)&&void 0!==n?n:Se),r.current=null)})},[e,t]);const s=n.useRef(!1);return tr(()=>{s.current?void 0!==e&&t(or(e)):s.current=!0},[e,t]),null}function ir({children:t}){var o,i,r,s,a;const l=Pe(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(o=l.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=n.useContext(er),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function rr({theme:o,children:i}){const r="string"==typeof o&&Ji(o)?o:void 0,s=n.useMemo(()=>function(e){return void 0!==e?Ce(Se,or(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?je:Se}(o),[o]);return e(_e,{initialState:{theme:s},children:t(er.Provider,{value:r,children:[e(nr,{theme:o}),e(ir,{children:i})]})})}function sr(){return Pe(e=>e.theme)}const ar="#007bff";function lr(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function cr(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function ur(){var e;const t=sr(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function dr(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=ht[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:ar}function hr(e,t,o){const n=ji(),i=ur();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=mt(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return mt(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=mt(e,t,s);return e=>n[e]||o(e)}return mt(e,t,s)}if(n&&Object.keys(n).length>0){const e=mt([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}function gr(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}function fr({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:i,chartType:a,chartId:c,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),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,o),v=Di({name:(null==e?void 0:e.name)||"__unused__"}),m=Ii({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Bi(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=d(null),A=g||o[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,k,A]),O=l(e=>{var o,n;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 o=lr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||($o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o})},Go())}(y.name||"hover",o,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&qo(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];w(null!=o?o+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const r=cr(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n: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,m,y,p,i,a,c,b,h,A]),j=l(e=>{var t,o,n,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 o=lr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);if(null==n?void 0:n.locked){const t=new Map($o.positions);return t.delete(e),$o={positions:t},Go(),!1}$o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Go()}(y.name||"hover",o,p)}if(e&&u){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),u(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const o=cr(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n: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,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Xo(e,p),qo(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:j,crosshairSourceId:p}}function pr(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function yr({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(Ei),d=null!==a(Fi),h=void 0!==n?n:!u&&!!t,g=!!t&&(h||d),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[c,t,e,g]);Gi(d&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=Ui({data:e,colorBy:t,colorScale:o,getColor:vt,categories:f}),i=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},l),e);return p&&("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},[l,s,p,i]);return{legend:p,margin:y,legendPosition:i}}function vr(e,t,o){const[n,i]=d(null),[s,a]=d(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=l(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const mr={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 br(e,t,o){var n,i,r,s,a,l,c;const u=mr[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.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:xr(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function xr(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function kr(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}const wr={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 Ar(e,t){return"function"==typeof t?t(e):e[t]}function Sr(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 Or(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=Ar(o,i);l=Sr(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Ar(o,n);c.push({label:t,value:Sr(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=Sr(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=Sr(o[e[0]],r))}}const u=Object.assign(Object.assign({},wr),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,o)=>t("div",{style:{marginTop:0===o&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},o))]})}}function jr(o={}){const{fields:n=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=o;return o=>{if(!o||"object"!=typeof o)return null;const u=[];if(i){const e=Ar(o,i);u.push({value:Sr(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Sr(Ar(o,n),i);u.push({label:l?t:void 0,value:s})}):Object.keys(o).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{u.push({label:l?e:void 0,value:Sr(o[e],r)})});const d=Object.assign(Object.assign({},wr),s);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:d,children:u.map((e,o)=>t("div",{style:{marginBottom:u.length-1>o?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},o))}):null}}function Cr(){return o=>{var n,i,r,s,a,l,c;const u=o.allSeries;if(!u||0===u.length){const t=null!==(i=null===(n=o.data)||void 0===n?void 0:n.value)&&void 0!==i?i:null===(r=o.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:wr,children:e("div",{children:Sr(t)})})}const d=null!==(l=null!==(s=o.xValue)&&void 0!==s?s:null===(a=o.data)||void 0===a?void 0:a.time)&&void 0!==l?l:null===(c=o.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:wr,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Sr(d)}),u.map((o,n)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:o.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Sr(o.value)})]},n))]})}}function _r(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t,r=o(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:wr,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Or(t):Or())}}function Pr(e){return"string"==typeof e?e:"value"}function Mr(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Lr(e,t){if(!t)return Mr(e);try{const o=t(e);return null==o?Mr(e):o}catch(t){return Mr(e)}}function Tr(e,t){return"function"==typeof t?t(e):e[t]}function Br(o){const n=o.find(e=>"title"===e.role),i=o.filter(e=>"title"!==e.role);return o=>{const r=o.data;if(!r)return null;const s=n?Lr(Tr(r,n.accessor),n.format):null;return t("div",{className:"semiotic-tooltip",style:wr,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((o,n)=>{const i=Lr(Tr(r,o.accessor),o.format);return t("div",{style:n>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[o.label,": "]}),e("span",{children:i})]},n)})]})}}function Dr({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=Tr(u,o),h=Tr(u,n),g=i?Tr(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:wr,children:[e("div",{style:{fontWeight:"bold"},children:Mr(d)}),e("div",{style:{marginTop:4},children:Lr(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||Pr(i),": ",Mr(g)]})]})}}function Ir({componentName:o,message:n,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:o}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),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 Nr extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e(Ir,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Hr;const Rr="undefined"!=typeof process&&"production"!==(null===(Hr=process.env)||void 0===Hr?void 0:Hr.NODE_ENV);function Wr({componentName:t,width:o,height:n,children:i}){return e(Nr,{fallback:i=>e(Ir,{componentName:t,message:i.message,width:o,height:n}),children:i})}const Er={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"},Fr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function zr(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Er),{width:o,height:n}),children:i||"No data available"}):null}function $r(t,o,n){if(!t)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return e("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Fr),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}function Yr(e,t,o,n){if(!Rr)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Gr(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function qr(e,t,o=3){let n,i=o+1;for(const o of t){const t=Gr(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}function Xr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Vr(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=qr(e,t,3))&&void 0!==o?o:null)}function Ur({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=Xr(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Vr(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Kr({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} 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}function Qr({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!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 o=Xr(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=Vr(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Zr(e){const t=Pe(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}function Jr(e){const{data:t,rawData:o,colorBy:n,colorScheme:i,legendInteraction:s,legendPosition:a,selection:c,linkedHover:u,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:A,width:S,height:O}=e,j=void 0===o,C=r(()=>fe(t),[t]),[_,P]=d([]),M=l(e=>{P(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:B,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:N}=fr({selection:c,linkedHover:u,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:L}),H=pr(u,N),R=hr(C,n,i),W=r(()=>{if(!n)return[];const e=new Set;for(const t of C){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[C,n]),E=r(()=>j&&_.length>0?_:W,[j,_,W]),F=vr(s,n,E),z=r(()=>B||(F.legendSelectionHook?F.legendSelectionHook:T),[B,F.legendSelectionHook,T]),$=Zr(c),Y=ur(),G=ji(),q=r(()=>{if(R)return R;if(!n||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Y&&Y.length>0?Y:ft,t="__streamCat",o=mt(E.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[R,n,E,i,Y,G]),{legend:X,margin:V,legendPosition:U}=yr({data:C,colorBy:n,colorScale:q,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:E}),K=r(()=>{const e={};return X&&(e.legend=X,e.legendPosition=U),s&&"none"!==s&&(e.legendHoverBehavior=F.onLegendHover,e.legendClickBehavior=F.onLegendClick,e.legendHighlightedCategory=F.highlightedCategory,e.legendIsolatedCategories=F.isolatedCategories),j&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=M),e},[X,U,s,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,j,n,M]),Q=Array.isArray(o)?fe(o):o,Z=$r(w,S,O),J=Z?null:zr(Q,S,O,A);return{data:C,colorScale:R,allCategories:E,legendState:F,effectiveSelectionHook:z,activeSelectionHook:T,customHoverBehavior:D,customClickBehavior:I,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:H,resolvedSelection:$}}function es(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{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.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},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:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function ts(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const os="__forecastSegment";let ns=null;function is(){return ts(this,void 0,void 0,function*(){return ns||(ns=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),ns})}const rs=g(function(t,o){var n,a;const c=i(null);es(o,{variant:"xy",frameRef:c});const u=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,xAccessor:v="x",yAccessor:m="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:k,colorScheme:w,curve:A="linear",showPoints:S=!1,pointRadius:O=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:_=2,lineGradient:P,tooltip:M,pointIdAccessor:L,annotations:T,directLabel:B,gapStrategy:D="break",anomaly:I,forecast:N,xExtent:H,yExtent:R,frameProps:W={},selection:E,linkedHover:F,onObservation:z,onClick:$,hoverHighlight:Y,hoverRadius:G,chartId:q,loading:X,emptyContent:V,legendInteraction:U,legendPosition:K,xScaleType:Q,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:oe}=t,{width:ne,height:ie,enableHover:re,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=u,pe=r(()=>fe(h),[h]);Yr("LineChart",pe,"xAccessor",v),Yr("LineChart",pe,"yAccessor",m);const ye="string"==typeof v?v:"__semiotic_resolvedX",ve="string"==typeof m?m:"__semiotic_resolvedY",[me,be]=d(null),[xe,ke]=d([]),we=r(()=>{if(!N&&!I)return pe;const e="function"==typeof v,t="function"==typeof m;return e||t?pe.map(o=>{const n=Object.assign({},o);return e&&(n.__semiotic_resolvedX=v(o)),t&&(n.__semiotic_resolvedY=m(o)),n}):pe},[pe,N,I,v,m]),Ae=i(N),Se=i(I);s(()=>{if(!N&&!I)return void((Ae.current||Se.current)&&(be(null),ke([]),Ae.current=N,Se.current=I));let e=!1;const t=N!==Ae.current||I!==Se.current;if(Ae.current=N,Se.current=I,t&&(be(null),ke([])),N){const t=b&&"string"==typeof b&&"object"==typeof N?Object.assign(Object.assign({},N),{_groupBy:b}):N;(function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).buildForecast(...e)})})(we,ye,ve,t,I).then(t=>{e||(be(t),ke(t.annotations))}).catch(()=>{e||(be(null),ke([]))})}else I&&function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).buildAnomalyAnnotations(...e)})}(I).then(t=>{e||(be(null),ke(t))}).catch(()=>{e||ke([])});return()=>{e=!0}},[we,N,I,ye,ve]);const Oe=me?me.processedData:pe,je="__compoundGroup",Ce=!(!N||!b),_e=Ce?je:N?os:b,Pe=r(()=>{if(!Ce)return Oe;const e="function"==typeof b?b:e=>e[b];return Oe.map(t=>{const o=Object.assign({},t);return o[je]=`${e(t)}__${t[os]||"observed"}`,o})},[Oe,Ce,b]),Me=Ce?Pe:Oe,Le=r(()=>{if(!N)return;const e=N.upperBounds,t=N.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=me?me.processedData:pe;for(const e of s){const t="function"==typeof m?m(e):+e[m];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[N,me,pe,m]),Te=l(e=>{const t="function"==typeof v?v(e):e[v],o="function"==typeof m?m(e):e[m];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[v,m]),Be=void 0!==(null===(n=Me[0])||void 0===n?void 0:n[x]),De=r(()=>{if(Be)return Me;if(_e){const e=Me.reduce((e,t)=>{const o="function"==typeof _e?_e(t):t[_e];if(!e[o]){const n={[x]:[]};"string"==typeof _e&&(n[_e]=o),Ce&&(n[os]=t[os],"string"==typeof b&&(n[b]=t[b])),e[o]=n}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:Me}]},[Me,_e,x,Be]),{gapProcessedLineData:Ie,hasGaps:Ne}=r(()=>{if("interpolate"===D){let e=!1;const t=[];for(const o of De){const n=(o[x]||[]).filter(t=>!Te(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[x]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===D){let e=!1;const t=[];for(const o of De){const n=o[x]||[];let i=[],r=0;const s=_e&&"string"==typeof _e?o[_e]:void 0;for(const a of n)if(Te(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[x]: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({},o),{[x]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===D){let e=!1;const t="string"==typeof m?m:"y",o=[];for(const n of De){const i=n[x]||[],r=[];for(const o of i)Te(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[x]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:De,hasGaps:!1}},[De,D,x,Te,_e,m]),He="object"==typeof B?B:{},Re=He.position||"end",We=He.fontSize||11,Ee=r(()=>{var e;if(!B||!k)return[];const t="function"==typeof k?k:e=>e[k],o=new Set;for(const n of Ie){const i=n[x]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Re?i[i.length-1]:i[0]))&&void 0!==e?e:t(n);if(null==r)continue;const s=r+"";""!==s&&o.add(s)}return Array.from(o)},[B,k,Ie,x,Re]),Fe=r(()=>{if(!B)return u.marginDefaults;const e=Ee.reduce((e,t)=>Math.max(e,t.length*(.6*We)),0),t=e+10,o="end"===Re?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[o]:Math.max(u.marginDefaults[o]||0,t)})},[B,Ee,We,Re,u.marginDefaults]),ze=Jr({data:Oe,rawData:h,colorBy:k,colorScheme:w,legendInteraction:U,legendPosition:K,selection:E,linkedHover:F,fallbackFields:k?["string"==typeof k?k:""]:[],unwrapData:!1,onObservation:z,onClick:$,hoverHighlight:Y,chartType:"LineChart",chartId:q,showLegend:(!B||void 0!==ae)&&ae,userMargin:g,marginDefaults:Fe,loading:X,emptyContent:V,width:ne,height:ie}),$e=ze.colorScale,Ye=ze.effectiveSelectionHook,Ge=ze.resolvedSelection,qe=ze.customHoverBehavior,Xe=ze.customClickBehavior,Ve=ze.crosshairProps,Ue=r(()=>(e,t)=>{const o={strokeWidth:_},n=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return k?$e&&(o.stroke=vt(e,k,$e),n&&(o.fill=o.stroke,o.fillOpacity=C)):(o.stroke=J||ar,n&&(o.fill=J||ar,o.fillOpacity=C)),o},[k,$e,_,j,C,J]),[Ke,Qe]=d(null);s(()=>{if(!N)return void Qe(null);let e=!1;return function(...e){return ts(this,void 0,void 0,function*(){return(yield is()).createSegmentLineStyle(...e)})}(Ue,N).then(t=>{e||Qe(()=>t)}).catch(()=>{e||Qe(null)}),()=>{e=!0}},[Ue,N]);const Ze=Ke||Ue,Je=r(()=>kr(Ze,{stroke:ee,strokeWidth:te,opacity:oe}),[Ze,ee,te,oe]),et=r(()=>Qi(Je,Ye,Ge),[Je,Ye,Ge]),tt=r(()=>{if(S)return e=>{const t={r:O,fillOpacity:1};return k?$e&&(t.fill=vt(e.parentLine||e,k,$e)):t.fill=J||ar,t}},[S,O,k,$e,J]),ot=Array.isArray(j)?"mixed":j?"area":"line",nt=r(()=>{var e;if(!B||!k)return[];const t="function"==typeof v?v:e=>e[v],o="function"==typeof m?m:e=>e[m],n="function"==typeof k?k:e=>e[k],i=new Map;for(const t of Ie){const o=t[x]||[];if(0===o.length)continue;const r="end"===Re?o[o.length-1]:o[0],s=null!==(e=n(r))&&void 0!==e?e:n(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,n])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(n),["string"==typeof m?m:"y"]:o(n),dx:"end"===Re?6:-6,dy:0,color:$e?$e(e):ar,fontSize:We}));r.sort((e,t)=>{const o="string"==typeof m?m:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof m?m:"y",o=r[e-1],n=r[e];We+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=We+2)}return r},[B,k,$e,Ie,x,v,m,Re,We]),it=ze.margin,rt=b||k,st=r(()=>Br([{label:he||Pr(v),accessor:v,role:"x",format:p},{label:ge||Pr(m),accessor:m,role:"y",format:y},...rt?[{label:Pr(rt),accessor:rt,role:"group"}]:[]]),[v,m,he,ge,rt,p,y]),at=Ur({componentName:"LineChart",data:Be?(null===(a=Oe[0])||void 0===a?void 0:a[x])||[]:h,accessors:{xAccessor:v,yAccessor:m}}),lt=r(()=>Be||_e||Ne?Ie.flatMap(e=>{const t=e[x]||[];return _e&&"string"==typeof _e?t.map(t=>Object.assign(Object.assign({},t),{[_e]:e[_e]})):t}):Me,[Ie,x,Be,_e,Me,Ne]),ct=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=G&&{hoverRadius:G}),null!=h&&{data:lt}),{xAccessor:v,yAccessor:m,xScaleType:Q,yScaleType:Z}),H&&{xExtent:H}),!R||null==R[0]&&null==R[1]?Le?{yExtent:Le}:{}:{yExtent:R}),{groupAccessor:"break"===D&&Ne?"_gapSegment":_e||void 0,curve:A,lineStyle:et}),S&&{pointStyle:tt}),{size:[ne,ie],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:it,showAxes:u.showAxes,xLabel:he,yLabel:ge,xFormat:p,yFormat:y,enableHover:re,showGrid:se}),ze.legendBehaviorProps),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===M?()=>null:"multi"===M?Cr():_r(M)||st}),"multi"===M&&{tooltipMode:"multi"}),(F||z||$||Y)&&{customHoverBehavior:qe}),(z||$||F)&&{customClickBehavior:Xe}),L&&{pointIdAccessor:L}),((null==T?void 0:T.length)||xe.length||nt.length)&&{annotations:[...T||[],...xe,...nt]}),Ve),W);return ze.earlyReturn?ze.earlyReturn:at?e(Ir,{componentName:"LineChart",message:at,width:ne,height:ie}):e(Wr,{componentName:"LineChart",width:ne,height:ie,children:e(Ai,Object.assign({ref:c},ct))})});function ss(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function as(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function ls(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:_r(t)||o}}rs.displayName="LineChart";const cs=g(function(t,o){var n;const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(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:g="x",yAccessor:f="y",areaBy:p,y0Accessor:y,gradientFill:v=!1,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:j=!1,pointRadius:C=3,tooltip:_,annotations:P,xExtent:M,yExtent:L,frameProps:T={},selection:B,linkedHover:D,onObservation:I,onClick:N,hoverHighlight:H,chartId:R,loading:W,emptyContent:E,legendInteraction:F,legendPosition:z,color:$,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=a,ie=r(()=>fe(l),[l]);Yr("AreaChart",ie,"xAccessor",g),Yr("AreaChart",ie,"yAccessor",f);const re=void 0!==(null===(n=ie[0])||void 0===n?void 0:n[m]),se=r(()=>{if(re)return ie;if(p){const e=ie.reduce((e,t)=>{const o="function"==typeof p?p(t):t[p];if(!e[o]){const t={[m]:[]};"string"==typeof p&&(t[p]=o),e[o]=t}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:ie}]},[ie,p,m,re]),ae=Jr({data:ie,rawData:l,colorBy:b,colorScheme:x,legendInteraction:F,legendPosition:z,selection:B,linkedHover:D,fallbackFields:b?["string"==typeof b?b:""]:[],unwrapData:!1,onObservation:I,onClick:N,hoverHighlight:H,chartType:"AreaChart",chartId:R,showLegend:Q,userMargin:c,marginDefaults:a.marginDefaults,loading:W,emptyContent:E,width:X,height:V}),le=r(()=>e=>{const t={};if(b){if(ae.colorScale){const o=vt(e,b,ae.colorScale);t.fill=o,S?(t.stroke=o,t.strokeWidth=O):t.stroke="none"}}else{const e=$||ar;t.fill=e,S?(t.stroke=e,t.strokeWidth=O):t.stroke="none"}return t.fillOpacity=w,t},[b,ae.colorScale,$,w,S,O]),ce=r(()=>kr(le,{stroke:Y,strokeWidth:G,opacity:q}),[le,Y,G,q]),ue=r(()=>Qi(ce,ae.effectiveSelectionHook,ae.resolvedSelection),[ce,ae.effectiveSelectionHook,ae.resolvedSelection]),de=r(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return b?ae.colorScale&&(t.fill=vt(e.parentLine||e,b,ae.colorScale)):t.fill=ar,t}},[j,C,b,ae.colorScale]),he=p||b,ge=r(()=>Br([{label:oe||Pr(g),accessor:g,role:"x",format:d},{label:ne||Pr(f),accessor:f,role:"y",format:h},...he?[{label:Pr(he),accessor:he,role:"group"}]:[]]),[g,f,oe,ne,he,d,h]),pe=Ur({componentName:"AreaChart",data:l,accessors:{xAccessor:g,yAccessor:f}}),ye=r(()=>re||p?se.flatMap(e=>{const t=e[m]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):ie,[se,m,re,p,ie]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ye}),{xAccessor:g,yAccessor:f,groupAccessor:p||void 0}),y&&{y0Accessor:y}),v&&{gradientFill:v}),A&&{lineGradient:A}),{curve:k,lineStyle:ue}),j&&de&&{pointStyle:de}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ne,xFormat:d,yFormat:h,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),ae.legendBehaviorProps),ss({title:Z,description:J,summary:ee,accessibleTable:te,className:u,animate:t.animate})),"multi"===_?{tooltipContent:Cr(),tooltipMode:"multi"}:ls({tooltip:_,defaultTooltipContent:ge})),as({linkedHover:D,onObservation:I,onClick:N,hoverHighlight:H,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),P&&P.length>0&&{annotations:P}),M&&{xExtent:M}),L&&{yExtent:L}),ae.crosshairProps),T);return ae.earlyReturn?ae.earlyReturn:pe?e(Ir,{componentName:"AreaChart",message:pe,width:X,height:V}):e(Wr,{componentName:"AreaChart",width:X,height:V,children:e(Ai,Object.assign({ref:s},ve))})});cs.displayName="AreaChart";const us=g(function(t,o){var n;const s=i(null),a=br(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:g="x",yAccessor:f="y",areaBy:p,lineDataAccessor:y="coordinates",colorBy:v,colorScheme:m,curve:b="monotoneX",areaOpacity:x=.7,showLine:k=!0,lineWidth:w=2,showPoints:A=!1,pointRadius:S=3,normalize:O=!1,baseline:j="zero",stackOrder:C,tooltip:_,annotations:P,xExtent:M,yExtent:L,frameProps:T={},selection:B,linkedHover:D,onObservation:I,onClick:N,hoverHighlight:H,chartId:R,loading:W,emptyContent:E,legendInteraction:F,legendPosition:z,color:$,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=a,ie=r(()=>fe(l),[l]),re=v||p;es(o,{variant:"xy",frameRef:s});const se=void 0!==(null===(n=ie[0])||void 0===n?void 0:n[y]),ae=r(()=>{if(se)return ie;if(p){const e=ie.reduce((e,t)=>{const o="function"==typeof p?p(t):t[p];if(!e[o]){const t={[y]:[]};"string"==typeof p&&(t[p]=o),e[o]=t}return e[o][y].push(t),e},{});return Object.values(e)}return[{[y]:ie}]},[ie,p,y,se]),le=Jr({data:ie,rawData:l,colorBy:re,colorScheme:m,legendInteraction:F,legendPosition:z,selection:B,linkedHover:D,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:I,onClick:N,hoverHighlight:H,chartType:"StackedAreaChart",chartId:R,showLegend:Q,userMargin:c,marginDefaults:a.marginDefaults,loading:W,emptyContent:E,width:X,height:V}),ce=r(()=>e=>{const t={};if(re&&le.colorScale){const o=vt(e,re,le.colorScale);t.fill=o,k?(t.stroke=o,t.strokeWidth=w):t.stroke="none"}else if(!re){const e=$||ar;t.fill=e,t.stroke=k?e:"none",k&&(t.strokeWidth=w)}return t.fillOpacity=x,t},[re,le.colorScale,x,k,w,$]),ue=r(()=>kr(ce,{stroke:Y,strokeWidth:G,opacity:q}),[ce,Y,G,q]),de=r(()=>Qi(ue,le.effectiveSelectionHook,le.resolvedSelection),[ue,le.effectiveSelectionHook,le.resolvedSelection]),he=r(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return re?le.colorScale&&(t.fill=vt(e.parentLine||e,re,le.colorScale)):t.fill=$||ar,t}},[A,S,re,le.colorScale,$]),ge=p||v,pe=r(()=>Br([{label:oe||Pr(g),accessor:g,role:"x",format:d},{label:ne||Pr(f),accessor:f,role:"y",format:h},...ge?[{label:Pr(ge),accessor:ge,role:"group"}]:[]]),[g,f,oe,ne,ge,d,h]),ye=Ur({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:g,yAccessor:f}}),ve=r(()=>se||p?ae.flatMap(e=>{const t=e[y]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):ie,[ae,y,se,p,ie]),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:ve}),{xAccessor:g,yAccessor:f,groupAccessor:p||void 0,curve:b,normalize:O,baseline:O?"zero":j,stackOrder:C,lineStyle:de}),A&&he&&{pointStyle:he}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ne,xFormat:d,yFormat:h,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),le.legendBehaviorProps),ss({title:Z,description:J,summary:ee,accessibleTable:te,className:u,animate:t.animate})),"multi"===_?{tooltipContent:Cr(),tooltipMode:"multi"}:ls({tooltip:_,defaultTooltipContent:pe})),as({linkedHover:D,onObservation:I,onClick:N,hoverHighlight:H,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),P&&P.length>0&&{annotations:P}),M&&{xExtent:M}),L&&{yExtent:L}),le.crosshairProps),T);return le.earlyReturn?le.earlyReturn:ye?e(Ir,{componentName:"StackedAreaChart",message:ye,width:X,height:V}):e(Wr,{componentName:"StackedAreaChart",width:X,height:V,children:e(Ai,Object.assign({ref:s},me))})});us.displayName="StackedAreaChart";const ds=g(function(t,o){const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:v,sizeBy:m,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,xExtent:j,yExtent:C,frameProps:_={},selection:P,linkedHover:M,linkedBrush:L,onObservation:T,onClick:B,hoverHighlight:D,chartId:I,loading:N,emptyContent:H,legendInteraction:R,legendPosition:W,color:E,stroke:F,strokeWidth:z,opacity:$}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=a,te=r(()=>fe(c),[c]),oe=Jr({data:te,rawData:c,colorBy:y,colorScheme:v,legendInteraction:R,legendPosition:W,selection:P,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:T,onClick:B,hoverHighlight:D,chartType:"Scatterplot",chartId:I,showLegend:V,userMargin:u,marginDefaults:a.marginDefaults,loading:N,emptyContent:H,width:Y,height:G}),ne=Ki(L),ie=Hi({name:(null==ne?void 0:ne.name)||"__unused_brush__",xField:(null==ne?void 0:ne.xField)||("string"==typeof f?f:void 0),yField:(null==ne?void 0:ne.yField)||("string"==typeof p?p:void 0)}),re=ne?"xyBrush"===ie.brushInteraction.brush?"xy":"xBrush"===ie.brushInteraction.brush?"x":"y":void 0,se=n.useRef(ie.brushInteraction);se.current=ie.brushInteraction;const ae=l(e=>{const t=se.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(oe.earlyReturn)return oe.earlyReturn;Yr("Scatterplot",te,"xAccessor",f),Yr("Scatterplot",te,"yAccessor",p);const le=r(()=>{if(!m||0===te.length)return;const e=te.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[te,m]),ce=r(()=>e=>{const t={fillOpacity:k};return y?oe.colorScale&&(t.fill=vt(e,y,oe.colorScale)):t.fill=E||ar,t.r=m?bt(e,m,b,le):x,t},[y,oe.colorScale,m,b,le,x,k,E]),ue=r(()=>kr(ce,{stroke:F,strokeWidth:z,opacity:$}),[ce,F,z,$]),de=r(()=>Qi(ue,oe.effectiveSelectionHook,oe.resolvedSelection),[ue,oe.effectiveSelectionHook,oe.resolvedSelection]),he=r(()=>Br([{label:J||Pr(f),accessor:f,role:"x",format:h},{label:ee||Pr(p),accessor:p,role:"y",format:g},...y?[{label:Pr(y),accessor:y,role:"color"}]:[],...m?[{label:Pr(m),accessor:m,role:"size"}]:[]]),[f,p,J,ee,y,m,h,g]),ge=Ur({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(ge)return e(Ir,{componentName:"Scatterplot",message:ge,width:Y,height:G});const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:te}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:m||void 0,sizeRange:b,pointStyle:de,colorScheme:v,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,showAxes:a.showAxes,xLabel:J,yLabel:ee,xFormat:h,yFormat:g,enableHover:q,showGrid:X}),oe.legendBehaviorProps),ss({title:U,description:K,summary:Q,accessibleTable:Z,className:d,animate:t.animate})),ls({tooltip:w,defaultTooltipContent:he})),as({linkedHover:M,onObservation:T,onClick:B,hoverHighlight:D,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),j&&{xExtent:j}),C&&{yExtent:C}),ne&&{brush:{dimension:re},onBrush:ae}),oe.crosshairProps),_);return e(Wr,{componentName:"Scatterplot",width:Y,height:G,children:e(Ai,Object.assign({ref:s},pe))})});function hs(e,t){return Je(1===t?.5:e/(t-1))}ds.displayName="Scatterplot";const gs=g(function(t,n){var s,a;const l=i(null);es(n,{variant:"xy",frameRef:l});const c=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:v,orderLabel:m,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,xExtent:A,yExtent:S,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,loading:T,emptyContent:B,legendInteraction:D,stroke:I,strokeWidth:N,opacity:H}=t,{width:R,height:W,enableHover:E,showGrid:F,title:z,description:$,summary:Y,accessibleTable:G,xLabel:q,yLabel:X}=c,V=u||[],{safeData:U,orderMap:K}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let o=V;if(v&&V.length>0){const e="function"==typeof v?v:e=>e[v];o=[...V].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[V,v,p,y]);Yr("ConnectedScatterplot",U,"xAccessor",p),Yr("ConnectedScatterplot",U,"yAccessor",y);const Q=Jr({data:U,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:D,selection:j,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:M,chartType:"ConnectedScatterplot",chartId:L,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:T,emptyContent:B,width:R,height:W}),Z=null!==(a=null===(s=Q.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==a?a:.5,J=r(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=Q.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=Q.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const o=s[t],n=s[t+1],d=hs(t,u),h=!a||!l||l(null!==(i=o.datum)&&void 0!==i?i:o)||l(null!==(r=n.datum)&&void 0!==r?r:n),g=a?h?1:Z:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,Q.effectiveSelectionHook,Z]),ee=r(()=>[J],[J]),te=r(()=>(t,n,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 o=a[t],n=a[t+1],i=hs(t,l),d="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,h="number"==typeof(null===(s=n.style)||void 0===s?void 0:s.opacity)?n.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(o,{children:u})},[b]),oe=r(()=>[te],[te]),ne=r(()=>e=>{var t,o;const n=K.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?hs(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,K]),ie=r(()=>kr(ne,{stroke:I,strokeWidth:N,opacity:H}),[ne,I,N,H]),re=r(()=>Qi(ie,Q.effectiveSelectionHook,Q.resolvedSelection),[ie,Q.effectiveSelectionHook,Q.resolvedSelection]),se=m||("string"==typeof v?v:"Order"),ae=r(()=>Br([{label:q||Pr(p),accessor:p,role:"x",format:g},{label:X||Pr(y),accessor:y,role:"y",format:f},...v?[{label:se,accessor:v,role:"group"}]:[]]),[p,y,q,X,v,se,g,f]),le=Ur({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:U}),{xAccessor:p,yAccessor:y,pointStyle:re,size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,showAxes:c.showAxes,xLabel:q,yLabel:X,xFormat:g,yFormat:f,enableHover:E,showGrid:F}),ss({title:z,description:$,summary:Y,accessibleTable:G,className:h,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:ae})),as({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ee,svgPreRenderers:oe}),w&&w.length>0&&{annotations:w}),A&&{xExtent:A}),S&&{yExtent:S}),Q.crosshairProps),O);return Q.earlyReturn?Q.earlyReturn:le?e(Ir,{componentName:"ConnectedScatterplot",message:le,width:R,height:W}):e(Wr,{componentName:"ConnectedScatterplot",width:R,height:W,children:e(Ai,Object.assign({ref:l},ce))})});gs.displayName="ConnectedScatterplot";const fs=g(function(t,o){const n=i(null),s=br(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:c,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",sizeBy:y,sizeRange:v=[5,40],colorBy:m,colorScheme:b,bubbleOpacity:x=.6,bubbleStrokeWidth:k=1,bubbleStrokeColor:w="white",tooltip:A,marginalGraphics:S,pointIdAccessor:O,annotations:j,xExtent:C,yExtent:_,frameProps:P={},selection:M,linkedHover:L,linkedBrush:T,onObservation:B,onClick:D,hoverHighlight:I,chartId:N,loading:H,emptyContent:R,legendInteraction:W,legendPosition:E,color:F,stroke:z,strokeWidth:$,opacity:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,oe=r(()=>fe(a),[a]),ne=void 0===a,ie=Jr({data:oe,rawData:a,colorBy:m,colorScheme:b,legendInteraction:W,legendPosition:E,selection:M,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:I,chartType:"BubbleChart",chartId:N,showLegend:U,userMargin:c,marginDefaults:s.marginDefaults,loading:H,emptyContent:R,width:G,height:q}),re=i(null),[se,ae]=d(0),le=l(e=>{if(!ne)return;let t=!1;for(const o of e){const e="function"==typeof y?y(o):o[y];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)},[ne,y]),ce=l(e=>{var t;le([e]),null===(t=n.current)||void 0===t||t.push(e)},[le]),ue=l(e=>{var t;le(e),null===(t=n.current)||void 0===t||t.pushMany(e)},[le]);es(o,{variant:"xy",frameRef:n,overrides:{push:ce,pushMany:ue,clear:()=>{var e;re.current=null,ae(e=>e+1),null===(e=n.current)||void 0===e||e.clear()}},deps:[ce,ue]});const de=Ki(T);Hi({name:(null==de?void 0:de.name)||"__unused_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof f?f:void 0),yField:(null==de?void 0:de.yField)||("string"==typeof p?p:void 0)});const he=r(()=>{if(ne)return re.current||[0,1];const e=oe.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[oe,y,ne,se]),ge=r(()=>e=>{const t={fillOpacity:x,strokeWidth:k,stroke:w};return m?ie.colorScale&&(t.fill=vt(e,m,ie.colorScale)):t.fill=F||ar,t.r=bt(e,y,v,he),t},[m,ie.colorScale,y,v,he,x,k,w,F]),pe=r(()=>kr(ge,{stroke:z,strokeWidth:$,opacity:Y}),[ge,z,$,Y]),ye=r(()=>Qi(pe,ie.effectiveSelectionHook,ie.resolvedSelection),[pe,ie.effectiveSelectionHook,ie.resolvedSelection]),ve=r(()=>Br([{label:ee||Pr(f),accessor:f,role:"x",format:h},{label:te||Pr(p),accessor:p,role:"y",format:g},{label:Pr(y),accessor:y,role:"size"},...m?[{label:Pr(m),accessor:m,role:"color"}]:[]]),[f,p,ee,te,y,m,h,g]),me=Ur({componentName:"BubbleChart",data:a,accessors:{xAccessor:f,yAccessor:p},requiredProps:{sizeBy:y}});if(me)return e(Ir,{componentName:"BubbleChart",message:me,width:G,height:q});const be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=a&&{data:oe}),{xAccessor:f,yAccessor:p,colorAccessor:m||void 0,sizeAccessor:y,sizeRange:v,pointStyle:ye,colorScheme:b,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:h,yFormat:g,enableHover:X,showGrid:V}),ie.legendBehaviorProps),ss({title:K,description:Q,summary:Z,accessibleTable:J,className:u,animate:t.animate})),ls({tooltip:A,defaultTooltipContent:ve})),as({linkedHover:L,onObservation:B,onClick:D,hoverHighlight:I,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),S&&{marginalGraphics:S}),O&&{pointIdAccessor:O}),j&&j.length>0&&{annotations:j}),C&&{xExtent:C}),_&&{yExtent:_}),ie.crosshairProps),P);return ie.earlyReturn?ie.earlyReturn:e(Wr,{componentName:"BubbleChart",width:G,height:q,children:e(Ai,Object.assign({ref:n},be))})});fs.displayName="BubbleChart";const ps=g(function(t,o){var n;const s=i(null);es(o,{variant:"xy",frameRef:s});const a=br(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:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:v,showValues:m=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,loading:T,emptyContent:B,showLegend:D,legendPosition:I,legendInteraction:N}=t,{width:H,height:R,enableHover:W,title:E,description:F,summary:z,accessibleTable:$,xLabel:Y,yLabel:G}=a,q=$r(T,H,R),X=q?null:zr(l,H,R,B),V=r(()=>fe(l),[l]),U=function(){var e;const t=sr();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),K=null!==(n=null!=y?y:U)&&void 0!==n?n:"blues",Q=null!=D&&D,Z=null!=I?I:"right",{margin:J}=yr({data:V,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=fr({selection:j,linkedHover:C,fallbackFields:[],onObservation:_,onClick:P,chartType:"Heatmap",chartId:L,hoverHighlight:M,colorByField:void 0});Zr(j);const ne=pr(C,oe);vr(N,void 0,[]);const ie=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),re=r(()=>{const e=V.map(ie);return[Math.min(...e),Math.max(...e)]},[V,ie]),se=r(()=>"custom"===K&&v?v:S({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it}[K]||Xe).domain(re),[K,v,re]),ae=r(()=>Br([{label:Y||Pr(d),accessor:d,role:"x",format:f},{label:G||Pr(h),accessor:h,role:"y",format:p},{label:Pr(g),accessor:g,role:"value",format:b}]),[d,h,Y,G,g,f,p,b]),le=Ur({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ce=r(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:re,label:"string"==typeof g?g:"value",format:b}}},[Q,se,re,g,b]),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({chartType:"heatmap"},null!=l&&{data:V}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==K?K:void 0,showValues:m,heatmapValueFormat:b,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,showAxes:a.showAxes,xLabel:Y,yLabel:G,xFormat:f,yFormat:p,enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ce&&{legend:ce,legendPosition:Z}),ss({title:E,description:F,summary:z,accessibleTable:$,className:u,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:ae})),as({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,customHoverBehavior:ee,customClickBehavior:te})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ne),O);return q||X||(le?e(Ir,{componentName:"Heatmap",message:le,width:H,height:R}):e(Wr,{componentName:"Heatmap",width:H,height:R,children:e(Ai,Object.assign({ref:s},ue))}))});ps.displayName="Heatmap";const ys="__splomIdx",vs={top:4,bottom:4,left:4,right:4};function ms({frameRef:t,cellSize:o,onBrush:n}){const r=i(null),a=o-vs.left-vs.right,l=o-vs.top-vs.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),o=b().extent([[0,0],[a,l]]).on("brush end",e=>{var o;const i=null===(o=t.current)||void 0===o?void 0:o.getScales();if(!i)return;if(!e.selection)return void n(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)]];n(c)});return e.call(o),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[a,l,t,n]),e("svg",{ref:r,width:o,height:o,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${vs.left},${vs.top})`})})}function bs({data:o,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const v=i(null),m=Di({name:h,clientId:`splom-${n}-${r}`}),b=Hi({name:h,xField:n,yField:r}),x=Di({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,o=null==t?void 0:t[ys];void 0!==o&&(k({[ys]:[o]}),null==y||y(t,e.x+vs.left,e.y+vs.top))},[k,y]),S=l(e=>{const t={opacity:c,r:a};return t.fill=u?vt(e,u,d):ar,"hover"===p?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*c):m.isActive&&!m.predicate(e)&&(t.opacity=f),t},[u,d,c,a,p,m.isActive,m.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Ai,{ref:v,chartType:"scatter",data:o,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:S,margin:vs,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(ms,{frameRef:v,cellSize:s,xField:n,yField:r,onBrush:w})]})}function xs({data:o,field:n,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Di({name:u,clientId:"splom-diag-"+n}),f=Di({name:d,clientId:`splom-diag-${n}-hover`}),p="hover"===h?f:g,y=p.isActive,v=p.predicate,m=r(()=>{const e=o.map(e=>e[n]).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(o.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)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const s=Math.min(Math.floor((o-t)/i),a-1);if(d[s]++,y&&!v(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!v(e)||f[s][t]++)}}const p=Math.max(...d,1),m=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})});return{bars:d.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:m,selectedCategoryBars:b,max:p,categories:c}},[o,n,a,s,y,v,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}),m.categories.length>0?m.categoryBars.map((t,o)=>t.map((t,n)=>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):ar,opacity:y?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ar,opacity:y?.3:.6},"bg-"+o)),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>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):ar,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ar,opacity:.7},"sel-"+o)))]})}function ks({label:t,cellSize:o}){return e("svg",{width:o,height:o,children:e("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function ws(o){const{data:i,fields:s,fieldLabels:a={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:v=20,brushMode:m="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:j,chartId:C}=o,_="splom",P="splom-hover",M=b?"hover":m?"brush":"hover",L=Li(e=>e.clearSelection),[T,B]=d(null),D=l(()=>{L(P),B(null)},[L,P]),I=r(()=>(i||[]).map((e,t)=>void 0!==e[ys]?e:Object.assign(Object.assign({},e),{[ys]:t})),[i]),N=hr(I,c,u),H=void 0!==A?A:!!c,R=r(()=>{if(!H||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(I.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):ar})):null},[H,c,I,N]),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:O,style:{position:"relative"},children:[R&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:R.map(o=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:o.color}}),e("span",{style:{fontSize:11},children:o.label})]},o.label))}),t("div",{style:W,onMouseLeave:"hover"===M?D:void 0,children:[s.map((o,i)=>t(n.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[o]||o}),s.map((t,n)=>i===n?"label"===y?e(ks,{label:a[o]||o,cellSize:h},"diag-"+o):e(xs,{data:I,field:o,label:a[o]||o,cellSize:h,bins:v,colorBy:c,colorScale:N,brushSelectionName:_,hoverSelectionName:P,unselectedOpacity:x,mode:M},"diag-"+o):e(bs,{data:I,xField:t,yField:o,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:N,brushSelectionName:_,hoverSelectionName:P,unselectedOpacity:x,showGrid:k,tooltip:w,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(B({datum:e,xField:t,yField:o,colIndex:n,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})):(B(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C}))}:void 0},`cell-${o}-${t}`))]},"row-"+o)),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))]}),T&&"hover"===M&&(()=>{const o=T.datum,n=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=c?"function"==typeof c?c(o):o[c]:null,s=S?"function"==typeof S?S(o):o[S]:"Row "+o[ys];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.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:[n,": ",null!=o[T.xField]?Number(o[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=o[T.yField]?Number(o[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function As(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e(Vi,{selections:i,children:e(ws,Object.assign({},t))})}function Ss({width:t,height:o,margin:n,scales:r,brushDirection:a,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+n.left+n.right,f=o+n.top+n.bottom;return s(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),n="x"===a?v().extent([[0,0],[t,o]]):m().extent([[0,0],[t,o]]);return n.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?r.x:r.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[r,t,o,a,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(d.current.move,o)}else e.call(d.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function Os(o){var n,a;const{data:c,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:v,xLabel:m,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:j,colorScheme:C,curve:_="linear",lineWidth:P=2,fillArea:M=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:B=3,enableHover:D=!0,showGrid:I=!1,showLegend:N,legendPosition:H,tooltip:R,minimap:W={},renderBefore:E=!1,onBrush:F,brushExtent:z,yExtent:$,frameProps:Y={},loading:G,emptyContent:q}=o,X=$r(G,u,h),V=X?null:zr(c,u,h,q),U=r(()=>fe(c),[c]),[K,Q]=d(null),Z=null!=z?z:K,J=l(e=>{z||Q(e),null==F||F(e)},[z,F]),ee=i(null),[te,oe]=d(null);s(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=ee.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?oe(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ne=void 0!==(null===(n=U[0])||void 0===n?void 0:n[O]),ie=r(()=>{if(ne)return U;if(S){const e=U.reduce((e,t)=>{const o="function"==typeof S?S(t):t[S];if(!e[o]){const t={[O]:[]};"string"==typeof S&&(t[S]=o),e[o]=t}return e[o][O].push(t),e},{});return Object.values(e)}return[{[O]:U}]},[U,S,O,ne]),re=r(()=>ne||S?ie.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):U,[ie,O,ne,S,U]),se=hr(U,j,C),ae=r(()=>e=>{const t={strokeWidth:P};return t.stroke=j?vt(e,j,se):ar,M&&(t.fill=t.stroke,t.fillOpacity=L),t},[j,se,P,M,L]),le=r(()=>W.lineStyle?W.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=j?vt(e,j,se):ar,t},[j,se,W.lineStyle]),ce=r(()=>{if(T)return e=>{const t={r:B,fillOpacity:1};return t.fill=j?vt(e.parentLine||e,j,se):ar,t}},[T,B,j,se]),{legend:ue,margin:de,legendPosition:he}=yr({data:ie,colorBy:j,colorScale:se,showLegend:N,legendPosition:H,userMargin:g}),ge=W.height||60,pe=r(()=>{var e,t,o,n,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!==(n=null===(o=W.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=W.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:de.left,right:null!==(a=null===(s=W.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:de.right}},[W.margin,de]),ye=W.brushDirection||"x",ve=Ur({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(ve)return e(Ir,{componentName:"MinimapChart",message:ve,width:u,height:h});const me=M?"area":"line",be=r(()=>Br([{label:m||Pr(w),accessor:w,role:"x",format:x},{label:b||Pr(A),accessor:A,role:"y",format:k}]),[w,A,m,b,x,k]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:me,data:re,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:_,lineStyle:ae},T&&{pointStyle:ce}),{size:[u,h],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:de,showAxes:!0,xLabel:m,yLabel:b,xFormat:x,yFormat:k,enableHover:D,showGrid:I}),ue&&{legend:ue,legendPosition:he}),p&&{title:p}),y&&{description:y}),v&&{summary:v}),{tooltipContent:!1===R?()=>null:_r(R)||be}),Z&&{xExtent:Z}),$&&{yExtent:$}),Y),ke=Object.assign({chartType:me,data:re,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:_,lineStyle:le,size:[u,ge+pe.top+pe.bottom],margin:pe,showAxes:null!==(a=W.showAxes)&&void 0!==a&&a,background:W.background,enableHover:!1},$&&{yExtent:$}),we=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Ai,Object.assign({ref:ee},ke)),e(Ss,{width:u-pe.left-pe.right,height:ge,margin:pe,scales:te,brushDirection:ye,extent:Z,onBrush:J})]},"minimap"),Ae=e("div",{style:{overflow:"hidden"},children:e(Ai,Object.assign({},xe))},"main");return X||V||e(Wr,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[E?we:Ae,E?Ae:we]})})}As.displayName="ScatterplotMatrix",Os.displayName="MinimapChart";const js=g(function(n,s){const a=i(null);es(s,{variant:"xy",frameRef:a});const l=br(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:v,quadrants:m,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:j=5,pointOpacity:C=.8,tooltip:_,pointIdAccessor:P,annotations:M,frameProps:L={},selection:T,linkedHover:B,onObservation:D,onClick:I,hoverHighlight:N,chartId:H,loading:R,emptyContent:W,legendInteraction:E,legendPosition:F,color:z,stroke:$,strokeWidth:Y,opacity:G}=n,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=l,ne=r(()=>fe(c),[c]),ie=Jr({data:ne,rawData:c,colorBy:w,colorScheme:A,legendInteraction:E,legendPosition:F,selection:T,linkedHover:B,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:N,chartType:"QuadrantChart",chartId:H,showLegend:K,userMargin:u,marginDefaults:l.marginDefaults,loading:R,emptyContent:W,width:q,height:X});Yr("QuadrantChart",ne,"xAccessor",f),Yr("QuadrantChart",ne,"yAccessor",p);const re=r(()=>{if(!ne.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(o>y&&(o=y),y>n&&(n=y)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[ne,f,p,y,v]),se=r(()=>{if(!S||0===ne.length)return;const e=ne.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},[ne,S]),ae=r(()=>"function"==typeof f?f:e=>+e[f],[f]),le=r(()=>"function"==typeof p?p:e=>+e[p],[p]),ce=r(()=>e=>{const t={fillOpacity:C};if(w)ie.colorScale&&(t.fill=vt(e,w,ie.colorScale));else{const o=ae(e),n=le(e),i=null!=y?o>=y:void 0,r=null!=v?n>=v:void 0;t.fill=void 0===r||void 0===i?z||ar:r&&i?m.topRight.color:r&&!i?m.topLeft.color:!r&&i?m.bottomRight.color:m.bottomLeft.color}return t.r=S?bt(e,S,O,se):j,t},[w,ie.colorScale,S,O,se,j,C,ae,le,y,v,m,z]),ue=r(()=>kr(ce,{stroke:$,strokeWidth:Y,opacity:G}),[ce,$,Y,G]),de=r(()=>Qi(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=r(()=>{if(!ne.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,f,p,w,S]),ge=r(()=>Br([...he?[{label:he,accessor:he,role:"title"}]:[],{label:te||Pr(f),accessor:f,role:"x",format:h},{label:oe||Pr(p),accessor:p,role:"y",format:g},...w?[{label:Pr(w),accessor:w,role:"color"}]:[],...S?[{label:Pr(S),accessor:S,role:"size"}]:[]]),[he,f,p,te,oe,w,S,h,g]),pe=Ur({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ye=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=y?n.x(y):s/2,c=null!=v?n.y(v):a/2;if(null!=y&&!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:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:s-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:a-d},{config:m.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([])}]},[y,v,m,b]),ve=r(()=>x?[...ye,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=y?o.x(y):i/2,a=null!=v?o.y(v):r/2;(null==y||isFinite(s))&&(null==v||isFinite(a))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,i-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,r-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ye,[ye,x,k,m,y,v]),me=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),be=r(()=>{var n;const i={stroke:b.stroke||"#999",strokeWidth:null!==(n=b.strokeWidth)&&void 0!==n?n:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(n,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!=y?r.x(y):a/2,u=null!=v?r.y(v):l/2;if(null!=y&&!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(o,{children:[[{config:m.topLeft,x:0,y:0,w:d,h:h},{config:m.topRight,x:d,y:0,w:a-d,h:h},{config:m.bottomLeft,x:0,y:h,w:d,h:l-h},{config:m.bottomRight,x:d,y:h,w:a-d,h:l-h}].map((t,o)=>{var n;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!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):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}),x&&t(o,{children:[e("text",{x:8,y:8+k,fill:m.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.topLeft.label}),e("text",{x:a-8,y:8+k,fill:m.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.topRight.label}),e("text",{x:8,y:l-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:m.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.bottomRight.label})]})]})}]},[y,v,m,b,x,k]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:ne}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:de,colorScheme:A,size:[q,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:l.showAxes,xLabel:te,yLabel:oe,xFormat:h,yFormat:g,enableHover:V,showGrid:U}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),Q&&{title:Q}),Z&&{description:Z}),J&&{summary:J}),void 0!==ee&&{accessibleTable:ee}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?ge:_r(_)||ge}),(B||D||I||N)&&{customHoverBehavior:ie.customHoverBehavior}),(D||I||B)&&{customClickBehavior:ie.customClickBehavior}),P&&{pointIdAccessor:P}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:me}),ie.crosshairProps),L),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:be});return ie.earlyReturn?ie.earlyReturn:pe?e(Ir,{componentName:"QuadrantChart",message:pe,width:q,height:X}):e(Wr,{componentName:"QuadrantChart",width:q,height:X,children:e(Ai,Object.assign({ref:a},xe))})});js.displayName="QuadrantChart";const Cs="__ma_unitized",_s="__ma_series";function Ps(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Ms(e,t){return t[0]+e*(t[1]-t[0])}const Ls=g(function(t,o){var s;const a=i(null),l=i([]),c=i(t.series);c.current=t.series,p(o,()=>{const e=()=>{var e;return(null!==(e=c.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!a.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||l.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=r&&isFinite(r)&&a.current.push(Object.assign(Object.assign({},n),{[Cs]:Ps(r,i),[_s]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!a.current)return;const o=e(),n=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const i=o[t],r=i.extent||l.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},e),{[Cs]:Ps(s,r),[_s]:i.label||"Series "+(t+1)}))}a.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},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 u=br(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:g,xFormat:f,xAccessor:y="x",series:v,colorScheme:m,curve:b="monotoneX",lineWidth:x=2,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,stroke:D,strokeWidth:I,opacity:N}=t,{width:H,height:R,enableHover:W,showGrid:E,showLegend:F=!0,title:z,description:$,summary:Y,accessibleTable:G,xLabel:q}=u,X=r(()=>fe(d),[d]),V=r(()=>fe(v),[v]),U=V,K=2===V.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||K||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const Q=$r(M,H,R),Z=Q?null:zr(d,H,R,L),J=ur(),ee=r(()=>{let e;if(Array.isArray(m))e=m;else if(J&&J.length>0)e=J;else{const t=ht[m];e=Array.isArray(t)?t:gt}return U.map((t,o)=>t.color||e[o%e.length])},[U,m,J]),te=r(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:oe,extents:ne}=r(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(l.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(X,e.yAccessor));if(l.current=e,!K){const t=[];for(const e of X)for(let o=0;V.length>o;o++){const n=V[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Cs]:i,[_s]:te[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of X)for(let n=0;2>n;n++){const i=V[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[Cs]:Ps(r,e[n]),[_s]:te[n]}))}return{unitizedData:t,extents:e}},[X,V,K,te]),ie=r(()=>{if(K&&ne.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=Ms(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=Ms(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[K,ne,V,te]),re=Jr({data:r(()=>oe.length>0?oe:te.map(e=>({[_s]:e})),[oe,te]),rawData:d,colorBy:_s,colorScheme:ee,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:[_s],unwrapData:!1,onObservation:j,onClick:C,hoverHighlight:_,chartType:"MultiAxisLineChart",chartId:P,showLegend:F,userMargin:h,marginDefaults:K?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:M,emptyContent:L,width:H,height:R});if(re.earlyReturn)return re.earlyReturn;const se=r(()=>{const e=new Map;return te.forEach((t,o)=>e.set(t,ee[o])),t=>({stroke:e.get(t[_s])||ee[0],strokeWidth:x,fill:"none"})},[te,ee,x]),ae=r(()=>kr(se,{stroke:D,strokeWidth:I,opacity:N}),[se,D,I,N]),le=r(()=>Qi(ae,re.effectiveSelectionHook,re.resolvedSelection),[ae,re.effectiveSelectionHook,re.resolvedSelection]),ce=r(()=>{if(!1===k)return()=>null;return _r(k)||(e=>{var t;const o=e.data||e,i=o[_s],r=te.indexOf(i),s=o[Cs],a=K&&r>=0&&ne[r]?Ms(s,ne[r]):s,l=r>=0&&(null===(t=V[r])||void 0===t?void 0:t.format)?V[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return n.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},n.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[r]||"inherit"}},i),n.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),n.createElement("div",null,`${i}: ${l(a)}`))})},[k,te,ee,ne,K,V,y]),ue=Ur({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),de=K?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:oe}),{xAccessor:y,yAccessor:Cs,groupAccessor:_s,lineStyle:le,colorScheme:ee,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:u.showAxes}),ie&&{axes:ie}),{xLabel:q}),K?{}:{yLabel:te[0]}),{xFormat:f}),K&&de&&{yExtent:de}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:E,curve:b}),re.legendBehaviorProps),z&&{title:z}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),{tooltipContent:ce}),w&&{annotations:w}),(O||j||C||_)&&{customHoverBehavior:re.customHoverBehavior}),(j||C||O)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),A);return Q||Z||(ue?e(Ir,{componentName:"MultiAxisLineChart",message:ue,width:H,height:R}):e(Wr,{componentName:"MultiAxisLineChart",width:H,height:R,children:e(Ai,Object.assign({ref:a},he))}))});Ls.displayName="MultiAxisLineChart";const Ts=g(function(t,o){const n=i(null);es(o,{variant:"xy",frameRef:n});const s=br(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:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:v,tooltip:m,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:j,chartId:C,loading:_,emptyContent:P}=t,{width:M,height:L,enableHover:T,showGrid:B,title:D,description:I,summary:N,accessibleTable:H,xLabel:R,yLabel:W}=s,E=$r(_,M,L),F=E?null:zr(a,M,L,P),z=r(()=>fe(a),[a]),$=null==p||null==y;Yr("CandlestickChart",z,"xAccessor",h),Yr("CandlestickChart",z,"highAccessor",g),Yr("CandlestickChart",z,"lowAccessor",f),$||(Yr("CandlestickChart",z,"openAccessor",p),Yr("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:Y,customClickBehavior:G,crosshairSourceId:q}=fr({selection:A,linkedHover:S,onObservation:O,onClick:j,chartType:"CandlestickChart",chartId:C}),X=pr(S,q),V=r(()=>{const e=s.marginDefaults,o="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?o:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},o),l)},[l,s.marginDefaults,t.mode]),U=r(()=>{const e=[{label:R||Pr(h),accessor:h,role:"x",format:u}];return $?(e.push({label:"High",accessor:g,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:g,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:y,format:d})),Br(e)},[h,R,u,d,g,f,p,y,$]),K=Ur({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!$&&{openAccessor:p,closeAccessor:y})}),Q=Math.max(2,Math.min(12,Math.round(M/40))),Z=M>200?.1:.02,J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=a&&{data:z}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!$&&{openAccessor:p,closeAccessor:y}),v&&{candlestickStyle:v}),{scalePadding:Q,extentPadding:Z,size:[M,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,showAxes:s.showAxes,xLabel:R,yLabel:W,xFormat:u,yFormat:d,enableHover:T,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ss({title:D,description:I,summary:N,accessibleTable:H,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:U})),as({linkedHover:S,onObservation:O,onClick:j,customHoverBehavior:Y,customClickBehavior:G})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),X),w);return E||F||(K?e(Ir,{componentName:"CandlestickChart",message:K,width:M,height:L}):e(Wr,{componentName:"CandlestickChart",width:M,height:L,children:e(Ai,Object.assign({ref:n},J))}))});function Bs(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function Ds(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=z(e,.25))&&void 0!==t?t:r,median:null!==(o=z(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=z(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function Is(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function Ns(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}Ts.displayName="CandlestickChart";const Hs={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(He(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(He(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(He(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(He(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Bs,donut:Bs,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(o=z(l,.25))&&void 0!==o?o:c,m=null!==(n=z(l,.5))&&void 0!==n?n:(c+u)/2,b=null!==(i=z(l,.75))&&void 0!==i?i:u,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:u,O=h(t.pieceData[0],t.name),j=[];if(v)for(const e of t.pieceData){const o=d(e);if(k>o||o>w){const n=y?t.middle:g(o),i=y?g(o):t.middle;j.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:j}),v)for(const t of j)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...d,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const o=u(r+(t+.5)*a);m+=` L ${e.middle+d[t]/y*v} ${o}`}m+=` L ${e.middle} ${u(s)}`;for(let t=f-1;t>=0;t--){const o=u(r+(t+.5)*a);m+=` L ${e.middle-d[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/y*v}`;m+=` L ${u(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const a=null!==(o=z(t,.25))&&void 0!==o?o:r,l=null!==(n=z(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=z(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Ds(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(He(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:Ds(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(He(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(He(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return f;const m=[],b=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),m.push(e))}const x=m.length>1&&"_default"!==m[0],w=[];let A=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),x||o>A&&(A=o)}if(x)for(const e of w){let t=0,o=0;for(let n=0;m.length>n;n++){const i=e.groups.get(m[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const S=new Map;for(const e of m){const t=w[0].groups.get(e);S.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=x?.95*p:.9*t.width,C=k().domain([0,A]).range([0,j]),_=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let P=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,u=0===t,d=n.width,h=.55*d,v=n.x+(d-h)/2,b=new Map;if(x){let e=0;for(const t of m){const n=o.groups.get(t);n&&(e+=C(n.total))}let t=p,i=p;for(let r=0;m.length>r;r++){const a=m[r],l=o.groups.get(a);if(!l)continue;const c=C(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=v,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=v,O.__funnelBarW=c),f.push(He(x,v,c,h,k,O,a)),b.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=C(e),s=p-t/2,a=m[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],d=l?a:n.name,x=g(c,d),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:u,category:l?a:n.name});y&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=v,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=v,w.__funnelBarW=t),f.push(He(s,v,t,h,x,w,d)),b.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&P.size>0){const t=x?m:[m[0]];for(const i of t){const t=P.get(i),r=b.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:_},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(u)}}P=b}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),S=o.x+e*a+l/2,O=m(y),j=m(0)-O,C=c(f.pieces[0],p?h:o.name),_=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:m(y+A)});if(d.push(He(S,O,u,j,C,_,p?h:o.name)),A>0){const e=m(y+A),t=O-e,n=Object.assign({},C),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(He(S,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=d?He(s,o.x,a,o.width,n,null,"__track__"):He(o.x,s,o.width,a,n,null,"__track__");u.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(d){const r=l(t),s=l(t+n);f=He(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=He(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}}return u}};class Rs{constructor(e){this.rExtent=new Le,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Me(e.windowSize),this.getO=ze(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=Ee(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=ze(e.stackBy),this.getGroup=ze(e.groupBy),this.getColor=ze(e.colorAccessor),this.getConnector=ze(e.connectorAccessor),this.getDataId=ze(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=O().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;d=k().domain(s).range([n,o])}else a?(u=O().domain(r).range([0,e.height]).padding(c),d=k().domain(s).range([0,e.width])):(u=O().domain(r).range([0,e.width]).padding(c),d=k().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?k().domain([l,c]).range([0,e.width]):k().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),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.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Hs[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=Is(r.colorScheme,r.themeCategorical,ft),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:Ns(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,Rs.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=j().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),s=wt(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=St(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=St(n.x,e._targetX,s),e.y=St(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=St(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=St(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=St(o.x,e._targetX,s),e.y=St(o.y,e._targetY,s),void 0!==o.w&&(e.w=St(o.w,e._targetW,s),e.h=St(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=St(o.startAngle,e._targetStartAngle,s),e.endAngle=St(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!We(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!We(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!We(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(We(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=ze(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!We(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=Ee(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!We(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?ze(this.config.stackBy):void 0),"groupBy"in e&&!We(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?ze(this.config.groupBy):void 0),"colorAccessor"in e&&!We(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ze(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!We(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?ze(this.config.connectorAccessor):void 0)}}function Ws(e,t,o){const n=Bt(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Es(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Fs(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Ht(Math.atan2(i,n)),a=Ht(e.startAngle),l=Ht(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function zs(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function $s(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Ys(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==u?void 0:u.projection),y="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||p?[]:(f||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Gs)(e)})),[u,g,p,f]),m=h&&u&&!p,b=d&&u&&!p;return m||b?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[m&&e("g",{className:"ordinal-grid",children:v.map((t,o)=>e("line",{x1:y?t.pixel:0,y1:y?0:t.pixel,x2:y?t.pixel:i,y2:y?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&e(o,{children:t(o,y?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Gs(e){return Math.round(100*e)/100+""}function qs(n){var s,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:_,annotations:P,svgAnnotationRules:M,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:D,children:I}=n,N="radial"===(null==g?void 0:g.projection),H="horizontal"===(null==g?void 0:g.projection),R=!1!==p,W=r(()=>f&&R&&g&&!N?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,R,g,m,N]),E=n.rTickValues,F=n.tickLabelEdgeAlign,z=r(()=>f&&g&&!N?(E||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Gs)(e)})):[],[f,g,b,N,E]),$=i(new Map),Y=i(null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0),G=null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0;Y.current!==G&&(Y.current=G,$.current=new Map);const q=r(()=>{if(!P||0===P.length)return null;const e=zo(),t="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,n={scales:g?{x:t?g.r:o||g.r,y:t&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:$.current};return P.map((t,o)=>{if(M){const i=M(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[P,M,l,c,g,L,T,B]);return f||k||w||_||q&&q.length>0||x||I?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!N&&!D&&e("g",{className:"ordinal-grid",children:z.map((t,o)=>e("line",{x1:H?t.pixel:0,y1:H?0:t.pixel,x2:H?t.pixel:l,y2:H?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!N&&e("g",{className:"ordinal-axes",children:t(o,H?{children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.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:o.label})})]},"cat-"+n)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((o,n)=>{const i=F?0===n?"start":n===z.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!D&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,o=0>t||t>c?c:t;return e("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((o,n)=>t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.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:o.label})})]},"cat-"+n)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),q,_,I]}),k&&e("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof k?k:null}),Co({legend:w,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:k,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j})]}):null}function Xs({width:t,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!u.current)return;const e=y(u.current).select(".brush-g"),n=b?v():m();return n.extent([[0,0],[t,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=x.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),d.current=null}},[t,o,b]),s(()=>{if(!l||!d.current||!p.current)return;if(!u.current)return;const e=p.current,t=y(u.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1)},[l,b]),e("svg",{ref:u,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Vs(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Us(e,t){const o=W().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}Rs.QUADTREE_THRESHOLD=500;const Ks=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?qt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Us(e,t)):(Vs(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Vs(e,t),ti(e,t)),e.globalAlpha=1}},Qs=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=qt(e,"var(--semiotic-primary, #007bff)"),a=qt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?qt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?qt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Zs=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?qt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Js=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=qt(e,o.style.stroke)||("string"==typeof o.style.fill?qt(e,o.style.fill):o.style.fill)||qt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},ea=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function ta(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function oa(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let na=null;const ia=new Map;function ra(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=ia.get(o);if(void 0!==n)return n;const i=function(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(na||(na=document.createElement("canvas")),na.width=e,na.height=e,na)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ia.set(o,i),i}function sa(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function aa(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function la(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ca=e=>[Js,...e],ua={bar:ca([si]),clusterbar:ca([si]),point:ca([ii]),swarm:ca([ii]),pie:[Ks],donut:[Ks],boxplot:ca([Qs,ii]),violin:ca([Zs]),histogram:ca([si]),ridgeline:ca([Zs]),timeline:ca([si]),funnel:[si,ea,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?ta(i):null!=r?`${ta(i)} (${oa(r)})`:ta(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=ta(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[si,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||qt(e,"var(--semiotic-border, #999)"),n=ra(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=Xt(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,qt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,u=r?la(i):"",d=aa(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,v=y-f/2,m=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),sa(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),sa(e,v,m,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,m+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,m+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,m+3))}e.lineWidth=1}],swimlane:ca([si]),custom:ca([si,ii,Ks,Qs,Zs,ea])},da={top:50,right:40,bottom:60,left:70},ha={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ga({hover:o}){var n,i,r,s,a,l;const c=o.data||{},u=o.stats,d=o.category;if(Array.isArray(c)){const o=d||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:ha,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:ha,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return t("div",{className:"semiotic-tooltip",style:ha,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===o.length&&t("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ha,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ha,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}return t("div",{className:"semiotic-tooltip",style:ha,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const fa=g(function(o,a){var c,u,h,g,f,y,v,m,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:j="value",colorAccessor:C,stackBy:_,groupBy:P,multiAxis:M,timeAccessor:L,valueAccessor:T,categoryAccessor:B,projection:D="vertical",size:I=[600,400],responsiveWidth:N,responsiveHeight:H,margin:R,barPadding:E,roundedTop:F,gradientFill:z,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,showAxes:ve=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:je,oFormat:Ce,rFormat:_e,rTickValues:Pe,tickLabelEdgeAlign:Me,enableHover:Le=!0,hoverAnnotation:Te,tooltipContent:Be,customHoverBehavior:De,annotations:Ie,svgAnnotationRules:Ne,showGrid:He=!1,legend:Re,legendHoverBehavior:We,legendClickBehavior:Ee,legendHighlightedCategory:Fe,legendIsolatedCategories:ze,legendPosition:$e,legendCategoryAccessor:Ye,onCategoriesChange:Ge,backgroundGraphics:qe,foregroundGraphics:Xe,title:Ve,className:Ue,background:Ke,centerContent:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:ot,brush:nt,onBrush:it,accessibleTable:rt=!0,description:st,summary:at,customLayout:lt,layoutConfig:ct}=o,ut=i(!0),dt=qn({sizeProp:I,responsiveWidth:N,responsiveHeight:H,userMargin:R,marginDefault:da,foregroundGraphics:Xe,backgroundGraphics:qe,animate:tt,transitionProp:et,themeDirtyRef:ut}),{reducedMotionRef:ht,responsiveRef:gt,size:ft,margin:pt,adjustedWidth:yt,adjustedHeight:vt,resolvedForeground:mt,resolvedBackground:bt,currentTheme:xt,transition:kt,introEnabled:wt,tableId:At,rafRef:St,renderFnRef:Ot,scheduleRender:jt}=dt,Ct=un(),_t=fn(),Pt=r(()=>fe(S),[S]),Mt=null!=xe?xe:Oe,Lt=null!=we?we:je,Bt=null!=Ae?Ae:Ce,Dt=null!=Se?Se:_e,It=i(null),Nt=i(null),Ht=i([]),Wt=i(Ye),Et=i(Ge);Wt.current=Ye,Et.current=Ge;const[Ft,zt]=d(null),[$t,Yt]=d(null),[Gt,Xt]=d(0),[Vt,Ut]=d(!1),[Kt,Qt]=d(null),Zt=l(()=>{var e,t;Qt(null!==(t=null===(e=no.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Jt=Le||Te,eo="streaming"===A,to=r(()=>{var e,t,o;return{chartType:w,runtimeMode:eo?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:le,projection:D,oAccessor:eo?void 0:O,rAccessor:eo?void 0:j,colorAccessor:C,stackBy:_,groupBy:P,multiAxis:M,timeAccessor:eo?L:void 0,valueAccessor:eo?T||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:eo?B||O:void 0,rExtent:se,oExtent:ae,barPadding:E,roundedTop:F,gradientFill:z,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:pe,themeCategorical:null===(e=null==xt?void 0:xt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(xt),themeSequential:null===(t=null==xt?void 0:xt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==xt?void 0:xt.colors)||void 0===o?void 0:o.diverging,barColors:ye,decay:Ze,pulse:Je,transition:kt,introAnimation:wt,staleness:ot,customLayout:lt,layoutConfig:ct,layoutMargin:pt}},[w,de,ue,le,D,O,j,C,_,P,M,L,T,B,se,ae,E,F,z,$,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,ne,ie,re,ce,he,ge,pe,ye,Ze,Je,null==kt?void 0:kt.duration,null==kt?void 0:kt.easing,wt,ot,eo,xt,lt,ct,pt]),oo=yn(to),no=i(null);no.current||(no.current=new Rs(oo));const io=l(()=>{var e,t;const o=Wt.current,n=Et.current;if(!n||!o)return;const i=gi(null!==(t=null===(e=no.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);fi(i,Ht.current)||(Ht.current=i,n(i))},[]);s(()=>{var e;null===(e=no.current)||void 0===e||e.updateConfig(oo),ut.current=!0,jt()},[oo,jt]);const ro=i(null);ro.current||(ro.current=new me(e=>{const t=no.current;t&&t.ingest(e)&&(ut.current=!0,jt())}));const so=l(e=>{var t;null===(t=ro.current)||void 0===t||t.push(e)},[]),ao=l(e=>{var t;null===(t=ro.current)||void 0===t||t.pushMany(e)},[]),lo=l(()=>{var e,t;null===(e=ro.current)||void 0===e||e.clear(),null===(t=no.current)||void 0===t||t.clear(),ut.current=!0,jt()},[jt]),co=l(e=>{var t,o;null===(t=ro.current)||void 0===t||t.clearLastData(),null===(o=ro.current)||void 0===o||o.setReplacementData(e)},[]);p(a,()=>({push:so,pushMany:ao,replace:co,remove:e=>{var t,o,n,i;null===(t=ro.current)||void 0===t||t.flush();const r=null!==(n=null===(o=no.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=Nt.current)||void 0===i?void 0:i.data;!!Nt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Nt.current=null,zt(null)),ut.current=!0,jt()}return r},update:(e,t)=>{var o,n,i;null===(o=ro.current)||void 0===o||o.flush();const r=null!==(i=null===(n=no.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ut.current=!0,jt()),r},clear:lo,getData:()=>{var e,t,o;return null===(e=ro.current)||void 0===e||e.flush(),null!==(o=null===(t=no.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=no.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[so,ao,co,lo,jt]),s(()=>{var e;S&&(null===(e=ro.current)||void 0===e||e.setBoundedData(Pt))},[S,Pt]);const{hoverHandlerRef:fo,hoverLeaveRef:po,onPointerMove:mo,onPointerLeave:bo}=dt;fo.current=e=>{if(!Jt)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-pt.left,i=e.clientY-o.top-pt.top;if(0>n||n>yt||0>i||i>vt)return void(Nt.current&&(Nt.current=null,zt(null),De&&De(null),jt()));const r=no.current;if(!r||0===r.scene.length)return;const s="radial"===D,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Rt(i,t,o,n,r);e&&(s={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"rect":if(null==r.datum)break;e=Ws(r,t,o);break;case"point":if(i)break;e=Es(r,t,o,n);break;case"wedge":e=Fs(r,t,o);break;case"boxplot":e=zs(r,t,o);break;case"violin":e=$s(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-yt/2:n,s?i-vt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Nt.current&&(Nt.current=null,zt(null),De&&De(null),jt()));const l=li(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w}));Nt.current=l,zt(l),De&&(De(l),ut.current=!0),jt()},po.current=()=>{Nt.current&&(Nt.current=null,zt(null),De&&(De(null),ut.current=!0),jt())};const xo=i(-1),ko=i(null),wo=i(null),Ao=l(e=>{const t=no.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(wo.current&&wo.current.version===o)n=wo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";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!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=uo(e),wo.current={version:o,graph:n}}const i=xo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),xo.current=0;const t=n.flat[0];ko.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},yo(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});return Nt.current=o,zt(o),De&&De(o),void jt()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return xo.current=-1,ko.current=null,Nt.current=null,zt(null),De&&De(null),void jt();xo.current=s;const a=n.flat[s];ko.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},yo(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});Nt.current=l,zt(l),De&&De(l),jt()},[De,jt]),So=l(e=>{xo.current=-1,ko.current=null,mo(e)},[mo]);Ot.current=()=>{var e,t;St.current=0;const o=It.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=no.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(ht.current?r+1e6:r),a=!ht.current&&s,l=ut.current;l&&!s&&(i.computeScene({width:yt,height:vt}),io(),Zt(),ut.current=!1),(l||a)&&o.setAttribute("aria-label",Sn(i.scene,w+" chart"));const c=Vn(),u=ft[0]*c,d=ft[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=ft[0]+"px",o.style.height=ft[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,ft[0],ft[1]);const h=null!==(e=null==ot?void 0:ot.threshold)&&void 0!==e?e:5e3,g=ot&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==ot?void 0:ot.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ke&&!qe){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Ke||(e&&"transparent"!==e?e:null),i=t?qt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,ft[0],ft[1]))}const f="radial"===D;n.save(),n.beginPath(),n.rect(pt.left,pt.top,yt,vt),n.clip(),f?(n.save(),n.translate(pt.left+yt/2,pt.top+vt/2)):n.translate(pt.left,pt.top);const p=lt?ua.custom:ua[w]||[],y={width:yt,height:vt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Yt(i.scales),Xt(e=>e+1)),(null==ot?void 0:ot.showBadge)&&Ut(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(St.current=requestAnimationFrame(()=>Ot.current()))},pn({hydrated:Ct,wasHydratingFromSSR:_t,storeRef:no,dirtyRef:ut,renderFnRef:Ot,cleanup:()=>{var e;return null===(e=ro.current)||void 0===e?void 0:e.clear()}}),s(()=>{ut.current=!0,jt()},[w,yt,vt,ve,Ke,jt]),vo(ot,no,ut,jt,Vt,Ut);const Oo=Jt&&Ft?Be?Be(Ft):e(ga,{hover:Ft}):null,jo="radial"===D,Co=Oo?e(Fn,{x:Ft?jo?Ft.x+yt/2:Ft.x:0,y:Ft?jo?Ft.y+vt/2:Ft.y:0,containerWidth:yt,containerHeight:vt,margin:pt,className:"stream-ordinal-tooltip",children:Oo}):null;if(ln||!Ct&&_t){const o=no.current;o&&S&&(o.ingest({inserts:Pt,bounded:!0}),o.computeScene({width:yt,height:vt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s="radial"===D,a=s?pt.left+yt/2:pt.left,l=s?pt.top+vt/2:pt.top;return t("div",{ref:gt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:N?"100%":ft[0],height:H?"100%":ft[1]},children:[e(Nn,{summary:at}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ft[0],height:ft[1],style:{position:"absolute",left:0,top:0},children:[bt&&e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt}),t("g",{transform:`translate(${a},${l})`,children:[Ke&&e("rect",{x:0,y:0,width:yt,height:vt,fill:Ke}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const u=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",d=e=>`ord-${o.type}-${u}-${i}-${e}`,h=`ord-${o.type}-${u}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.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;for(let o=0;t.length>o;o++)l.push(e("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=an(t.style.fill);l.push(e("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:an(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+u-o} A${o},${o} 0 0 0 ${r+o},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r+o},${l+u} A${o},${o} 0 0 1 ${r},${l+u-o} Z`;break;default:d=`M${r},${l+u} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u} Z`}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:an(t.style.fill),opacity:null!==(r=t.style.opacity)&&void 0!==r?r:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}case"wedge":{const t=o,n=W().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2);t.cornerRadius&&n.cornerRadius(t.cornerRadius);const i=n(sn)||"";return e("path",{d:i,transform:`translate(${t.cx},${t.cy})`,fill:an(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return t("g","vertical"===n.projection?{children:[e("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:an(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:an(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const t=o,n=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:an(t.style.fill),fillOpacity:null!==(l=t.style.fillOpacity)&&void 0!==l?l:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},d("path"))];if(t.iqrLine&&t.bounds){const o=t.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med"))):n.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med")))}return e("g",{children:n},h)}case"connector":return e("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const t=o,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:n,fill:an(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),e(qs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:r,showAxes:ve,showCategoryTicks:be,oLabel:Mt,rLabel:Lt,oFormat:Bt,rFormat:Dt,rTickValues:Pe,tickLabelEdgeAlign:Me,showGrid:He,title:Ve,legend:Re,legendHoverBehavior:We,legendClickBehavior:Ee,legendHighlightedCategory:Fe,legendIsolatedCategories:ze,legendPosition:$e,foregroundGraphics:Tt(mt,null===(h=no.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:Ie,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==o?void 0:o.getData()}),Qe&&"radial"===D&&e("div",{style:{position:"absolute",left:pt.left+yt/2,top:pt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe})]})}return t("div",{ref:gt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"group","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:N?"100%":ft[0],height:H?"100%":ft[1],overflow:"visible"},onKeyDown:Ao,children:[rt&&e(Hn,{tableId:At}),rt&&e(Dn,{scene:null!==(f=null===(g=no.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:At,chartTitle:"string"==typeof Ve?Ve:void 0}),e(Nn,{summary:at}),t("div",{role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?So:void 0,onMouseLeave:Jt?bo:void 0,children:[bt&&e("svg",{style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1],pointerEvents:"none"},children:e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt})}),e(Ys,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,showAxes:ve,showGrid:He,rFormat:Dt,rTickValues:Pe}),e("canvas",{ref:It,"aria-label":Sn(null!==(v=null===(y=no.current)||void 0===y?void 0:y.scene)&&void 0!==v?v:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1]}}),e(Rn,{hoverPoint:Ft}),e(qs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,showAxes:ve,showCategoryTicks:be,oLabel:Mt,rLabel:Lt,oFormat:Bt,rFormat:Dt,showGrid:He,title:Ve,legend:Re,legendHoverBehavior:We,legendClickBehavior:Ee,legendHighlightedCategory:Fe,legendIsolatedCategories:ze,legendPosition:$e,foregroundGraphics:Tt(mt,Kt),annotations:Ie,svgAnnotationRules:Ne,annotationFrame:Gt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(m=no.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(nt||it)&&"radial"!==D&&e(Xs,{width:yt,height:vt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,scales:$t,onBrush:it||(()=>{})}),Qe&&"radial"===D&&e("div",{style:{position:"absolute",left:pt.left+yt/2,top:pt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe}),(null==ot?void 0:ot.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ot.badgePosition?{top:4,left:4}:"bottom-left"===ot.badgePosition?{bottom:4,left:4}:"bottom-right"===ot.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Vt?"#dc3545":"#28a745",color:"white"}),children:Vt?"STALE":"LIVE"}),e(En,{active:xo.current>=0,hoverPoint:Ft,margin:pt,size:ft,shape:null===(b=ko.current)||void 0===b?void 0:b.shape,width:null===(x=ko.current)||void 0===x?void 0:x.w,height:null===(k=ko.current)||void 0===k?void 0:k.h}),Co]})]})});function pa({ref:e,frameRef:t,setup:o}){return p(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}fa.displayName="StreamOrdinalFrame";const ya=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:v=40,roundedTop:m,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:j,onObservation:C,onClick:_,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:I,stroke:N,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:E,dataIdAccessor:F}=t,{width:z,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=r(()=>fe(a),[a]),ee=Jr({data:J,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:M,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:$}),{effectiveLegendProps:te,effectiveMargin:oe}=pa({ref:o,frameRef:s,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;Yr("BarChart",J,"categoryAccessor",u),Yr("BarChart",J,"valueAccessor",d);const ne=gr(J,y,d),ie=ur(),re=r(()=>new Map,[J]),se=r(()=>(e,t)=>{const o={};return o.fill=f?vt(e,f,ee.colorScale):dr(I,ie,p,void 0,re),o},[f,ee.colorScale,I,ie,p,re]),ae=r(()=>{const e=null==S?void 0:S.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},se(t,o)),e(t,o)||{}):se,{stroke:N,strokeWidth:H,opacity:R})},[se,S,N,H,R]),le=r(()=>Qi(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[u,d,f,g]),ue=Ur({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(Ir,{componentName:"BarChart",message:ue,width:z,height:$});const de=Object.assign(Object.assign(Object.assign(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:"bar"},null!=a&&{data:ne}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[z,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),F&&{dataIdAccessor:F}),{baselinePadding:x,enableHover:Y,showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),E&&{oFormat:E}),{showGrid:G,showCategoryTicks:W,oSort:y}),te),ss({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:ce})),as({linkedHover:j,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"BarChart",width:z,height:$,children:e(fa,Object.assign({ref:s},de))})});ya.displayName="BarChart";const va=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:I,color:N,stroke:H,strokeWidth:R,opacity:W,categoryFormat:E}=t,{width:F,height:z,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=r(()=>fe(a),[a]),J=p||d,ee=Jr({data:Z,rawData:a,colorBy:J,colorScheme:y,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:P,hoverHighlight:M,chartType:"StackedBarChart",chartId:L,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:F,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=ur(),oe=r(()=>new Map,[Z]),ne=r(()=>(e,t)=>J?ee.colorScale?{fill:vt(e,J,ee.colorScale)}:{}:{fill:dr(N,te,y,t,oe)},[J,ee.colorScale,N,te,y,oe]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>{const n=ne(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ne,{stroke:H,strokeWidth:R,opacity:W})},[ne,O,H,R,W]),re=r(()=>Qi(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Ur({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=pa({ref:o,frameRef:s,setup:ee}),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({chartType:"bar"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:f}),E&&{oFormat:E}),{showGrid:Y}),le),ss({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate})),ls({tooltip:w,defaultTooltipContent:se})),as({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?e(Ir,{componentName:"StackedBarChart",message:ae,width:F,height:z}):e(Wr,{componentName:"StackedBarChart",width:F,height:z,children:e(fa,Object.assign({ref:s},ue))})});va.displayName="StackedBarChart";const ma=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:j,onObservation:C,onClick:_,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:I,stroke:N,strokeWidth:H,opacity:R,categoryFormat:W}=t,{width:E,height:F,enableHover:z,showGrid:$,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=n,Q=r(()=>fe(a),[a]),Z=p||d,J=Jr({data:Q,rawData:a,colorBy:Z,colorScheme:y,legendInteraction:B,legendPosition:D,selection:O,linkedHover:j,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"GroupedBarChart",chartId:M,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:E,height:F});if(J.earlyReturn)return J.earlyReturn;const ee=ur(),te=r(()=>new Map,[Q]),oe=S.pieceStyle,ne=r(()=>(e,t)=>{const o=Z?J.colorScale?{fill:vt(e,Z,J.colorScale)}:{}:{fill:dr(I,ee,y,t,te)};if(oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Z,J.colorScale,I,ee,y,te,oe]),ie=r(()=>kr(ne,{stroke:N,strokeWidth:H,opacity:R}),[ne,N,H,R]),re=r(()=>Qi(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Ur({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=pa({ref:o,frameRef:s,setup:J}),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({chartType:"clusterbar"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[E,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:f}),W&&{oFormat:W}),{showGrid:$}),le),ss({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:se})),as({linkedHover:j,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ae?e(Ir,{componentName:"GroupedBarChart",message:ae,width:E,height:F}):e(Wr,{componentName:"GroupedBarChart",width:E,height:F,children:e(fa,Object.assign({ref:s},ue))})});function ba({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=Ki("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=Hi({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof n?n:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const c=l(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||o||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}ma.displayName="GroupedBarChart";const xa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:v=[3,8],pointRadius:m=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:j,frameProps:C={},selection:_,linkedHover:P,onObservation:M,onClick:L,hoverHighlight:T,chartId:B,loading:D,emptyContent:I,legendInteraction:N,legendPosition:H,color:R,stroke:W,strokeWidth:E,opacity:F,showCategoryTicks:z,categoryFormat:$}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=n,te=r(()=>fe(a),[a]),oe=Jr({data:te,rawData:a,colorBy:f,colorScheme:p,legendInteraction:N,legendPosition:H,selection:_,linkedHover:P,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:D,emptyContent:I,width:Y,height:G}),ne=ba({brushProp:S,onBrushProp:O,linkedBrush:j,valueAccessor:d});if(oe.earlyReturn)return oe.earlyReturn;const ie=r(()=>{if(!y)return;const e=te.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[te,y]),re=ur(),se=r(()=>new Map,[te]),ae=C.pieceStyle,le=r(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=f?vt(e,f,oe.colorScale):dr(R,re,p,void 0,se),o.r=y?bt(e,y,v,ie):m,ae){const n=ae(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,oe.colorScale,y,v,ie,m,b,R,re,p,se,ae]),ce=r(()=>kr(le,{stroke:W,strokeWidth:E,opacity:F}),[le,W,E,F]),ue=r(()=>Qi(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),de=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f||void 0,valueFormat:g}),[u,d,f,g]),he=Ur({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return e(Ir,{componentName:"SwarmPlot",message:he,width:Y,height:G});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:te}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:q}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:J,rLabel:ee,rFormat:g}),$&&{oFormat:$}),{showGrid:X,showCategoryTicks:z}),oe.legendBehaviorProps),ss({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate})),ls({tooltip:k,defaultTooltipContent:de})),as({linkedHover:P,onObservation:M,onClick:L,hoverHighlight:T,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ne.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"SwarmPlot",width:Y,height:G,children:e(fa,Object.assign({ref:s},ge))})});function ka(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return t("div",{className:"semiotic-tooltip",style:wr,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return t("div",{className:"semiotic-tooltip",style:wr,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:wr,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}xa.displayName="SwarmPlot";const wa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:v=20,tooltip:m,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:j,chartId:C,loading:_,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:B,strokeWidth:D,opacity:I,showCategoryTicks:N,categoryFormat:H}=t,{width:R,height:W,enableHover:E,showGrid:F,showLegend:z,title:$,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=n,U=r(()=>fe(a),[a]),K=Jr({data:U,rawData:a,colorBy:f,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:j,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:P,width:R,height:W});if(K.earlyReturn)return K.earlyReturn;const Q=ur(),Z=r(()=>new Map,[U]),J=r(()=>e=>{const t=f?vt(e,f,K.colorScale):dr(T,Q,p,void 0,Z);return{fill:t,stroke:t,fillOpacity:.8}},[f,K.colorScale,T,Q,p,Z]),ee=r(()=>kr(J,{stroke:B,strokeWidth:D,opacity:I}),[J,B,D,I]),te=r(()=>Qi(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),oe=r(()=>ka(),[]),ne=Ur({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(Ir,{componentName:"BoxPlot",message:ne,width:R,height:W});const 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({chartType:"boxplot"},null!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,showOutliers:y,size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:v,enableHover:E}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:X,rLabel:V,rFormat:g}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:N}),K.legendBehaviorProps),ss({title:$,description:Y,summary:G,accessibleTable:q,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:oe})),as({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:j,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"BoxPlot",width:R,height:W,children:e(fa,Object.assign({ref:s},ie))})});wa.displayName="BoxPlot";const Aa=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=i(null);es(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:I,color:N,stroke:H,strokeWidth:R,opacity:W,showCategoryTicks:E,categoryFormat:F}=o,{width:z,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=s,J=r(()=>fe(l),[l]),ee=Jr({data:J,rawData:l,colorBy:y,colorScheme:v,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:P,hoverHighlight:M,chartType:"Histogram",chartId:L,showLegend:q,userMargin:c,marginDefaults:s.marginDefaults,loading:T,emptyContent:B,width:z,height:$}),te=ba({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(ee.earlyReturn)return ee.earlyReturn;const oe=r(()=>{if(0===J.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of J){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[J,h]),ne=ur(),ie=r(()=>new Map,[J]),re=r(()=>e=>{const t=y?vt(e,y,ee.colorScale):dr(N,ne,v,void 0,ie);return{fill:t,stroke:t,fillOpacity:.8}},[y,ee.colorScale,N,ne,v,ie]),se=r(()=>kr(re,{stroke:H,strokeWidth:R,opacity:W}),[re,H,R,W]),ae=r(()=>Qi(se,ee.effectiveSelectionHook,ee.resolvedSelection),[se,ee.effectiveSelectionHook,ee.resolvedSelection]),le=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return t("div",{className:"semiotic-tooltip",style:wr,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ce=Ur({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(ce)return e(Ir,{componentName:"Histogram",message:ce,width:z,height:$});const 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({chartType:"histogram"},null!=l&&{data:J}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),k?{rExtent:k}:oe&&{rExtent:oe}),{size:[z,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Q,rLabel:Z,rFormat:p}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:E}),ee.legendBehaviorProps),ss({title:X,description:V,summary:U,accessibleTable:K,className:u,animate:o.animate})),ls({tooltip:b,defaultTooltipContent:le})),as({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"Histogram",width:z,height:$,children:e(fa,Object.assign({ref:a},ue))})});Aa.displayName="Histogram";const Sa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:I,color:N,stroke:H,strokeWidth:R,opacity:W,showCategoryTicks:E,categoryFormat:F}=t,{width:z,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=r(()=>fe(a),[a]),ee=Jr({data:J,rawData:a,colorBy:y,colorScheme:v,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:P,hoverHighlight:M,chartType:"ViolinPlot",chartId:L,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:z,height:$}),te=ba({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:d});if(ee.earlyReturn)return ee.earlyReturn;const oe=ur(),ne=r(()=>new Map,[J]),ie=r(()=>e=>{const t=y?vt(e,y,ee.colorScale):dr(N,oe,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[y,ee.colorScale,N,oe,v,ne]),re=r(()=>kr(ie,{stroke:H,strokeWidth:R,opacity:W}),[ie,H,R,W]),se=r(()=>Qi(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=r(()=>ka({valueAccessor:d}),[d]),le=Ur({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(le)return e(Ir,{componentName:"ViolinPlot",message:le,width:z,height:$});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:J}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:se,bins:g,showIQR:f,size:[z,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:p}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:E}),ee.legendBehaviorProps),ss({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate})),ls({tooltip:b,defaultTooltipContent:ae})),as({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"ViolinPlot",width:z,height:$,children:e(fa,Object.assign({ref:s},ce))})});Sa.displayName="ViolinPlot";const Oa=g(function(t,o){var n;const s=br(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);es(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:v="auto",dotRadius:m=5,categoryPadding:b=10,tooltip:x,annotations:k,valueExtent:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:I,strokeWidth:N,opacity:H,categoryFormat:R}=t,{width:W,height:E,enableHover:F,showGrid:z,showLegend:$,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=s,K=r(()=>fe(l),[l]),Q=Jr({data:K,rawData:l,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:$,userMargin:c,marginDefaults:s.marginDefaults,loading:M,emptyContent:L,width:W,height:E});if(Q.earlyReturn)return Q.earlyReturn;const Z=gr(K,v,h),J=ur(),ee=r(()=>new Map,[K]),te=A.pieceStyle,oe=r(()=>(e,t)=>{const o={r:m,fillOpacity:.8};if(o.fill=p?vt(e,p,Q.colorScale):dr(D,J,y,void 0,ee),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,Q.colorScale,m,D,J,y,ee,te]),ne=r(()=>kr(oe,{stroke:I,strokeWidth:N,opacity:H}),[oe,I,N,H]),ie=r(()=>Qi(ne,Q.effectiveSelectionHook,Q.resolvedSelection),[ne,Q.effectiveSelectionHook,Q.resolvedSelection]),re=r(()=>Dr({categoryAccessor:d,valueAccessor:h,valueFormat:f}),[d,h,f]),se=Ur({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(se)return e(Ir,{componentName:"DotPlot",message:se,width:W,height:E});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:b,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:V,rLabel:U,rFormat:f}),R&&{oFormat:R}),{showGrid:z,oSort:v}),Q.legendBehaviorProps),ss({title:Y,description:G,summary:q,accessibleTable:X,className:u,animate:t.animate})),ls({tooltip:x,defaultTooltipContent:re})),as({linkedHover:O,onObservation:j,onClick:C,hoverHighlight:_,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),k&&k.length>0&&{annotations:k}),w&&{rExtent:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"DotPlot",width:W,height:E,children:e(fa,Object.assign({ref:a},ae))})});Oa.displayName="DotPlot";const ja=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);es(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=5,tooltip:b,annotations:x,valueExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:j,hoverHighlight:C,chartId:_,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,stroke:D,strokeWidth:I,opacity:N,showCategoryTicks:H,categoryFormat:R}=t,{width:W,height:E,enableHover:F,showGrid:z,showLegend:$,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=n,K=r(()=>fe(a),[a]),Q=Jr({data:K,rawData:a,colorBy:y,colorScheme:v,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:C,chartType:"RidgelinePlot",chartId:_,showLegend:$,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:M,width:W,height:E});if(Q.earlyReturn)return Q.earlyReturn;const Z=ur(),J=r(()=>new Map,[K]),ee=r(()=>e=>{const t=y?vt(e,y,Q.colorScale):dr(B,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.5}},[y,Q.colorScale,B,Z,v,J]),te=r(()=>kr(ee,{stroke:D,strokeWidth:I,opacity:N}),[ee,D,I,N]),oe=r(()=>Qi(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),ne=r(()=>ka(),[]),ie=Ur({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ie)return e(Ir,{componentName:"RidgelinePlot",message:ie,width:W,height:E});const re=Object.assign(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:"ridgeline"},null!=a&&{data:K}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:oe,bins:g,size:[W,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:V,rLabel:U,rFormat:p}),R&&{oFormat:R}),{showGrid:z,showCategoryTicks:H,oSort:!1,amplitude:f}),Q.legendBehaviorProps),ss({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate})),ls({tooltip:b,defaultTooltipContent:ne})),as({linkedHover:S,onObservation:O,onClick:j,hoverHighlight:C,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"RidgelinePlot",width:W,height:E,children:e(fa,Object.assign({ref:s},re))})});ja.displayName="RidgelinePlot";const Ca=g(function(t,o){var n,s;const a=br(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:j,loading:C,emptyContent:_,legendInteraction:P,legendPosition:M,color:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,showLegend:R,title:W,description:E,summary:F,accessibleTable:z}=a,$=r(()=>fe(c),[c]),Y=f||h,G=Jr({data:$,rawData:c,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:j,showLegend:R,userMargin:u,marginDefaults:a.marginDefaults,loading:C,emptyContent:_,width:I,height:N});if(G.earlyReturn)return G.earlyReturn;const q=ur(),X=r(()=>new Map,[$]),V=r(()=>(e,t)=>Y?G.colorScale?{fill:vt(e,Y,G.colorScale)}:{}:{fill:dr(L,q,p,t,X)},[Y,G.colorScale,L,q,p,X]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return kr(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},V(t,o)),e(t,o)||{}):V,{stroke:T,strokeWidth:B,opacity:D})},[V,x,T,B,D]),K=r(()=>Qi(U,G.effectiveSelectionHook,G.resolvedSelection),[U,G.effectiveSelectionHook,G.resolvedSelection]),Q=r(()=>Dr({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Z=Ur({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=pa({ref:o,frameRef:l,setup:G}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:$}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),ss({title:W,description:E,summary:F,accessibleTable:z,className:d,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:Q})),as({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(Ir,{componentName:"PieChart",message:Z,width:I,height:N}):e(Wr,{componentName:"PieChart",width:I,height:N,children:e(fa,Object.assign({ref:l},te))})});Ca.displayName="PieChart";const _a=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:j,loading:C,emptyContent:_,legendInteraction:P,legendPosition:M,color:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,showLegend:R,title:W,description:E,summary:F,accessibleTable:z}=n,$=r(()=>fe(a),[a]),Y=f||u,G=Jr({data:$,rawData:a,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:j,showLegend:R,userMargin:l,marginDefaults:n.marginDefaults,loading:C,emptyContent:_,width:I,height:N});if(G.earlyReturn)return G.earlyReturn;const q=null!=h?h:Math.max(2,.15*Math.min(I,N)),X=ur(),V=r(()=>new Map,[$]),U=x.pieceStyle,K=r(()=>(e,t)=>{let o;if(o=Y?G.colorScale?{fill:vt(e,Y,G.colorScale)}:{}:{fill:dr(L,X,p,t,V)},U){const n=U(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Y,G.colorScale,L,X,p,V,U]),Q=r(()=>kr(K,{stroke:T,strokeWidth:B,opacity:D}),[K,T,B,D]),Z=r(()=>Qi(Q,G.effectiveSelectionHook,G.resolvedSelection),[Q,G.effectiveSelectionHook,G.resolvedSelection]),J=r(()=>Dr({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),ee=Ur({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:te,effectiveMargin:oe}=pa({ref:o,frameRef:s,setup:G}),ne=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:"donut"},null!=a&&{data:$}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:Z,innerRadius:q,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),te),ss({title:W,description:E,summary:F,accessibleTable:z,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:J})),as({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return ee?e(Ir,{componentName:"DonutChart",message:ee,width:I,height:N}):e(Wr,{componentName:"DonutChart",width:I,height:N,children:e(fa,Object.assign({ref:s},ne))})});_a.displayName="DonutChart";const Pa=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=i(null),l="context"===o.mode,{compactMode:c}=s,{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!c,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:j={},className:C,stroke:_,strokeWidth:P,opacity:M}=o,{width:L,height:T,title:B,description:D,summary:I,accessibleTable:N}=s,H=Math.max(d,Math.min(h,u)),R=h-d||1,W=(H-d)/R,{gaugeData:E,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=d;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/R;if(A){const n=(i-d)/R,a=Math.max(0,Math.min(W,(r.value-d)/R)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[u,d,h,g,f,p,W,R,k,A]),$=r(()=>kr(F,{stroke:_,strokeWidth:P,opacity:M}),[F,_,P,M]),Y=w*Math.PI/180,G=180+(360-w)/2,q=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,V=[[Math.cos(X),Math.sin(X)],[Math.cos(X+Y),Math.sin(X+Y)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>Y+.001||V.push([Math.cos(e),Math.sin(e)]);const U=Math.min(...V.map(e=>e[0])),K=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),Z=Math.max(...V.map(e=>e[1])),J=(Q+Z)/2,ee=(U+K)/2,te=Math.max(4,Math.min((L-2*q)/(K-U),(T-2*q)/(Z-Q))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(H,d,h):b;const o=x?x(H):Math.round(H)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),k&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,H,d,h,x,k,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(H):Math.round(H)+""}:null,[l,b,H,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+G*Math.PI/180+W*Y,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,W,G,Y,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const t=-Math.PI/2+G*Math.PI/180+(o.value-d)/R*Y,r=oe-14,s=(i.height||T)/2;return e("text",{x:(i.width||L)/2+Math.cos(t)*r,y:s+Math.sin(t)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?e("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,d,R,G,Y,oe,te]),ue=r(()=>{const e=[...z,...O||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,O,le,ae]),de=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===E.length)return e(Ir,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:E,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:oe,startAngle:G,sweepAngle:w,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:_r(S)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),D&&{description:D}),I&&{summary:I}),void 0!==N&&{accessibleTable:N}),C&&{className:C}),null!=o.animate&&{animate:o.animate}),j);return e(Wr,{componentName:"GaugeChart",width:L,height:T,children:e(fa,Object.assign({ref:a},he))})});Pa.displayName="GaugeChart";const Ma=g(function(o,n){const s=br(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=i(null);es(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:v=.3,showLabels:m=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:j,chartId:C,loading:_,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:B,strokeWidth:D,opacity:I,categoryFormat:N}=o,H="vertical"===y,{width:R,height:W,enableHover:E,showLegend:F,title:z,description:$,summary:Y,accessibleTable:G}=s,q=H?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},X=r(()=>fe(l),[l]),V=f||g,U=!V,K=Jr({data:X,rawData:l,colorBy:V,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:j,chartType:"FunnelChart",chartId:C,showLegend:F,userMargin:c,marginDefaults:q,loading:_,emptyContent:P,width:R,height:W});if(K.earlyReturn)return K.earlyReturn;Yr("FunnelChart",X,"stepAccessor",d),Yr("FunnelChart",X,"valueAccessor",h);const Q=ur(),Z=r(()=>new Map,[X]),J=r(()=>{if(U)return T||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[U,T,Q,p]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const o={};if(o.fill=J||(V?vt(e,V,K.colorScale):dr(T,Q,p,t,Z)),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,V,K.colorScale,T,Q,p,Z,ee]),oe=r(()=>kr(te,{stroke:B,strokeWidth:D,opacity:I}),[te,B,D,I]),ne=r(()=>Qi(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:wr,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]),re=Ur({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(re)return e(Ir,{componentName:"FunnelChart",message:re,width:R,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:H?"bar-funnel":"funnel"},null!=l&&{data:X}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ne,size:[R,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:E}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),N&&{oFormat:N}),{showGrid:H}),!H&&{connectorOpacity:v}),{showLabels:m}),K.legendBehaviorProps),z&&{title:z}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ie:_r(b)||ie}),(A||S||O||j)&&{customHoverBehavior:K.customHoverBehavior}),(S||O||A)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Wr,{componentName:"FunnelChart",width:R,height:W,children:e(fa,Object.assign({ref:a},se))})});Ma.displayName="FunnelChart";const La={RdBu:rt,PiYG:st,PRGn:at,BrBG:lt,RdYlBu:ct,RdYlGn:ut,Spectral:dt},Ta="__likert_neutral_neg",Ba="__likert_neutral_pos";function Da(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Ia(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Na(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Ta,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Ba,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Ha(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Ta?r=o:o.__likertLevel===Ba?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const Ra=g(function(t,o){const s=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:c,margin:u,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:j,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:M,chartId:L,valueFormat:T,loading:B,emptyContent:D,legendInteraction:I,legendPosition:N,categoryFormat:H,stroke:R,strokeWidth:W,opacity:E}=t,{width:F,height:z,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=s,Z="horizontal"===b,J=void 0===c,ee=!y,te=function(){var e;const t=sr();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=m.length?x:function(e,t){if(0>=e)return[];if(t){const o=La[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(m.length,te),[x,m.length,te]),ne=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],oe[t]||"#888");return e},[m,oe]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:s,countAccessor:a,isDiverging:c,frameRef:u}){const d=!s,h=r(()=>Da(o,"question"),[o]),g=r(()=>d?Da(n,"score"):null,[d,n]),f=r(()=>d?null:Da(s,"level"),[d,s]),p=r(()=>d?null:Da(a,"count"),[d,a]),y=e||[],v=i([]),m=r(()=>{if(0===y.length)return[];let e=Ia(y,t,h,g,f,p);return c&&(e=Na(e,t),e=Ha(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var o;let n=Ia(e,t,h,g,f,p);c&&(n=Na(n,t),n=Ha(n,t)),null===(o=u.current)||void 0===o||o.replace(n)},[t,h,g,f,p,c,u]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:v,isDiverging:Z,frameRef:a}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:s="right"}){const a=i(new Set),c=i([]),[u,h]=d(0),g=ji(),f=ur(),p=l(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=l(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||a.current.has(t)||(a.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=l(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(a.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{a.current=new Set,c.current=[],h(e=>e+1)},[]);Gi(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:ft,s=t,a=i.map(e=>({[s]:e})),l=mt(a,s,r);return Ui({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:vt})},[e,t,n,o,g,f,u]),w=r(()=>{if(k)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[k,s]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:J,colorBy:ae,colorScheme:oe,showLegend:G,legendPosition:N}),ce=l(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),ue=l(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);p(o,()=>({push:ce,pushMany:ue,remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;se.current=[],le.resetCategories(),null===(e=a.current)||void 0===e||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}}),[ce,ue,le.resetCategories,se]);const de=Jr({data:ie,rawData:c,colorBy:ae,colorScheme:oe,legendInteraction:I,legendPosition:N,selection:j,linkedHover:C,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:_,onClick:P,hoverHighlight:M,chartType:"LikertChart",chartId:L,showLegend:G,userMargin:u,marginDefaults:s.marginDefaults,loading:B,emptyContent:D,width:F,height:z});if(de.earlyReturn)return de.earlyReturn;const he=r(()=>{const e=m.length;return e%2!=0&&ne.get(m[Math.floor(e/2)])||"#888"},[m,ne]),ge=O.pieceStyle,fe=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Ta||r===Ba)s={fill:he};else{const e=i||r;s=e&&ne.has(e)?{fill:ne.get(e)}:{fill:"#888"}}if(ge){const o=ge(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[ne,he,ge]),pe=r(()=>kr(fe,{stroke:R,strokeWidth:W,opacity:E}),[fe,R,W,E]),ye=r(()=>Qi(pe,de.effectiveSelectionHook,de.resolvedSelection),[pe,de.effectiveSelectionHook,de.resolvedSelection]),ve=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),me=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Ta||o===Ba?ve:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Ta||o===Ba?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:wr},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ve]),be=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!v)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return ee?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),Ur({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,f,y,v,m,ee]),xe=r(()=>[{styleFn:e=>({fill:ne.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,ne]),ke=r(()=>!1!==G?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:xe},legendPosition:N||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,N,G,xe]),we=r(()=>{const e=Object.assign({},de.margin);if(J&&!1!==G){const t=N||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(le.streamingMarginAdjust)for(const[t,o]of Object.entries(le.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Z&&100>e.left&&(e.left=100),e},[de.margin,le.streamingMarginAdjust,Z,J,G,N]),Ae=r(()=>T||(Z?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Z,T]),Se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"bar"},null!=c&&{data:ie}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Z?"horizontal":"vertical",pieceStyle:ye,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:we,barPadding:k,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Q||(Z?void 0:"Percentage"),rFormat:Ae}),H&&{oFormat:H}),{showGrid:Y}),ke),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:!0===w?me:_r(w)||me}),(C||_||P||M)&&{customHoverBehavior:de.customHoverBehavior}),(_||P||C)&&{customClickBehavior:de.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return be?e(Ir,{componentName:"LikertChart",message:be,width:F,height:z}):e(Wr,{componentName:"LikertChart",width:F,height:z,children:e(fa,Object.assign({ref:a},Se))})});Ra.displayName="LikertChart";const Wa=g(function(t,o){const n=br(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:_,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:I,strokeWidth:N,opacity:H,categoryFormat:R,rTickValues:W,tickLabelEdgeAlign:E,showCategoryTicks:F,gradientFill:z,trackFill:$,valueExtent:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,oe=r(()=>fe(a),[a]),ne=p||d,ie=r(()=>{if(null!=v)return v;if("sparkline"!==t.mode)return 40;const e=new Set(oe.map(e=>"function"==typeof u?u(e):e[u])),o=Math.max(1,e.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?q:G)-2*o)/(o-1))):1},[v,t.mode,oe,u,g,G,q]),re=Jr({data:oe,rawData:a,colorBy:ne,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:_,chartType:"SwimlaneChart",chartId:P,showLegend:U,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:L,width:G,height:q}),se=ba({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(re.earlyReturn)return re.earlyReturn;const ae=ur(),le=r(()=>new Map,[oe]),ce=A.pieceStyle,ue=r(()=>(e,t)=>{const o=ne?re.colorScale?{fill:vt(e,ne,re.colorScale)}:{}:{fill:dr(D,ae,y,t,le)};if(ce){const n=ce(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ne,re.colorScale,D,ae,y,le,ce]),de=r(()=>kr(ue,{stroke:I,strokeWidth:N,opacity:H}),[ue,I,N,H]),he=r(()=>Qi(de,re.effectiveSelectionHook,re.resolvedSelection),[de,re.effectiveSelectionHook,re.resolvedSelection]),ge=r(()=>Dr({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),pe=Ur({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:ye,effectiveMargin:ve}=pa({ref:o,frameRef:s,setup:re}),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:oe}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:he,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ve,barPadding:ie,enableHover:X}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===F?void 0:ee,rLabel:te,rFormat:f}),W&&{rTickValues:W}),null!=E&&{tickLabelEdgeAlign:E}),R&&{oFormat:R}),void 0!==F&&{showCategoryTicks:F}),{showGrid:V}),ye),ss({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:t.animate})),ls({tooltip:m,defaultTooltipContent:ge})),as({linkedHover:O,onObservation:j,onClick:C,hoverHighlight:_,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=$&&{trackFill:$}),Y&&{rExtent:Y}),se.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return pe?e(Ir,{componentName:"SwimlaneChart",message:pe,width:G,height:q}):e(Wr,{componentName:"SwimlaneChart",width:G,height:q,children:e(fa,Object.assign({ref:s},me))})});Wa.displayName="SwimlaneChart";const Ea={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Fa={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class za{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?$a(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function $a(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,u,d,h]=e[a];Ya(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;Ya(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Ya(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Ga(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function qa(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],v=[],m=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),v.push(a[b]),m+=a[b].length,s[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(m);for(f=0;v.length>f;f++)for(var k=0;v[f].length>k;k++)x[--m]=v[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=d(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function Xa(e){return e.y0-e.y1>0?"up":"down"}function Va(e,t){return t(e.source)==t(e.target)}function Ua(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function Ka(e){return e.target.x0-e.source.x1}function Qa(e,t){var o=Ja(e),n=Ka(t)/Math.tan(o);return"up"==Xa(e)?e.y1-n:e.y1+n}function Za(e,t){var o=Ja(e),n=Ka(t)/Math.tan(o);return"up"==Xa(e)?e.y1+n:e.y1-n}function Ja(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function el(e,t){return t(e)}function tl(e){return nl(e.source)}function ol(e){return nl(e.target)}function nl(e){return(e.y0+e.y1)/2}function il(e){return e.virtual?0:e.value}function rl(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Va(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Va(e,t)?n+1:n}),o+n}function sl(e){return e.target.depth}function al(e,t){return e.sourceLinks.length?e.depth:t-1}function ll(e,t){return e.y0-t.y0}function cl(e,t){return t.y0-e.y0}function ul(e,t){return e.y1-t.y1}function dl(e,t){return t.y1-e.y1}function hl(e,t){return fl(e.source,t.source)||e.index-t.index}function gl(e,t){return fl(e.target,t.target)||e.index-t.index}function fl(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function pl(e,t){return yl(e)==yl(t)?"bottom"==e.circularLinkType?cl(e,t):ll(e,t):yl(t)-yl(e)}function yl(e){return e.target.column-e.source.column}function vl(e,t){return ml(e)==ml(t)}function ml(e){return e.y0-e.y1>0?"up":"down"}function bl(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=$(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),xl(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),xl(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Va(e,t)&&Ua(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?cl:ll);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?dl:ul),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function xl(e,t,o){e.sort(pl);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Va(e,t)&&Ua(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&kl(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function kl(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function wl(e){return function(){return e}}function Al(e){return e.index}function Sl(e){return e.nodes}function Ol(e){return e.links}function jl(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=nl(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=nl(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?rl(t,o)-rl(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==rl(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function Cl(e,t,o,n,i,r){var s=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=r;l>0;--l)c(a*=.99,o),u();function c(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&rl(i,o)>0){var l=X(i.sourceLinks,ol),c=X(i.targetLinks,tl),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-nl(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=X(i.sourceLinks,ol),g=X(i.targetLinks,tl),f=((h&&g?(h+g)/2:h||g)-nl(i))*t;i.y0+=f,i.y1+=f}})})}function u(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||fl),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function _l(e){e.nodes.forEach(function(e){e.sourceLinks.sort(gl),e.targetLinks.sort(hl)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Pl(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,a=Al,l=al,c=void 0,u=32,d=2,h=Sl,g=Ol;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return V(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=Ga(o,n)),"object"!=typeof i&&(i=e.target=Ga(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=qa(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){el(e,t)!=el(i.source,t)&&el(e,t)!=el(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Va(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,il),q(e.targetLinks,il)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=$(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,g,i),jl(h,c,a),Cl(h,c,a,g,g,u),_l(h),bl(h,a,d,10,8),jl(h,c,a),Cl(h,c,a,g,g,u),_l(h),bl(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return el(o.source,t)==el(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!vl(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=Qa(t,e);return e.y1-o}if(t.target.column>e.target.column)return Qa(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return el(o.target,t)==el(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!vl(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Za(t,e);return e.y0-o}if(t.source.column>e.source.column)return Za(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=$(t,function(e){return e.y0}),s=G(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),o.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),bl(h,a,d,10,8)}(f),f}return f.update=function(e){return _l(e),bl(e,a,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:wl(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:wl(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:wl(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:wl(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],f):[[e,t],[o,n]]},f.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],f):[o-e,n-t]},f}const Ml=e=>{let t,o,n,i,r,s,a,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=ie(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`):(t=e.source.x1,o=e.target.x0,a=ie(t,o),n=a(.5),i=a(.5),r=e.y0-e.sankeyWidth/2,s=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${r}C${n},${r} ${i},${s} ${o},${s}L${o},${l}C${i},${l} ${n},${c} ${t},${c}Z`)};function Ll(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const Tl=new Set,Bl=new WeakMap;function Dl(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Bl.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Bl.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;Tl.has(e)||(Tl.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const Il={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(sl))-1:0},justify:al};function Nl(e){return"string"==typeof e?e:e.id}const Hl={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),v=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Pl().extent(m).links(v).nodes(y).nodeAlign(Il[h]||al).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of v)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of v){const t=Nl(e.source),o=Nl(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=d;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const u="vertical"===o.orientation?"down":"right",d=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(Dl(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(Dl(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=u.fill||i;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?Ll(e):Ml(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===u?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},Rl={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?u++:o?(t.x=o.x,t.y=o.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of d){const n=Wl(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=El(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=El(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const g=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===o.iterations?0:h?40:g,p=Fl(o.nodeSize,o.nodeSizeRange,e),y=e=>p(e);if(f>0){const o=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=se().force("charge",ae().strength(e=>-25*y(e))).force("center",le(a,l).strength(.8)).force("x",ce(a).strength(.15)).force("y",ue(l).strength(.15));if(n.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.force("link",o),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;f>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.edgeStyle,g=Fl(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Dl(t,"nodeSize")),n=d?d(Dl(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(Dl(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=g(Dl(o,"nodeSize"));m.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:v,labels:m}}};function Wl(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function El(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function Fl(e,t,o){var n,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(n=$(s))&&void 0!==n?n:0,l=null!==(i=G(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=k().domain([a,l]).range(r).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?r[0]:c(n)}}const zl=qe,$l={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-r,c=n[0]/2,u=n[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=g.get("string"==typeof e.source?e.source:e.source.id),n=g.get(t);if(void 0===o||void 0===n)continue;const i=d(e);p[o][n]=i}const y=he().padAngle(i);s&&y.sortGroups(s);const v=y(p),m=v.groups,b=W().innerRadius(l).outerRadius(a);for(const t of m){const o=e[t.index],n=b.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of v){const o=e[t.source.index].id,n=e[t.target.index].id,i=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);i&&(i.__chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,u=Math.min(n[0],n[1])/2,d=u-l,h=n[0]/2,g=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,y=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:zl,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=de().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=f?f(Dl(o,"nodeStyle")).fill||m.get(o.id)||v[t%v.length]:m.get(o.id)||v[t%v.length];const s=f?f(Dl(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=b(t);if(!n)continue;const i=Yl(n,h,g);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(Dl(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===y&&o?l=m.get(o.id)||l:t&&(l=m.get(t.id)||l)}const u=p?p(Dl(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+12;for(const o of e){const e=o.__arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*n,y:g+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Yl(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const Gl=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function ql(e){const[t,o,n]=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*o+.114*n>150?"#222":"#fff"}function Xl(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Vl(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}function Ul(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Gl}function Kl(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Ql(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const Zl={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),l=o.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,u=K(r,a);u.sum(c),u.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=oe();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([o,n]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(u,o,d,h);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([o,n]).padding(r)(e)}(u,o,d,h);break;case"partition":!function(e,t,o,n){var i;Q().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,o,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const n=g[t],r={id:Xl(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?Jl(r,n,o):"treemap"===s||"partition"===s?ec(r,n):"circlepack"===s&&tc(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,u,d,h,g;const f=[],p=[],y=[],v=o.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const r=i(Dl(t,"nodeStyle"));let l=r.fill||Kl(o);if(o.colorByDepth&&void 0!==t.depth){const e=Ul(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;m&&(i+=b,s+=x,a+=b,l+=x);const g=Ql(i,s,a,l,v),f=r(Dl(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=Vl(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(m&&(s+=b,a+=x),m){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===v?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],u=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(Dl(o,"nodeStyle"));let l=a.fill||Kl(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ul(t);l=e[o.depth%e.length]}const u={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Vl(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=n(Dl(c,"nodeStyle")).fill||Kl(t);if(t.colorByDepth&&void 0!==c.depth){const e=Ul(t);f=e[c.depth%e.length]}const p="string"==typeof f?ql(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(Dl(o,"nodeStyle"));let c=l.fill||Kl(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ul(t);c=e[o.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:o.x,cy:o.y,r:e,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Vl(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(Dl(i,"nodeStyle")).fill||Kl(t);if(t.colorByDepth&&void 0!==i.depth){const e=Ul(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?ql(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Jl(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function ec(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function tc(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function oc(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const nc={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),u=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,d=null!==(s=o.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=oc(o);f.metaMap.clear(),n.length=0,i.length=0;const p=new Map;function y(e){var t;const o=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,s,u,d,p){const v=a(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const A=(m+1)/b,S={id:o,depth:d,data:t,parentId:o},O=p?u/h(S)*A:u*A,j=E().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=j(k),_=g(S);for(let t=0;k.length>t;t++){const a=(C[t].startAngle+C[t].endAngle)/2,c=k[t],u=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*_;n.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:a,depth:d,parentId:o,eccentricity:_}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=oc(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Dl(t,"nodeSize")),n=d?d(Dl(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),o="object"==typeof e.target?e.target:v.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(Dl(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=oc(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},ic={sankey:Hl,force:Rl,chord:$l,tree:Zl,cluster:Zl,treemap:Zl,circlepack:Zl,partition:Zl,orbit:nc};function rc(e){return ic[e]}class sc{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Ea),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new za(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Ea),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new za(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},ac(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=Number(u(o))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},ac(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},ac(i)),{data:o}));const s=`${n}\0${i}\0${e}`;this.edges.set(s,{source:n,target:i,value:r,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:s})}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,ac(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,ac(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=rc(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,o,n,i,r,s;const a=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=Is(this.config.colorScheme,this.config.themeCategorical,qe),u={nodes:a,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:Ns(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let d;try{d=this.config.customNetworkLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(n=d.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=d.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=rc(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=rc(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=rc(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return o.tick(n,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),o=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,o),e.x1=St(e._prevX1,e._targetX1,o),e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const u=e-c;a>u&&(t._pulseIntensity=1-u/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=xt(o,a,n),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function ac(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function lc(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=cc(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(r=e,a=o)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){const t=fc(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function cc(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>Dt(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=Bt(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=Ht(Math.atan2(i,n)),a=Ht(e.startAngle),l=Ht(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}let uc=null,dc=null;function hc(){return dc||(uc=document.createElement("canvas"),uc.width=1,uc.height=1,dc=uc.getContext("2d")),dc}function gc(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function fc(e,t,o){switch(e.type){case"bezier":return function(e,t,o){var n,i;if(!e.pathD)return null;const r=gc(e),s=hc();if(!r||!s)return null;try{if(s.isPointInPath(r,t,o)){const r="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,s="object"==typeof(null===(i=e.datum)||void 0===i?void 0:i.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:r&&s?(r.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:o,distance:0}}const a=s.lineWidth;s.lineWidth=10;const l=s.isPointInStroke(r,t,o);if(s.lineWidth=a,l)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=gc(e),i=hc();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function pc(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=i;return t(o,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,o)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),x&&x.filter(e=>"widget"!==e.type).map((t,o)=>{if(k){const i=k(t,o,{width:r,height:s,sceneNodes:b});if(i)return e(n.Fragment,{children:i},"annotation-"+o)}return null}),m]}),d&&"string"==typeof d?e("text",{x:a/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:d}):d?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:d}):null,Co({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:v,title:d,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,o)=>{var n,i,r,s,a,l,u,d,h;const g=b.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(n=g.cx)&&void 0!==n?n:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,m=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-m/2,top:p+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function yc(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function vc(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=yc(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=qt(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function mc(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=qt(e,i)||i,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function bc(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=yc(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function xc(e,t){var o,n;if(!t.pathD)return;e.save();const i=yc(t),r=t.style.stroke||"#999";e.strokeStyle=qt(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}pc.displayName="NetworkSVGOverlay";const kc={top:20,right:80,bottom:20,left:80},wc={top:40,right:40,bottom:40,left:40},Ac=new Set(["chord","force","circlepack","orbit"]),Sc=[800,600],Oc={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 jc({data:o}){var n,i,r,s,a,l;if("edge"===o.nodeOrEdge){const e=o.data;return e?t("div",{className:"semiotic-tooltip",style:Oc,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=o.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const o=[];let a=u;for(;a;){const e=null!==(s=null!==(i=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&o.unshift(e+""),a=a.parent}o.length>1&&o.shift();const l=o.length-1;return t("div",{className:"semiotic-tooltip",style:Oc,children:[e("div",{children:o.map((o,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===l?e("strong",{children:o}):e("span",{style:{opacity:.7},children:o})]},n))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Oc,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}const Cc=g(function(o,n){var a,c,u,h,g,f,y,v,m,b,x,k,w,A,S,O,j,C;const{chartType:_,nodes:P,edges:M,data:L,initialEdges:T,nodeIDAccessor:B="id",sourceAccessor:D="source",targetAccessor:I="target",valueAccessor:N="value",edgeIdAccessor:H,childrenAccessor:R,hierarchySum:E,orientation:F="horizontal",nodeAlign:z="justify",nodePaddingRatio:$=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Q="vertical",edgeType:Z="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:oe=!1,particleStyle:ne,nodeStyle:ie,edgeStyle:re,colorBy:se,colorScheme:ae="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:ue=!1,nodeSize:de=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:pe=!0,labelMode:ye,size:ve=Sc,responsiveWidth:me,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:je,customClickBehavior:Ce,onObservation:_e,chartId:Pe,onTopologyChange:Me,annotations:Le,svgAnnotationRules:Te,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,title:We,foregroundGraphics:Ee,backgroundGraphics:Fe,decay:ze,pulse:$e,transition:Ye,animate:Ge,staleness:qe,thresholds:Xe,accessibleTable:Ve=!0,description:Ue,summary:Ke,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}=o,at=Ac.has(_)?wc:kc,lt=i(!0),ct=qn({sizeProp:ve,responsiveWidth:me,responsiveHeight:be,userMargin:xe,marginDefault:at,foregroundGraphics:Ee,backgroundGraphics:Fe,animate:Ge,transitionProp:Ye,themeDirtyRef:lt}),{reducedMotionRef:ut,responsiveRef:dt,size:ht,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:vt,resolvedBackground:mt,transition:bt,introEnabled:xt,tableId:kt,rafRef:wt,renderFnRef:At,scheduleRender:St,currentTheme:Ot}=ct,jt=un(),Ct=fn(),_t=r(()=>fe(P),[P]),Pt=r(()=>Array.isArray(M)?fe(M):M,[M]),Mt=r(()=>Object.assign(Object.assign({},Ea),te),[te]),Lt=r(()=>Object.assign(Object.assign({},Fa),ne),[ne]),Bt=r(()=>{var e;return{chartType:_,nodeIDAccessor:B,sourceAccessor:D,targetAccessor:I,valueAccessor:N,edgeIdAccessor:H,childrenAccessor:R,hierarchySum:E,orientation:F,nodeAlign:z,nodePaddingRatio:$,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Mt,showParticles:oe,particleStyle:Lt,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:ae,themeCategorical:null===(e=null==Ot?void 0:Ot.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Ot),edgeColorBy:le,edgeOpacity:ce,colorByDepth:ue,nodeSize:de,nodeSizeRange:he,decay:ze,pulse:$e,transition:bt,introAnimation:xt,staleness:qe,thresholds:Xe,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}},[_,B,D,I,N,R,E,F,z,$,Y,G,q,X,V,U,K,Q,Z,J,ee,Mt,oe,Lt,ie,re,ge,pe,ye,se,ae,le,ce,ue,de,he,ze,$e,null==bt?void 0:bt.duration,null==bt?void 0:bt.easing,xt,qe,Xe,Qe,Ze,Je,et,tt,ot,nt,it,Ot,rt,st]),Dt=yn(Bt),It=i(null),Nt=i(0),Ht=i(0),Rt=i(!1),Wt=i(null);Wt.current||(Wt.current=new sc(Dt));const[Et,Ft]=d(null),[zt,$t]=d(0),[Yt,Gt]=d(0),[Xt,Vt]=d(!1),[Ut,Kt]=d(null),Qt=i(null),Zt=i(new Map),Jt=i(0),eo=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ae)?ae:gt;Zt.current.set(t+"",e[Jt.current++%e.length])}return Zt.current.get(t+"")}}if(Zt.current.has(e.id))return Zt.current.get(e.id);const t=Array.isArray(ae)?ae:gt,o=se?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[se,ae]),to=(null===(a=null==Ot?void 0:Ot.colors)||void 0===a?void 0:a.border)||(null===(c=null==Ot?void 0:Ot.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==Ot?void 0:Ot.colors)||void 0===u?void 0:u.primary)||"#999",oo=l(e=>{if("function"==typeof le)return le(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===le&&o?eo(o):t?eo(t):to},[le,eo,to]),no=l(e=>{if(!(null==ne?void 0:ne.colorBy))return oo(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===Lt.colorBy&&o?eo(o):t?eo(t):to},[null==ne?void 0:ne.colorBy,Lt.colorBy,eo,oo,to]),io="sankey"===_&&oe||!!$e||null!==(g=null===(h=Wt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;s(()=>{var e;null===(e=Wt.current)||void 0===e||e.updateConfig(Dt),lt.current=!0,St()},[Dt,St]);const ro=l(()=>{var e,t;Kt(null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);s(()=>{var e;const t=Wt.current;if(t){t.buildScene([pt,yt]),ro();for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);lt.current=!0,St()}},[Ot,pt,yt,St,ro]);const so=l(()=>{var e;const t=Wt.current;if(!t)return;t.runLayout([pt,yt]),t.buildScene([pt,yt]),ro(),lt.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);const o=Array.isArray(ae)?ae:gt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];Zt.current.has(t.id)||Zt.current.set(t.id,o[e%o.length])}if(Jt.current=n.length,$t(t.layoutVersion),Me){const{nodes:e,edges:o}=t.getLayoutData();Me(e,o)}},[pt,yt,Me,ae,ro]),ao=l(e=>{if(null==e||"object"!=typeof e)return;const t=Wt.current;t&&(t.ingestEdge(e)&&so(),St())},[so,St]),lo=l(e=>{const t=Wt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&so(),St()},[so,St]),co=l(()=>{var e;null===(e=Wt.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,$t(0),Ft(null),Qt.current=null,lt.current=!0,St()},[St]),fo=l(()=>{const e=Wt.current;e&&(e.tension+=999,so(),St())},[so,St]);p(n,()=>({push:ao,pushMany:lo,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=Wt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=Qt.current)||void 0===n?void 0:n.data)?"function"==typeof B?B(Qt.current.data):Qt.current.data[B]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,Ft(null)),Zt.current.delete(e),so(),lt.current=!0,St()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=Wt.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(Qt.current&&"edge"===Qt.current.nodeOrEdge){const o=Qt.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!H||!o||("function"==typeof H?H:e=>null==e?void 0:e[H])(o)===e,n&&(Qt.current=null,Ft(null))}so(),lt.current=!0,St()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=Wt.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(lt.current=!0,St()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=Wt.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(so(),lt.current=!0,St()),r},clear:co,getTopology:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Wt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:fo,getTension:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[ao,lo,co,fo,so,St]);const yo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),mo=yo?L||(Array.isArray(M)?void 0:M):void 0;s(()=>{var e;const t=Wt.current;if(t)if(yo&&mo)t.ingestHierarchy(mo,[pt,yt]),t.buildScene([pt,yt]),ro(),lt.current=!0,St();else{const o=_t,n=Array.isArray(Pt)?Pt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[pt,yt]),t.buildScene([pt,yt]),ro();for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill+"");const i=Array.isArray(ae)?ae:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];Zt.current.has(t.id)||Zt.current.set(t.id,i[e%i.length])}Jt.current=r.length,lt.current=!0,St()}},[_t,Pt,L,mo,yo,pt,yt,Dt,St,ae,ro]),s(()=>{T&&T.length>0&&lo(T)},[]);const bo=l(e=>{if(je&&je(e),_e){const t=Date.now();_e(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[je,_e,Pe]),xo=l(e=>{if(Ce&&Ce(e),_e){const t=Date.now();_e(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[Ce,_e,Pe]),{hoverHandlerRef:ko,hoverLeaveRef:wo,onPointerMove:Ao,onPointerLeave:So}=ct;ko.current=e=>{if(!Se)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return void(Qt.current&&(Qt.current=null,Ft(null),bo&&(bo(null),lt.current=!0),St()));const r=Wt.current;if(!r)return;const s=lc(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,Ft(null),bo&&(bo(null),lt.current=!0),St()));const a=li(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,Ft(a),bo&&(bo(a),lt.current=!0),St()},wo.current=()=>{Qt.current&&(Qt.current=null,Ft(null),bo&&(bo(null),lt.current=!0),St())};const Oo=i(()=>{});Oo.current=e=>{if(!Ce&&!_e)return;const t=It.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return;const r=Wt.current;if(!r)return;const s=lc(r.sceneNodes,r.sceneEdges,n,i);xo(s?li(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const jo=l(e=>Oo.current(e),[]),Co=i(-1),_o=i(null),Po=i(-1),Mo=l(e=>{var t;const o=Wt.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)"circle"===l.type&&null!=l.cx?a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"}):"rect"===l.type&&null!=l.x?a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"}):"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=uo(n),r=Co.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Co.current=0,Po.current=-1;const t=i.flat[0];_o.current={shape:t.shape,w:t.w,h:t.h};const o=li(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,Ft(o),bo&&(bo(o),lt.current=!0),void St()}const s=ho(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return go(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=po(t.source),s=po(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=go(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],Po);if(null===a)return;if(e.preventDefault(),0>a)return Co.current=-1,_o.current=null,Po.current=-1,Qt.current=null,Ft(null),bo&&(bo(null),lt.current=!0),void St();Co.current=a;const l=i.flat[a];_o.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qt.current=c,Ft(c),bo&&(bo(c),lt.current=!0),St()},[bo,St]),Lo=l(e=>{Co.current=-1,_o.current=null,Ao(e)},[Ao]);At.current=()=>{var e,t,o,n,i,r,s;wt.current=0;const a=It.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Wt.current;if(!c)return;const u=performance.now(),d=Nt.current?Math.min((u-Nt.current)/1e3,.1):.016;Nt.current=u;const h=c.advanceTransition(ut.current?u+1e6:u),g=!ut.current&&h,f=!ut.current&&c.tickAnimation([pt,yt],d);(h||lt.current||f)&&c.buildScene([pt,yt]);const p=Vn();if(!Xn(a,ht,ft,p))return;if(l.clearRect(-ft.left,-ft.top,ht[0],ht[1]),Ae){const e=qt(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,pt,yt))}ze&&c.applyDecay(),$e&&c.applyPulse(u),Xe&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==qe?void 0:qe.threshold)&&void 0!==e?e:5e3,v=qe&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(v&&(l.globalAlpha=null!==(t=null==qe?void 0:qe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":vc(e,o);break;case"line":mc(e,o);break;case"ribbon":bc(e,o);break;case"curved":xc(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Jn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),ei(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!v){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:Fa.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:Fa.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,Lt);const t=.5*(null!==(o=Lt.speedMultiplier)&&void 0!==o?o:1);let n;if(Lt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:Fa.radius,l=null!==(s=n.opacity)&&void 0!==s?s:Fa.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(l){if("function"==typeof n.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?n.color(l,t):qt(e,"var(--semiotic-secondary, #666)")}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:i(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,Lt,no)}}v&&(l.globalAlpha=1);const m=lt.current;if(lt.current=!1,m||g||f){const e=It.current;e&&e.setAttribute("aria-label",On(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=m||g||f||Rt.current;b&&u-Ht.current>=33?(Gt(e=>e+1),Ht.current=u,Rt.current=!1):Rt.current=!!b,(io||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Rt.current)&&(wt.current=requestAnimationFrame(()=>At.current()))},pn({hydrated:jt,wasHydratingFromSSR:Ct,storeRef:Wt,dirtyRef:lt,renderFnRef:At}),s(()=>{lt.current=!0,St()},[_,pt,yt,Ae,St]),vo(qe,Wt,lt,St,Xt,Vt);const To=Se&&Et?e(Fn,{x:Et.x,y:Et.y,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(Et):e(jc,{data:Et})}):null;if(ln||!jt&&Ct){const o=Wt.current;if(o){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),t=e?L||(Array.isArray(M)?void 0:M):void 0;if(e&&t)o.ingestHierarchy(t,[pt,yt]),o.buildScene([pt,yt]);else{const e=_t,t=Array.isArray(Pt)?Pt:[];(e.length>0||t.length>0)&&(o.ingestBounded(e,t,[pt,yt]),o.buildScene([pt,yt]))}}const n=null!==(f=null==o?void 0:o.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==o?void 0:o.sceneEdges)&&void 0!==y?y:[],r=null!==(v=null==o?void 0:o.labels)&&void 0!==v?v:[];return t("div",{ref:dt,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ue||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1]},children:[e(Nn,{summary:Ke}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ht[0],height:ht[1],style:{position:"absolute",left:0,top:0},children:[mt&&e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt}),t("g",{transform:`translate(${ft.left},${ft.top})`,children:[Ae&&e("rect",{x:0,y:0,width:pt,height:yt,fill:Ae}),i.map((t,o)=>function(t,o){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:an(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),n.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=W().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(sn)||"";return e("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:an(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),r.map((t,o)=>function(t,o){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e(pc,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:r,sceneNodes:n,title:We,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Tt(vt,null===(m=Wt.current)||void 0===m?void 0:m.customLayoutOverlays),annotations:Le,svgAnnotationRules:Te,annotationFrame:0})]})}const Bo=Wt.current;return t("div",{ref:dt,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ue||("string"==typeof We?We:"Network chart"),tabIndex:0,style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1],overflow:"visible"},onKeyDown:Mo,children:[Ve&&e(Hn,{tableId:kt}),Ve&&e(In,{nodes:null!==(b=null==Bo?void 0:Bo.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==Bo?void 0:Bo.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:kt,chartTitle:"string"==typeof We?We:void 0}),e(Nn,{summary:Ke}),t("div",{role:"img","aria-label":Ue||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?Lo:void 0,onMouseLeave:Se?So:void 0,onClick:Ce||_e?jo:void 0,children:[mt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ht[0],height:ht[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt})}),e("canvas",{ref:It,"aria-label":On(null!==(w=null===(k=null==Bo?void 0:Bo.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==Bo?void 0:Bo.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Rn,{hoverPoint:Et}),e(pc,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:(null==Bo?void 0:Bo.labels)||[],sceneNodes:null==Bo?void 0:Bo.sceneNodes,title:We,legend:Be,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Ne,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Tt(vt,Ut),annotations:Le,svgAnnotationRules:Te,annotationFrame:Yt}),e(En,{active:Co.current>=0,hoverPoint:Et,margin:ft,size:ht,shape:null===(O=_o.current)||void 0===O?void 0:O.shape,width:null===(j=_o.current)||void 0===j?void 0:j.w,height:null===(C=_o.current)||void 0===C?void 0:C.h}),To,(null==qe?void 0:qe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===qe.badgePosition?{top:4,left:4}:"bottom-left"===qe.badgePosition?{bottom:4,left:4}:"bottom-right"===qe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Xt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Xt?"STALE":"LIVE"})]})]})});Cc.displayName="StreamNetworkFrame";const _c=g(function(t,o){var n;const s=i(null);es(o,{variant:"network",frameRef:s});const a=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:j,frameProps:C={},onObservation:_,onClick:P,chartId:M,selection:L,linkedHover:T,loading:B,emptyContent:D,legendInteraction:I,legendPosition:N,stroke:H,strokeWidth:R,opacity:W}=t,E=null!==(n=null!=h?h:g)&&void 0!==n?n:"id",{width:F,height:z,enableHover:$,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=a,K=r(()=>fe(l),[l]),Q=r(()=>fe(c),[c]),Z=$r(B,F,z),J=Z?null:zr(void 0===l?void 0:K,F,z,D),ee=hr(K,v,m),te=r(()=>{if(!v)return[];const e=new Set;for(const t of K){const o="function"==typeof v?v(t):t[v];null!=o&&e.add(o+"")}return Array.from(e)},[K,v]),oe=vr(I,v,te),ne=ur(),ie=r(()=>new Map,[]),re=r(()=>{if(Array.isArray(m))return m;if(ne&&ne.length>0)return ne;const e=ht[m];return Array.isArray(e)?e:gt},[m,ne]),se=r(()=>e=>{const t={};return t.fill=v?vt(e.data||e,v,ee):dr(void 0,ne,m,void 0,ie),"number"==typeof b&&(t.r=b),t},[v,ee,b,ne,m,ie]),ae=r(()=>kr(se,{stroke:H,strokeWidth:R,opacity:W}),[se,H,R,W]),le=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ce=r(()=>kr(le,{stroke:H,strokeWidth:R,opacity:W}),[le,H,R,W]),ue=r(()=>{if(G&&y)return"function"==typeof y?y:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==o?o:e[y])&&void 0!==n?n:e.id}},[G,y]),{legend:de,margin:he,legendPosition:ge}=yr({data:K,colorBy:v,colorScale:ee,showLegend:Y,legendPosition:N,userMargin:u,defaults:a.marginDefaults}),{customHoverBehavior:pe,customClickBehavior:ye}=fr({selection:L,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:_,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),ve=Qr({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:E}});return ve?e(Ir,{componentName:"ForceDirectedGraph",message:ve,width:F,height:z}):Z||J||e(Wr,{componentName:"ForceDirectedGraph",width:F,height:z,children:e(Cc,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:K},null!=c&&{edges:Q},{size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he,nodeIDAccessor:E,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ae,edgeStyle:ce,colorBy:v,colorScheme:re,nodeSize:b,nodeSizeRange:x,nodeLabel:ue,showLabels:G,enableHover:$,tooltipContent:!1===j?()=>null:_r(j)||void 0,customHoverBehavior:T||_||P?pe:void 0,customClickBehavior:_||P?ye:void 0,legend:de,legendPosition:ge},I&&"none"!==I&&{legendHoverBehavior:oe.onLegendHover,legendClickBehavior:oe.onLegendClick,legendHighlightedCategory:oe.highlightedCategory,legendIsolatedCategories:oe.isolatedCategories},{className:d,title:q,description:X,summary:V,accessibleTable:U},null!=t.animate&&{animate:t.animate},C))})});function Pc(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function Mc(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function Lc(e){return"function"==typeof e?e:t=>t[e]||1}function Tc({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}_c.displayName="ForceDirectedGraph";const Bc=g(function(t,o){const n=i(null);es(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",padAngle:m=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:j,chartId:C,selection:_,linkedHover:P,loading:M,emptyContent:L,legendInteraction:T,stroke:B,strokeWidth:D,opacity:I}=t,{width:N,height:H,enableHover:R,showLabels:W=!0,title:E,description:F,summary:z,accessibleTable:$}=s,Y=r(()=>fe(l),[l]),G=r(()=>fe(a),[a]),q=$r(M,N,H),X=q?null:zr(void 0===l?void 0:Y,N,H,L),V=r(()=>Mc(G,Y,d,h),[G,Y,d,h]),U=hr(V,p,y),K=r(()=>{if(!p)return[];const e=new Set;for(const t of V){const o="function"==typeof p?p(t):t[p];null!=o&&e.add(o+"")}return Array.from(e)},[V,p]),Q=vr(T,p,K),Z=ur(),J=r(()=>new Map,[]),ee=r(()=>{if(Array.isArray(y))return y;if(Z&&Z.length>0)return Z;const e=ht[y];return Array.isArray(e)?e:gt},[y,Z]),te=V.length>0,oe=r(()=>{if(te)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(p)i.fill=vt(e.data||e,p,U);else{const r=Array.isArray(y)?y:ht[y]||gt,s=Array.isArray(r)?r:gt,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[te,p,U,y]),ne=r(()=>oe?kr(oe,{stroke:B,strokeWidth:D,opacity:I}):void 0,[oe,B,D,I]),ie=r(()=>{if(te)return Tc({edgeColorBy:v,colorBy:p,colorScale:U,nodeStyleFn:ne||(e=>({fill:dr(void 0,Z,y,void 0,J)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[te,v,p,U,ne,w,Z,y,J]),re=r(()=>ie?kr(ie,{stroke:B,strokeWidth:D,opacity:I}):void 0,[ie,B,D,I]),se=r(()=>{if(!W)return;const e=k||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[W,k,f]),ae=Object.assign(Object.assign({},s.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:le,customClickBehavior:ce}=fr({selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:O,onClick:j,chartType:"ChordDiagram",chartId:C}),ue=Qr({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return ue?e(Ir,{componentName:"ChordDiagram",message:ue,width:N,height:H}):q||X||e(Wr,{componentName:"ChordDiagram",width:N,height:H,children:e(Cc,Object.assign({ref:n,chartType:"chord"},V.length>0&&{nodes:V},null!=l&&{edges:Y},{size:[N,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,padAngle:m,groupWidth:b,sortGroups:x,nodeStyle:ne,edgeStyle:re,colorBy:p,colorScheme:ee,edgeColorBy:v,edgeOpacity:w,nodeLabel:se,showLabels:W,enableHover:R,tooltipContent:!1===A?()=>null:_r(A)||void 0,customHoverBehavior:P||O||j?le:void 0,customClickBehavior:O||j?ce:void 0},T&&"none"!==T&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:u,title:E,description:F,summary:z,accessibleTable:$},null!=t.animate&&{animate:t.animate},S))})});Bc.displayName="ChordDiagram";const Dc=g(function(t,o){const n=i(null);es(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:a,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",orientation:m="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:j={},onObservation:C,onClick:_,chartId:P,selection:M,linkedHover:L,loading:T,emptyContent:B,legendInteraction:D,stroke:I,strokeWidth:N,opacity:H}=t,{width:R,height:W,enableHover:E,showLabels:F=!0,title:z,description:$,summary:Y,accessibleTable:G}=s,q=r(()=>fe(l),[l]),X=r(()=>fe(a),[a]),V=$r(T,R,W),U=V?null:zr(void 0===l?void 0:q,R,W,B),K=r(()=>Mc(X,q,d,h),[X,q,d,h]),Q=hr(K,p,y),Z=r(()=>{if(!p)return[];const e=new Set;for(const t of K){const o="function"==typeof p?p(t):t[p];null!=o&&e.add(o+"")}return Array.from(e)},[K,p]),J=vr(D,p,Z),ee=ur(),te=r(()=>new Map,[]),oe=r(()=>{if(Array.isArray(y))return y;if(ee&&ee.length>0)return ee;const e=ht[y];return Array.isArray(e)?e:gt},[y,ee]),ne=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?vt(e.data||e,p,Q):dr(void 0,ee,y,void 0,te),t},[p,Q,ee,y,te]),ie=r(()=>kr(ne,{stroke:I,strokeWidth:N,opacity:H}),[ne,I,N,H]),re=r(()=>Tc({edgeColorBy:v,colorBy:p,colorScale:Q,nodeStyleFn:ie,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[v,p,Q,ie,A]),se=r(()=>kr(re,{stroke:I,strokeWidth:N,opacity:H}),[re,I,N,H]),ae=r(()=>{if(!F)return;const e=w||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[F,w,f]),le=Object.assign(Object.assign({},s.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:ce,customClickBehavior:ue}=fr({selection:M,linkedHover:L,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:C,onClick:_,chartType:"SankeyDiagram",chartId:P}),de=Qr({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return de?e(Ir,{componentName:"SankeyDiagram",message:de,width:R,height:W}):V||U||e(Wr,{componentName:"SankeyDiagram",width:R,height:W,children:e(Cc,Object.assign({ref:n,chartType:"sankey"},K.length>0&&{nodes:K},null!=l&&{edges:q},{size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,orientation:m,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:ie,edgeStyle:se,colorBy:p,colorScheme:oe,edgeColorBy:v,edgeOpacity:A,edgeSort:S,nodeLabel:ae,showLabels:F,enableHover:E,tooltipContent:!1===O?()=>null:_r(O)||void 0,customHoverBehavior:L||C||_?ce:void 0,customClickBehavior:C||_?ue:void 0},D&&"none"!==D&&{legendHoverBehavior:J.onLegendHover,legendClickBehavior:J.onLegendClick,legendHighlightedCategory:J.highlightedCategory,legendIsolatedCategories:J.isolatedCategories},{className:u,title:z,description:$,summary:Y,accessibleTable:G},null!=t.animate&&{animate:t.animate},j))})});function Ic(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:v=5,tooltip:m,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,legendInteraction:j,stroke:C,strokeWidth:_,opacity:P}=t,{width:M,height:L,enableHover:T,showLabels:B=!0,title:D,description:I,summary:N,accessibleTable:H}=o,R=$r(O,M,L),W=r(()=>Pc(null!=n?n:null,c),[n,c]),E=hr(W,f?void 0:h,g),F=r(()=>{if(!h||f)return[];const e=new Set;for(const t of W){const o="function"==typeof h?h(t):t[h];null!=o&&e.add(o+"")}return Array.from(e)},[W,h,f]),z=vr(j,f?void 0:h,F),$=ur(),Y=r(()=>new Map,[]),G=r(()=>{if(Array.isArray(g))return g;if($&&$.length>0)return $;const e=ht[g];return Array.isArray(e)?e:gt},[g,$]),q=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?vt(e.data||e,h,E):dr(void 0,$,g,void 0,Y),t},[h,f,E,$,g,Y]),X=r(()=>kr(q,{stroke:C,strokeWidth:_,opacity:P}),[q,C,_,P]),V=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),U=r(()=>kr(V,{stroke:C,strokeWidth:_,opacity:P}),[V,C,_,P]),K=r(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Lc(u)},[a,u]),Q=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:Z,customClickBehavior:J}=fr({selection:A,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w}),ee=Kr({componentName:"TreeDiagram",data:n});return ee?e(Ir,{componentName:"TreeDiagram",message:ee,width:M,height:L}):R||e(Wr,{componentName:"TreeDiagram",width:M,height:L,children:e(Cc,Object.assign({chartType:a},null!=n&&{data:n},{size:[M,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,treeOrientation:l,edgeType:p,nodeStyle:X,edgeStyle:U,colorBy:h,colorScheme:G,colorByDepth:f,nodeSize:v,nodeLabel:B?y||d:void 0,showLabels:B,enableHover:T,tooltipContent:!1===m?()=>null:_r(m)||void 0,customHoverBehavior:S||x||k?Z:void 0,customClickBehavior:x||k?J:void 0},j&&"none"!==j&&{legendHoverBehavior:z.onLegendHover,legendClickBehavior:z.onLegendClick,legendHighlightedCategory:z.highlightedCategory,legendIsolatedCategories:z.isolatedCategories},{className:s,title:D,description:I,summary:N,accessibleTable:H},null!=t.animate&&{animate:t.animate},b))})}function Nc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:v,tooltip:m,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:O,legendInteraction:j,stroke:C,strokeWidth:_,opacity:P}=t,{width:M,height:L,enableHover:T,showLabels:B=!0,title:D,description:I,summary:N,accessibleTable:H}=o,R=$r(O,M,L),{activeSelectionHook:W,customHoverBehavior:E,customClickBehavior:F}=fr({selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:w,onClick:A,chartType:"Treemap",chartId:S}),z=Zr(x),$=l(e=>{if(!e)return E(null);const t=e.data||e;E({data:(null==t?void 0:t.data)||t})},[E]),Y=r(()=>Pc(null!=n?n:null,a),[n,a]),G=hr(Y,g?void 0:d,h),q=r(()=>{if(!d||g)return[];const e=new Set;for(const t of Y){const o="function"==typeof d?d(t):t[d];null!=o&&e.add(o+"")}return Array.from(e)},[Y,d,g]),X=vr(j,g?void 0:d,q),V=ur(),U=r(()=>new Map,[]),K=r(()=>{if(Array.isArray(h))return h;if(V&&V.length>0)return V;const e=ht[h];return Array.isArray(e)?e:gt},[h,V]),Q=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:d?vt(e.data||e,d,G):dr(void 0,V,h,void 0,U),t},[d,g,G,V,h,U]),Z=r(()=>kr(Q,{stroke:C,strokeWidth:_,opacity:P}),[Q,C,_,P]),J=r(()=>W?e=>{var t;const o=Object.assign({},Z(e));if(W.isActive)if(W.predicate(e.data||e))(null==z?void 0:z.selectedStyle)&&Object.assign(o,z.selectedStyle);else{const e=null!==(t=null==z?void 0:z.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==z?void 0:z.unselectedStyle)&&Object.assign(o,z.unselectedStyle)}return o}:Z,[Z,W,z]),ee=r(()=>Lc(c),[c]),te=void 0!==v?v:!B||"parent"!==f&&"all"!==f?void 0:18,oe=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),ne=Kr({componentName:"Treemap",data:n});return ne?e(Ir,{componentName:"Treemap",message:ne,width:M,height:L}):R||e(Wr,{componentName:"Treemap",width:M,height:L,children:e(Cc,Object.assign({chartType:"treemap"},null!=n&&{data:n},{size:[M,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,nodeIDAccessor:u,childrenAccessor:a,hierarchySum:ee,padding:y,paddingTop:te,nodeStyle:J,colorBy:d,colorScheme:K,colorByDepth:g,nodeLabel:B?p||u:void 0,showLabels:B,labelMode:f,enableHover:T,tooltipContent:!1===m?()=>null:_r(m)||void 0},(k||w||A)&&{customHoverBehavior:$},(w||A)&&{customClickBehavior:F},j&&"none"!==j&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories},{className:s,title:D,description:I,summary:N,accessibleTable:H},null!=t.animate&&{animate:t.animate},b))})}function Hc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:v={},onObservation:m,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S,stroke:O,strokeWidth:j,opacity:C}=t,{width:_,height:P,enableHover:M,showLabels:L=!0,title:T,description:B,summary:D,accessibleTable:I}=o,N=$r(A,_,P),H=r(()=>Pc(null!=n?n:null,a),[n,a]),R=hr(H,h?void 0:u,d),W=r(()=>{if(!u||h)return[];const e=new Set;for(const t of H){const o="function"==typeof u?u(t):t[u];null!=o&&e.add(o+"")}return Array.from(e)},[H,u,h]),E=vr(S,h?void 0:u,W),F=ur(),z=r(()=>new Map,[]),$=r(()=>{if(Array.isArray(d))return d;if(F&&F.length>0)return F;const e=ht[d];return Array.isArray(e)?e:gt},[d,F]),Y=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:u?vt(e.data||e,u,R):dr(void 0,F,d,void 0,z),t},[u,h,R,f,F,d,z]),G=r(()=>kr(Y,{stroke:O,strokeWidth:j,opacity:C}),[Y,O,j,C]),q=r(()=>Lc(l),[l]),X=Object.assign(Object.assign({},o.marginDefaults),"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:V,customClickBehavior:U}=fr({selection:k,linkedHover:w,fallbackFields:u?["string"==typeof u?u:""]:[],unwrapData:!0,onObservation:m,onClick:b,chartType:"CirclePack",chartId:x}),K=Kr({componentName:"CirclePack",data:n});return K?e(Ir,{componentName:"CirclePack",message:K,width:_,height:P}):N||e(Wr,{componentName:"CirclePack",width:_,height:P,children:e(Cc,Object.assign({chartType:"circlepack"},null!=n&&{data:n},{size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:q,padding:p,nodeStyle:G,colorBy:u,colorScheme:$,colorByDepth:h,nodeLabel:L?g||c:void 0,showLabels:L,enableHover:M,tooltipContent:!1===y?()=>null:_r(y)||void 0,customHoverBehavior:w||m||b?V:void 0,customClickBehavior:m||b?U:void 0},S&&"none"!==S&&{legendHoverBehavior:E.onLegendHover,legendClickBehavior:E.onLegendClick,legendHighlightedCategory:E.highlightedCategory,legendIsolatedCategories:E.isolatedCategories},{className:s,title:T,description:B,summary:D,accessibleTable:I},null!=t.animate&&{animate:t.animate},v))})}Dc.displayName="SankeyDiagram",Ic.displayName="TreeDiagram",Nc.displayName="Treemap",Hc.displayName="CirclePack";const Rc=pt;function Wc(t){const o=br(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:j,onClick:C,chartId:_,selection:P,linkedHover:M,loading:L,stroke:T,strokeWidth:B,opacity:D}=t,{width:I,height:N,enableHover:H,title:R,description:W,summary:E,accessibleTable:F}=o,z=$r(L,I,N),$=hr(r(()=>Pc(n,a),[n,a]),d?void 0:c,u),Y=ur(),G=r(()=>new Map,[]),q=r(()=>{if(Array.isArray(u))return u;if(Y&&Y.length>0)return Y;const e=ht[u];return Array.isArray(e)?e:gt},[u,Y]),X=r(()=>{if(Array.isArray(u))return u;const e=ht[u];return Array.isArray(e)?e:gt},[u]),V=r(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?X[0]:Rc[(e.depth||0)%Rc.length]:c?vt(e.data||e,c,$):dr(void 0,Y,u,void 0,G),o.opacity=n?1:.85,o},[c,d,$,X,Y,u,G]),U=r(()=>kr(V,{stroke:T,strokeWidth:B,opacity:D}),[V,T,B,D]),K=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:Z,customClickBehavior:J}=fr({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"OrbitDiagram",chartId:_}),ee=r(()=>{if(Z)return e=>{Z(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[Z]),te=r(()=>{if(J)return e=>{J(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[J]),oe=Kr({componentName:"OrbitDiagram",data:n});return oe?e(Ir,{componentName:"OrbitDiagram",message:oe,width:I,height:N}):z||e(Wr,{componentName:"OrbitDiagram",width:I,height:N,children:e(Cc,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:U,edgeStyle:K,colorBy:c,colorScheme:q,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&H,tooltipContent:k?void 0:!1===w?()=>null:_r(w)||void 0,customHoverBehavior:M||j||C?ee:void 0,customClickBehavior:j||C?te:void 0,foregroundGraphics:A,annotations:S,className:s,title:R,description:W,summary:E,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:F},null!=t.animate&&{animate:t.animate},O))})}Wc.displayName="OrbitDiagram";const Ec={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Fc={opacity:.7,marginRight:4};function zc(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function $c(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Yc(e={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=e;return e=>{var s;const a=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,l=zc(a,o,"time"),c=zc(a,n,"value");return t("div",{className:"semiotic-tooltip",style:Ec,children:[t("div",{children:[t("span",{style:Fc,children:[i,":"]}),$c(l)]}),t("div",{children:[t("span",{style:Fc,children:[r,":"]}),$c(c)]})]})}}function Gc(e,t){var o;return null!=e?e:Math.max(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0,200)}const qc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:j,opacity:C,background:_,tooltipContent:P,tooltip:M,onHover:L,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,transition:W,linkedHover:E,selection:F,onObservation:z,chartId:$,loading:Y,emptyContent:G,emphasis:q,legendPosition:X}=t,V=u.showAxes,U=u.enableHover,K=null!=h?h:u.marginDefaults,Q=null!=d?d:[u.width,u.height],Z=null!==(c=null!=P?P:M)&&void 0!==c?c:Yc({timeAccessor:b,valueAccessor:x}),J=i(null),{customHoverBehavior:ee}=fr({selection:F,linkedHover:E,unwrapData:!0,onObservation:z,chartType:"RealtimeLineChart",chartId:$}),te=l(e=>{L&&L(e),ee(e)},[L,ee]);p(o,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=$r(Y,Q[0],Q[1]),ne=oe?null:zr(m,Q[0],Q[1],G),ie={stroke:S,strokeWidth:O,strokeDasharray:j};null!=C&&(ie.opacity=C);const re=Gc(v,m);return oe||ne||e(Ai,{ref:J,chartType:"line",runtimeMode:"streaming",size:Q,margin:K,className:q?`${g||""} semiotic-emphasis-${q}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:ie,showAxes:V,background:_,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:T,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:N,pulse:H,staleness:R,transition:W,pointIdAccessor:t.pointIdAccessor,legendPosition:X})});qc.displayName="RealtimeLineChart";const Xc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,showAxes:t.showAxes,enableHover:null!=t.enableHover?!!t.enableHover:void 0,linkedHover:t.linkedHover}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,categoryAccessor:O,colors:j,fill:C,stroke:_,strokeWidth:P,opacity:M,gap:L,background:T,tooltipContent:B,tooltip:D,onHover:I,annotations:N,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,linkedHover:E,selection:F,decay:z,pulse:$,staleness:Y,transition:G,onObservation:q,chartId:X,loading:V,emptyContent:U,emphasis:K,legendPosition:Q,brush:Z,onBrush:J,linkedBrush:ee}=t,te=u.showAxes,oe=u.enableHover,ne=null!=g?g:u.marginDefaults,ie=null!=h?h:[u.width,u.height],re=null!==(c=null!=B?B:D)&&void 0!==c?c:Yc({timeAccessor:x,valueAccessor:k}),se=i(null),{customHoverBehavior:ae}=fr({selection:F,linkedHover:E,unwrapData:!0,onObservation:q,chartType:"RealtimeTemporalHistogram",chartId:X}),le=l(e=>{I&&I(e),ae(e)},[I,ae]),ce=!0===Z?{dimension:"x",snap:"bin"}:"x"===Z?{dimension:"x"}:"object"==typeof Z?Z:void 0,ue=Ki(ee),de=Hi(Object.assign({name:(null==ue?void 0:ue.name)||"__unused_hist_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof x?x:"time")},(null==ue?void 0:ue.yField)?{yField:ue.yField}:{})),he=i(de.brushInteraction);he.current=de.brushInteraction;const ge=l(e=>{if(J&&J(e),q&&q(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:X}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:X}),ue){const t=he.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[J,q,X,ue]);p(o,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=se.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=se.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const fe=$r(V,ie[0],ie[1]),pe=fe?null:zr(b,ie[0],ie[1],U),ye={};null!=C&&(ye.fill=C),null!=_&&(ye.stroke=_),null!=P&&(ye.strokeWidth=P),null!=M&&(ye.opacity=M),null!=L&&(ye.gap=L);const ve=K?`${f||""} semiotic-emphasis-${K}`.trim():f,me=Gc(m,b);return fe||pe||e(Ai,{ref:se,chartType:"bar",runtimeMode:"streaming",size:ie,margin:ne,className:ve,arrowOfTime:y,windowMode:v,windowSize:me,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,binSize:d,categoryAccessor:O,barColors:j,barStyle:ye,showAxes:te,background:T,hoverAnnotation:oe,tooltipContent:re,customHoverBehavior:le,annotations:N,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,decay:z,pulse:$,staleness:Y,transition:G,pointIdAccessor:t.pointIdAccessor,legendPosition:Q,brush:ce||(ee?{dimension:"x"}:void 0),onBrush:ce||ee?ge:void 0})});Xc.displayName="RealtimeTemporalHistogram";const Vc=Xc,Uc=g(function(t,o){var n,r,s,a,c;const u=br(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:j,fill:C,opacity:_,stroke:P,strokeWidth:M,background:L,tooltipContent:T,tooltip:B,onHover:D,annotations:I,svgAnnotationRules:N,tickFormatTime:H,tickFormatValue:R,linkedHover:W,selection:E,onObservation:F,chartId:z,loading:$,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=u.showAxes,V=u.enableHover,U=null!=h?h:u.marginDefaults,K=null!=d?d:[u.width,u.height],Q=null!==(c=null!=T?T:B)&&void 0!==c?c:Yc({timeAccessor:b,valueAccessor:x}),Z=i(null),{customHoverBehavior:J}=fr({selection:E,linkedHover:W,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:z}),ee=l(e=>{D&&D(e),J(e)},[D,J]);p(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=$r($,K[0],K[1]),oe=te?null:zr(m,K[0],K[1],Y),ne={};null!=j&&(ne.radius=j),null!=C&&(ne.fill=C),null!=_&&(ne.opacity=_),null!=P&&(ne.stroke=P),null!=M&&(ne.strokeWidth=M);const ie=G?`${g||""} semiotic-emphasis-${G}`.trim():g,re=Gc(v,m);return te||oe||e(Ai,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:K,margin:U,className:ie,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:ne,showAxes:X,background:L,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:I,svgAnnotationRules:N,tickFormatTime:H,tickFormatValue:R,legendPosition:q,pointIdAccessor:t.pointIdAccessor})});Uc.displayName="RealtimeSwarmChart";const Kc=g(function(o,n){var r,s,a,c,u;const d=br(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:j,connectorStroke:C,connectorWidth:_,gap:P,stroke:M,strokeWidth:L,opacity:T,background:B,tooltipContent:D,tooltip:I,onHover:N,annotations:H,svgAnnotationRules:R,tickFormatTime:W,tickFormatValue:E,linkedHover:F,selection:z,onObservation:$,chartId:Y,loading:G,emptyContent:q,emphasis:X,legendPosition:V}=o,U=d.showAxes,K=d.enableHover,Q=null!=g?g:d.marginDefaults,Z=null!=h?h:[d.width,d.height],J=null!==(u=null!=D?D:I)&&void 0!==u?u:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r,s;const a=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null,l=zc(a,n,"time"),c=null!==(s=null==a?void 0:a.delta)&&void 0!==s?s:zc(a,i,"value"),u=null==a?void 0:a.cumEnd,d="number"==typeof c?0>c?$c(c):"+"+$c(c):$c(c);return t("div",{className:"semiotic-tooltip",style:Ec,children:[t("div",{children:[e("span",{style:Fc,children:"x:"}),$c(l)]}),t("div",{children:[e("span",{style:Fc,children:"Δ:"}),d]}),null!=u&&t("div",{children:[e("span",{style:Fc,children:"total:"}),$c(u)]})]})}}({timeAccessor:x,valueAccessor:k}),ee=i(null),{customHoverBehavior:te}=fr({selection:z,linkedHover:F,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:Y}),oe=l(e=>{N&&N(e),te(e)},[N,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ee.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=$r(G,Z[0],Z[1]),ie=ne?null:zr(b,Z[0],Z[1],q),re={};null!=O&&(re.positiveColor=O),null!=j&&(re.negativeColor=j),null!=C&&(re.connectorStroke=C),null!=_&&(re.connectorWidth=_),null!=P&&(re.gap=P),null!=M&&(re.stroke=M),null!=L&&(re.strokeWidth=L),null!=T&&(re.opacity=T);const se=X?`${f||""} semiotic-emphasis-${X}`.trim():f,ae=Gc(m,b);return ne||ie||e(Ai,{ref:ee,chartType:"waterfall",runtimeMode:"streaming",size:Z,margin:Q,className:se,arrowOfTime:y,windowMode:v,windowSize:ae,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:re,showAxes:U,background:B,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:oe,annotations:H,svgAnnotationRules:R,tickFormatTime:W,tickFormatValue:E,legendPosition:V,pointIdAccessor:o.pointIdAccessor})});Kc.displayName="RealtimeWaterfallChart";const Qc=g(function(o,n){var r,s,a,c,u;const d=br(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:j=20,heatmapYBins:C=20,aggregation:_="count",background:P,tooltipContent:M,tooltip:L,onHover:T,annotations:B,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:N,decay:H,pulse:R,staleness:W,linkedHover:E,selection:F,onObservation:z,chartId:$,loading:Y,emptyContent:G,emphasis:q,legendPosition:X}=o,V=d.showAxes,U=d.enableHover,K=null!=g?g:d.marginDefaults,Q=null!=h?h:[d.width,d.height],Z=null!==(u=null!=M?M:L)&&void 0!==u?u:function(o={}){const{timeAccessor:n,valueAccessor:i,xLabel:r="x",yLabel:s="y"}=o;return o=>{var a,l,c,u;const d=null!==(a=null==o?void 0:o.data)&&void 0!==a?a:null,h=null!==(l=null==d?void 0:d.xCenter)&&void 0!==l?l:zc(d,n,"time"),g=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:zc(d,i,"value"),f=null==d?void 0:d.count,p=null==d?void 0:d.sum,y=null==d?void 0:d.value,v=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return t("div",{className:"semiotic-tooltip",style:Ec,children:[t("div",{children:[t("span",{style:Fc,children:[r,":"]}),$c(h)]}),t("div",{children:[t("span",{style:Fc,children:[s,":"]}),$c(g)]}),null!=f&&t("div",{children:[e("span",{style:Fc,children:"count:"}),$c(f)]}),"sum"===v&&null!=p&&t("div",{children:[e("span",{style:Fc,children:"sum:"}),$c(p)]}),"mean"===v&&null!=y&&t("div",{children:[e("span",{style:Fc,children:"mean:"}),$c(y)]})]})}}({timeAccessor:x,valueAccessor:k}),J=i(null),{customHoverBehavior:ee}=fr({selection:F,linkedHover:E,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:$}),te=l(e=>{T&&T(e),ee(e)},[T,ee]);p(n,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=$r(Y,Q[0],Q[1]),ne=oe?null:zr(b,Q[0],Q[1],G),ie=q?`${f||""} semiotic-emphasis-${q}`.trim():f,re=Gc(m,b);return oe||ne||e(Ai,{ref:J,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:K,className:ie,arrowOfTime:y,windowMode:v,windowSize:re,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:j,heatmapYBins:C,heatmapAggregation:_,showAxes:V,background:P,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:B,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:N,decay:H,pulse:R,staleness:W,legendPosition:X,pointIdAccessor:o.pointIdAccessor})});Qc.displayName="RealtimeHeatmap";const[Zc]=be(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Jc(e,t){return ts(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),eu(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);tu(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(tu(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function eu(e,t){var o;const n=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const n=r.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,i.length)>e;e++)eu(n[e],i[e])}function tu(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const ou={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"}},nu={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},iu={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},ru=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],su=["vertical","horizontal"],au={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},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({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),nu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ru},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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),nu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{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:su},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ou),iu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},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({},ou),iu),{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({},ou),iu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:su},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ou),{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({},ou),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},ou),{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({},ou),iu),{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({},ou),iu),{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({},ou),{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({},ou),{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:su},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({},ou),{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({},ou),{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({},ou),{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({},ou),{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({},ou),{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({},ou),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ou),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},ou),{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({},ou),{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({},ou),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ou),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function lu(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function cu(e,t){const o=[],n=au[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(au).join(", ")}`]};for(const i of n.required)null==t[i]&&o.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=n.props[e];if(t){if(!lu(i,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;o.push(`"${e}" should be ${n}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&o.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(n.props),r=new Set(i);for(const n of Object.keys(t))if(void 0!==t[n]&&!r.has(n)){const t=qr(n,i),r=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${i.join(", ")}.`;o.push(r)}if("array"===n.dataShape){const i=t.data,r={};for(const e of n.dataAccessors){const o=t[e];"string"==typeof o&&(r[e]=o)}const s=Ur({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&o.push(s)}else if("object"===n.dataShape){const n=Kr({componentName:e,data:t.data});n&&o.push(n)}else if("network"===n.dataShape){const i=Qr({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});i&&o.push(i)}return{valid:0===o.length,errors:o}}const uu=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),du=new Set(["data","nodes","edges"]),hu="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function gu(e,t,o){if(!au[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(au).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(uu.has(e)||!n&&du.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=hu(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})}function fu(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!au[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:hu(e.props)}}function pu(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function yu(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}function vu(e){return ts(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?mu(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function mu(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function bu(){const o=function(){const e=n.useContext(xn);return e?()=>e.setVisible(e=>!e):null}();return o?e("button",{className:"semiotic-chart-action",onClick:o,title:"Data summary","aria-label":"Toggle data summary",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const xu={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function ku({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function wu({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const Au=n.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:u,controls:d,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:v,style:m},b){const x=n.useRef(null),k=n.useRef(null),[w,A]=n.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),j=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,C=!0===(null==c?void 0:c.dataSummary),_="object"==typeof(null==c?void 0:c.export)?c.export:{},P="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",M=n.useCallback(e=>ts(this,void 0,void 0,function*(){k.current&&(yield Jc(k.current,Object.assign(Object.assign({},_),e)))}),[_]),L=n.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=n.useCallback(e=>ts(this,void 0,void 0,function*(){u&&(yield vu(u,e||P||"json"))}),[u,P]);n.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),n.useImperativeHandle(b,()=>({export:M,toggleFullscreen:L,copyConfig:T,element:x.current}),[M,L,T]);const B=i||r||d||S||O||j||C||p,D=h?e(ku,{height:l}):g?e(wu,{error:g}):f?e(Nr,{children:s}):s;return I=t(o,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(v?" "+v:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),m),children:[B&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[d,S&&e("button",{className:"semiotic-chart-action",onClick:()=>M(),title:"Export chart","aria-label":"Export chart",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),C&&e(bu,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:Su,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(o,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),j&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:Su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:xu[p].bg,color:xu[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[D,y]})]})]}),C?e(kn,{children:I}):I;var I}),Su={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Ou({children:t,columns:o="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof o?o:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${o}, 1fr)`,gap:r,width:"100%"},a),children:n.Children.map(t,t=>n.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function ju({children:o,context:n,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:o}),e("div",{style:h,children:n})]})}Ou.displayName="ChartGrid",ju.displayName="ContextLayout";function Cu({children:o,position:n="right",size:r=300,trigger:a="click",chartId:c,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[v,m]=d(null),[b,x]=d(null),[k,w]=d(!1),[A,S]=d(!1),O=i(null),j=i(void 0),C="click"===a?["click","click-end"]:["hover","hover-end"],{latest:_}=Wi({types:C,chartId:c,limit:1}),P=void 0!==u?u:_;s(()=>{if(P)if("click"===P.type||"hover"===P.type){const e=P;m(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(j.current),j.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==P.type&&"hover-end"!==P.type||M()},[P]),s(()=>{null==f||f(k)},[k,f]);const M=l(()=>{S(!0),w(!1),clearTimeout(j.current),j.current=setTimeout(()=>{S(!1),m(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(j.current),[]),!v&&!A)return null;const L=v&&b?o(v,b):null;if(null===L&&!A)return null;const T=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${n}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:_u,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const _u={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};Cu.displayName="DetailsPanel";const Pu=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Mu=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Lu=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Tu=new Set(["LineChart","AreaChart","StackedAreaChart"]),Bu=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Du(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[o,n,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(o)+.7152*r(n)+.0722*r(i)}function Iu(e,t){const o=Du(e),n=Du(t);return null===o||null===n?null:(Math.max(o,n)+.05)/(Math.min(o,n)+.05)}const Nu=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Hu(e,t){const o=[],n=cu(e,t);for(const e of n.errors)o.push({severity:"error",code:"VALIDATION",message:e,fix:""});return au[e]?(function(e,t,o){const n=au[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&o.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"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&o.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,o),function(e,t,o){const n=t.width,i=t.height;if(void 0===n||"number"==typeof n&&n>0||o.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||o.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,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&o.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,o),function(e,t,o){const n=au[e];if(!n||"array"!==n.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 n.dataAccessors){const n=t[e];"string"==typeof n&&(n in r||o.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,o),function(e,t,o){Pu.has(e)&&Array.isArray(t.data)&&o.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,o),function(e,t,o){Mu.has(e)&&(t.edges||t.data||o.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,o),function(e,t,o){const n=au[e];if(!n||"array"!==n.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&&o.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,o),function(e,t,o){t.linkedHover&&!t.selection&&o.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,o),function(e,t,o){var n;if(!Lu.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&o.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!==(n=i[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,o),function(e,t,o){if(!Tu.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=t.yAccessor||"y";"string"==typeof i&&n.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&o.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,o),function(e,t,o){var n,i;const r=null!==(n=t.width)&&void 0!==n?n: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||o.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||o.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,o),function(e,t,o){var n;const i=au[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 o=0;a>o;o++){const i=null===(n=r[o])||void 0===n?void 0:n[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&o.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,o),function(e,t,o){if(!Bu.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&o.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} 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,o),function(e,t,o){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const i=n.bottom;"number"==typeof i&&70>i&&o.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,o),function(e,t,o){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&o.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,o),function(e,t,o){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=n[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const r=i[n];"string"==typeof r&&o.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" 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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Iu(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const i=n.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=Iu(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n="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;n||i||r||o.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,o),function(e,t,o){const n=[];for(const e of Nu)"function"==typeof t[e]&&n.push(e);n.length>0&&o.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.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,o),{ok:o.every(e=>"warning"===e.severity),diagnoses:o}):{ok:0===o.length,diagnoses:o}}function Ru(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function Wu(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function Eu(e){return"nominal"===e||"ordinal"===e}function Fu(e){return"quantitative"===e||"temporal"===e}const zu={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},$u={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},Yu={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Gu(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f;const p=[],{type:y,markProps:v}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}(e,["type"])}}(e.mark),m=e.encoding||{},b=m.x,x=m.y,k=m.color,w=m.size,A=m.theta,S=m.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const j={};e.width&&(j.width=e.width),e.height&&(j.height=e.height);const C=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(C&&(j.title=C),(null==k?void 0:k.field)&&(j.colorBy=k.field,null===(n=k.scale)||void 0===n?void 0:n.scheme)){const e=zu[k.scale.scheme];e&&(j.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(j.pointOpacity=S.value);const _=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(_||P)){const e=P?x:b,t=P?b:x,o=Yu[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(O,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const o of O){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}O=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(j.data=O),(null==b?void 0:b.bin)?(j.valueAccessor=b.field,(null==x?void 0:x.field)&&(j.categoryAccessor=x.field),(null===(i=b.axis)||void 0===i?void 0:i.title)&&(j.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(j.valueAccessor=x.field,(null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null===(r=x.axis)||void 0===r?void 0:r.title)&&(j.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(s=null==b?void 0:b.bin)||void 0===s?void 0:s.maxbins)||(null===(a=null==x?void 0:x.bin)||void 0===a?void 0:a.maxbins):void 0;return t&&(j.bins=t),Xu(e,j,p)}let M;switch(y){case"bar":M=function(e,t,o,n,i,r,s){var a,l,c,u,d,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",Eu(null==e?void 0:e.type)&&Fu(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):Fu(null==e?void 0:e.type)&&Eu(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(b,x,k,j,O,_,P);break;case"line":if(M="LineChart",qu(b,x,j,_,P),(null==k?void 0:k.field)&&(j.lineBy=k.field),v.interpolate){const e=$u[v.interpolate];e&&(j.curve=e)}!0===v.point&&(j.showPoints=!0),O&&(j.data=O);break;case"area":if((null==k?void 0:k.field)?(M="StackedAreaChart",j.areaBy=k.field):M="AreaChart",qu(b,x,j,_,P),v.interpolate){const e=$u[v.interpolate];e&&(j.curve=e)}void 0!==v.opacity&&(j.areaOpacity=v.opacity),O&&(j.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(M="BubbleChart",j.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(j.sizeRange=w.scale.range)):M="Scatterplot",qu(b,x,j,_,P),O&&(j.data=O);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(j.xAccessor=b.field),(null==x?void 0:x.field)&&(j.yAccessor=x.field),(null==k?void 0:k.field)&&(j.valueAccessor=k.field,delete j.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(j.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(j.yLabel=x.axis.title),O&&(j.data=O);break;case"arc":v.innerRadius&&v.innerRadius>0?(M="DonutChart",j.innerRadius=v.innerRadius):M="PieChart",(null==A?void 0:A.field)?j.valueAccessor=A.field:(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(j.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(j.categoryAccessor=b.field),O&&(j.data=O);break;case"tick":M="DotPlot",Eu(null==b?void 0:b.type)?(j.categoryAccessor=b.field,(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(j.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(j.valueLabel=x.axis.title)):Eu(null==x?void 0:x.type)?(j.categoryAccessor=x.field,(null==b?void 0:b.field)&&(j.valueAccessor=_?"value":b.field),j.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(j.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(j.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field)),O&&(j.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),M="Scatterplot",qu(b,x,j,_,P),O&&(j.data=O)}return Xu(M,j,p)}function qu(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function Xu(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}export{cs as AreaChart,ya as BarChart,wa as BoxPlot,fs as BubbleChart,Ts as CandlestickChart,Oi as CategoryColorProvider,Au as ChartContainer,Ou as ChartGrid,Bc as ChordDiagram,Hc as CirclePack,gs as ConnectedScatterplot,ju as ContextLayout,Cu as DetailsPanel,_a as DonutChart,Oa as DotPlot,_c as ForceDirectedGraph,Ma as FunnelChart,Pa as GaugeChart,ma as GroupedBarChart,ps as Heatmap,Aa as Histogram,Ra as LikertChart,rs as LineChart,Vi as LinkedCharts,Os as MinimapChart,Ls as MultiAxisLineChart,jr as MultiLineTooltip,Wc as OrbitDiagram,Ca as PieChart,js as QuadrantChart,Qc as RealtimeHeatmap,Vc as RealtimeHistogram,qc as RealtimeLineChart,Uc as RealtimeSwarmChart,Kc as RealtimeWaterfallChart,ja as RidgelinePlot,Dc as SankeyDiagram,ds as Scatterplot,As as ScatterplotMatrix,us as StackedAreaChart,va as StackedBarChart,xa as SwarmPlot,Wa as SwimlaneChart,rr as ThemeProvider,Zc as TooltipProvider,Ic as TreeDiagram,Nc as Treemap,Sa as ViolinPlot,mu as configToJSX,vu as copyConfig,Wu as deserializeSelections,Hu as diagnoseConfig,Jc as exportChart,fu as fromConfig,yu as fromURL,Gu as fromVegaLite,Ru as serializeSelections,gu as toConfig,pu as toURL,Hi as useBrushSelection,ji as useCategoryColors,Wi as useChartObserver,Ri as useFilteredData,Ii as useLinkedHover,Di as useSelection,sr as useTheme,cu as validateProps};