semiotic 3.2.3 → 3.3.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 (64) hide show
  1. package/CLAUDE.md +122 -265
  2. package/README.md +37 -17
  3. package/ai/schema.json +97 -1
  4. package/ai/system-prompt.md +3 -3
  5. package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
  6. package/dist/components/charts/ordinal/DonutChart.d.ts +2 -0
  7. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -0
  8. package/dist/components/charts/ordinal/PieChart.d.ts +2 -0
  9. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -0
  10. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -0
  11. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  12. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
  13. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  14. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  15. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  16. package/dist/components/charts/shared/hooks.d.ts +2 -1
  17. package/dist/components/charts/shared/types.d.ts +6 -2
  18. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  19. package/dist/components/realtime/RingBuffer.d.ts +11 -0
  20. package/dist/components/realtime/types.d.ts +46 -3
  21. package/dist/components/semiotic-server.d.ts +6 -1
  22. package/dist/components/server/animatedGif.d.ts +78 -0
  23. package/dist/components/server/renderToStaticSVG.d.ts +86 -5
  24. package/dist/components/server/serverChartConfigs.d.ts +17 -0
  25. package/dist/components/server/staticAnnotations.d.ts +40 -0
  26. package/dist/components/server/staticLegend.d.ts +39 -0
  27. package/dist/components/server/svgHatchPattern.d.ts +26 -0
  28. package/dist/components/server/themeResolver.d.ts +39 -0
  29. package/dist/components/store/ThemeStore.d.ts +14 -0
  30. package/dist/components/stream/GeoPipelineStore.d.ts +6 -1
  31. package/dist/components/stream/NetworkPipelineStore.d.ts +26 -0
  32. package/dist/components/stream/OrdinalPipelineStore.d.ts +11 -0
  33. package/dist/components/stream/OrdinalSVGOverlay.d.ts +5 -0
  34. package/dist/components/stream/PipelineStore.d.ts +11 -0
  35. package/dist/components/stream/accessorUtils.d.ts +3 -3
  36. package/dist/components/stream/geoTypes.d.ts +6 -4
  37. package/dist/components/stream/hoverUtils.d.ts +22 -0
  38. package/dist/components/stream/networkTypes.d.ts +45 -20
  39. package/dist/components/stream/ordinalTypes.d.ts +40 -3
  40. package/dist/components/stream/pipelineDecay.d.ts +6 -5
  41. package/dist/components/stream/renderers/resolveCSSColor.d.ts +17 -0
  42. package/dist/components/stream/types.d.ts +8 -0
  43. package/dist/geo.min.js +1 -1
  44. package/dist/geo.module.min.js +1 -1
  45. package/dist/network.min.js +1 -1
  46. package/dist/network.module.min.js +1 -1
  47. package/dist/ordinal.min.js +1 -1
  48. package/dist/ordinal.module.min.js +1 -1
  49. package/dist/realtime.min.js +1 -1
  50. package/dist/realtime.module.min.js +1 -1
  51. package/dist/semiotic-ai.min.js +1 -1
  52. package/dist/semiotic-ai.module.min.js +1 -1
  53. package/dist/semiotic-server.d.ts +6 -1
  54. package/dist/semiotic-themes.min.js +1 -1
  55. package/dist/semiotic-themes.module.min.js +1 -1
  56. package/dist/semiotic-utils.min.js +1 -1
  57. package/dist/semiotic-utils.module.min.js +1 -1
  58. package/dist/semiotic.min.js +1 -1
  59. package/dist/semiotic.module.min.js +1 -1
  60. package/dist/server.min.js +1 -1
  61. package/dist/server.module.min.js +1 -1
  62. package/dist/xy.min.js +1 -1
  63. package/dist/xy.module.min.js +1 -1
  64. package/package.json +14 -3
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useState as r,useSyncExternalStore as i,createContext as a,useContext as s,useCallback as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as f,brush as p}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleBand as x,scaleSequential as k}from"d3-scale";import{quadtree as w}from"d3-quadtree";import{interpolatePlasma as A,interpolateViridis as S,interpolatePurples as O,interpolateOranges as E,interpolateGreens as j,interpolateReds as C,interpolateBlues as M,schemeSet3 as P,schemeTableau10 as L,schemeCategory10 as _}from"d3-scale-chromatic";import{bin as T,quantile as B,min as N,groups as D,max as H,sum as $,mean as I,group as W}from"d3-array";import{packEnclose as F,hierarchy as z,partition as R,pack as G,treemap as Y,treemapBinary as q,cluster as X,tree as V}from"d3-hierarchy";import{area as U,curveCatmullRom as K,curveCardinal as Q,curveBasis as Z,curveStepBefore as J,curveStepAfter as ee,curveStep as te,curveMonotoneY as ne,curveMonotoneX as oe,curveLinear as re,arc as ie,line as ae,curveNatural as se,pie as le}from"d3-shape";import ce from"regression";import{interpolateNumber as ue}from"d3-interpolate";import{forceLink as de,forceSimulation as he,forceManyBody as ge,forceCenter as fe,forceX as pe,forceY as ye}from"d3-force";import{ribbon as me,chord as ve}from"d3-chord";function be(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function xe(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function ke({width:r,height:i,totalWidth:a,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:y,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const S=t(u);S.current=u;const O=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),E=t(O);E.current=O;const j=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?f():p();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(j.current)return;const o=S.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=n.selection;a=[o.x.invert(e),o.x.invert(t)],s=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;a=[o.x.invert(0),o.x.invert(r)],s=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;a=[o.x.invert(e),o.x.invert(r)],s=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=E.current;r&&r.length>0?a=function(e,t){return 0===t.length?e:[be(e[0],t),xe(e[1],t)]}(a,r):y&&y>0&&(a=[Math.floor(a[0]/y)*y,Math.ceil(a[1]/y)*y]);const i=o.x(a[0]),s=o.x(a[1]);if(j.current=!0,"x"===c)e.call(t.move,[i,s]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[s,o[1][1]]])}j.current=!1}const l={x:a,y:s};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,y,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=E.current;e&&e.length>0?o=xe(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[i,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[a,o]])}if(j.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,y]),e.createElement("svg",{ref:k,width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class we{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class Ae{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}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 Se{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Oe(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ce(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Me(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const Pe={category10:_,tableau10:L,set3:P,blues:M,reds:C,greens:j,oranges:E,purples:O,viridis:S,plasma:A},Le=_,_e=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=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 Ne(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Be.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):Le[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%Le.length]}function De(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const i=Pe[n]||Pe.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Le;return y().domain(o).range(e).unknown("#999")}}function He(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function $e(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}function Ie(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function We(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Fe(e,t){return Math.min((e-t.startTime)/t.duration,1)}function ze(e,t,n){return e+(t-e)*n}function Re(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ge(e,t,n){var o,r,i,a;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(a=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o,r,i){const a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function qe(e,t,n,o,r,i,a,s){const l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),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:i,datum:e,group:a}}function Xe(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function Ve(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function Ue(e,t,n,o,r,i,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Ke(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const a=e.getBounds(n),s=e.scales.x(t);if(a&&0!==a)o.push([s,e.scales.y(i+a)]),r.push([s,e.scales.y(i-a)]);else{const t=e.scales.y(i);o.push([s,t]),r.push([s,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function Qe(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Xe(a,e.scales,e.getX,i,s,o,l);c&&n.push(c)}}}const Ze={blues:M,reds:C,greens:j,viridis:S},Je=new Map;class et{constructor(e){if(this.xExtent=new Se,this.yExtent=new Se,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this.config=e,this.buffer=new Ae(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Me(e.groupAccessor),this.getCategory=Me(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Me(e.colorAccessor),this.getBounds=e.boundsAccessor?je(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.getPointId=Me(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,a,s;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,f=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:h[0],null!==(i=l.yExtent[1])&&void 0!==i?i:h[1]]:h;const p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);f=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Oe(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&f[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,n=null===(a=l.yExtent)||void 0===a?void 0:a[0],o=null===(s=l.yExtent)||void 0===s?void 0:s[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=n?f[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]);const y="streaming"===l.runtimeMode,x=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(k=l.arrowOfTime)||"down"===k?"y":"x")){const t="right"===l.arrowOfTime?[x,e.width-x]:[e.width-x,x];this.scales={x:m().domain(g).range(t),y:m().domain(f).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(f).range([x,e.width-x]),y:m().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[x,e.width-x]),y:t(l.yScaleType,f,[e.height-x,x])}}var k;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),this.config.transition&&(this.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 void(this._quadtree=null);const t=this.scene.filter(e=>"point"===e.type);this._quadtree=t.length>et.QUADTREE_THRESHOLD?w().x(e=>e.x).y(e=>e.y).addAll(t):null}get quadtree(){return this._quadtree}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=Ke(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return Qe(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=qe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(a.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Qe(e,n,o),o}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set,i=e.scales.y.domain()[0],a=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=qe(t.data,e.scales,e.getX,e.getY,i,n,t.key,a);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Qe(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,a){var s;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(s=u.get(o.key))||void 0===s?void 0:s.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[],l=new Map;for(const n of c){let r=e.get(n)||0;const a=f.get(n);i&&(r/=d.get(n));const c=a+r,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),f.set(n,c),l.set(n,c)}g.set(n.key,l);const p={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(p.curve=a),h.push(p)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),a=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Qe(e,n,a,o)}return a}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},s=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(s=i(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(r);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=Xe(r,e.scales,e.getX,e.getY,s,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),l=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",c=je(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)/a,p=(g-h||1)/s,y=a*s;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],r=e.getX(o),i=e.getY(o);if(!isFinite(r)||!isFinite(i))continue;const l=Math.min(Math.floor((r-u)/f),a-1),d=Math.min(Math.floor((i-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,E=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>n;n++){const o=t+n;if(0===m[o])continue;let r;switch(l){case"sum":r=v[o];break;case"mean":r=v[o]/m[o];break;default:r=m[o]}const i=(r-b)/k;E.push(Ue(n*w,(s-1-e)*A,w,A,`rgb(${220-(180*i+.5)|0},${220-(100*i+.5)|0},${255-(50*i+.5)|0})`,{xi:n,yi:e,value:r,count:m[o],sum:v[o]},S?{value:r,showValues:!0,valueFormat:O}:void 0))}}return E}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Ce(e.config.xAccessor,"x"),i=Ce(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.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),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],r=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ze?e:"blues";let n=Je.get(t);if(n)return n;n=Array(256);const o=Ze[t]||M;for(let e=0;256>e;e++)n[e]=o(e/255);return Je.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),S=255/(w-k||1),O=n.width/u,E=n.height/d,j=e.config.showValues,C=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;P.push(Ue(o*O,(d-1-(n-o)/u)*E,O,E,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:C}:void 0))}return P}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Oe(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const i=[],a=e.scales,[s,l]=a.x.domain();for(const t of o.values()){const o=Math.max(t.start,s),c=Math.min(t.end,l);if(o>=c)continue;const u=a.x(o),d=a.x(c),h=Math.abs(d-u),g=h>2?1:0,f=Math.min(u,d)+g/2,p=Math.max(h-g,1);if(p>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r);i.push(Ve(f,Math.min(l,c),p,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[s])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=a.y(0),n=a.y(t.total);i.push(Ve(f,Math.min(e,n),p,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const a=[],s=e.config.swarmStyle||{},l=null!==(n=s.radius)&&void 0!==n?n:3,c=null!==(o=s.fill)&&void 0!==o?o:"#007bff",u=null!==(r=s.opacity)&&void 0!==r?r:.7,d=s.stroke,h=s.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),s=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const f={type:"point",x:r,y:s,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(f.pointId=e.getPointId(n)+""),a.push(f)}return a}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const a=[],s=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return a;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,f=null==l?void 0:l.strokeWidth;let p=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=p+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=s.x(r),b=0!==m?s.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){p=y;continue}const w=s.y(p),A=s.y(y);a.push(Ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:f},Object.assign(Object.assign({},o),{baseline:p,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),p=y}return a}(i,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const r=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(r||e.getOpen&&e.getClose))return[];const i=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=r?s:a.upColor||"#28a745",c=r?s:a.downColor||"#dc3545",u=r?s:a.wickColor||"#333",d=a.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=r?0:null!==(o=a.bodyWidth)&&void 0!==o?o:0;if(!r&&null==a.bodyWidth&&h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else r||null!=a.bodyWidth||(g=6);for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=r?o:e.getOpen(n),h=r?a:e.getClose(n);if(!r&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};r&&(p.isRange=!0),i.push(p)}return i}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?$e(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const a=new Map;for(let e=0;n.length>e;e++)a.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const s=a.get(t[n]);null!=s?(o[n]=$e(e,s,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(r[n]=$e(e,o,i),1>r[n]&&(s=!0)):r[n]=1}s&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=a.get(n);if(null!=t){const n=$e(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=$e(e,t,i);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const a="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const s=Ie(e,i,a);s>r&&(r=s)}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=Ie(e,r,a);i>0&&(n._pulseIntensity=i,n._pulseColor=s,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,a;n.clear(),o.clear();for(let s=0;t.length>s;s++){const l=t[s],c=Ge(e,l,s);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=l.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,M,P,L,_;if(0===o.size&&0===r.size)return n;const T=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let B=!1;const N=new Set,D=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=Ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(D.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];B=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];B=!0}i._targetOpacity=null!==(a=i.style.opacity)&&void 0!==a?a:1,i._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;continue}const S=o.get(A);if("point"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,S.x===e.x&&S.y===e.y&&S.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=S.x,i.y=S.y,i.r=null!==(d=S.r)&&void 0!==d?d:i.r,B=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("rect"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(f=S.w)&&void 0!==f?f:i.w,i.h=null!==(p=S.h)&&void 0!==p?p:i.h,B=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("heatcell"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(b=S.w)&&void 0!==b?b:i.w,i.h=null!==(x=S.h)&&void 0!==x?x:i.h,B=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),B=!0}for(const[e,t]of r)if(!D.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}for(const[e,t]of o)if(!N.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(O=t.r)&&void 0!==O?O:3,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(j=t.w)&&void 0!==j?j:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(M=t.opacity)&&void 0!==M?M:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(P=t.w)&&void 0!==P?P:0,h:null!==(L=t.h)&&void 0!==L?L:0,fill:"#999",datum:null,style:{opacity:null!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}B=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),B&&(n.activeTransition={startTime:Re(),duration:T}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,a,s,l;if(!n.activeTransition)return!1;const c=Fe(e,n.activeTransition),u=We(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=ze(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=ze(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=ze(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==n.w&&(e.w=ze(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ze(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ze(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==n.w&&(e.w=ze(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ze(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(s=e._startOpacity)&&void 0!==s?s:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ze(t,e._targetOpacity,u)})}const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ze(t[o][0],n[o][0],u),e.path[o][1]=ze(t[o][1],n[o][1],u)}else if("area"===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:ze(t,e._targetOpacity,u)})}const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ze(t[n][0],o[n][0],u),e.topPath[n][1]=ze(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ze(n[t][0],r[t][0],u),e.bottomPath[t][1]=ze(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i},i}resolveLineStyle(e,t){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}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}return o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);void 0!==e.colorScheme&&(this._colorMapCache=null,this._groupColorMap=new Map),void 0===e.barColors&&void 0===e.colorScheme||(this._barCategoryCache=null),void 0===e.normalize&&void 0===e.extentPadding&&void 0===e.xAccessor&&void 0===e.yAccessor&&void 0===e.groupAccessor&&void 0===e.categoryAccessor&&void 0===e.chartType||(this._stackExtentCache=null);let a=!1;Object.assign(this.config,e);const s="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(s||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=s||!Ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=s||!Ee(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),a=!0)}if("groupAccessor"in e&&!Ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Me(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Me(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Me(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,a=!0),"pointIdAccessor"in e&&!Ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Me(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!Ee(e.openAccessor,i.openAccessor)||"closeAccessor"in e&&!Ee(e.closeAccessor,i.closeAccessor)||"highAccessor"in e&&!Ee(e.highAccessor,i.highAccessor)||"lowAccessor"in e&&!Ee(e.lowAccessor,i.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){a=!0;break}}a&&(this.needsFullRebuild=!0)}}function tt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ot(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function rt(e,t){const n=ot(e);if(!n)return!1;const o=ot(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function it(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function at(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=lt(e,t,n,o);r&&o>r.distance&&(i=r,a=!0)}}for(const s of e){let e=null;switch(s.type){case"point":if(r&&a)break;e=lt(s,t,n,o);break;case"line":e=ct(s,t,n,o);break;case"rect":e=dt(s,t,n);break;case"heatcell":e=ht(s,t,n);break;case"area":if(!1===s.interactive)break;e=ft(s,t,n);break;case"candlestick":e=gt(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function st(e,t,n){if(0===e.length)return null;const o=pt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function lt(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function ct(e,t,n,o=30){var r,i,a,s;if(0===e.path.length)return null;const l=pt(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const r=Math.max(0,l-1),i=Math.min(e.path.length-2,l);for(let a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=ut(t,n,r,i,s,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(s=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.lineWidth)&&void 0!==s?s:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function ut(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function dt(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ht(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function gt(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function ft(e,t,n){if(0===e.topPath.length)return null;const o=pt(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function yt(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}function mt(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}function vt(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?bt(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?bt(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function bt(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function xt(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}function kt(e,n,i){const a=t(null),[s,l]=r(null);return o(()=>{if(!n&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,i]),[a,[n&&s?s.w:e[0],i&&s?s.h:e[1]]]}function wt(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}et.QUADTREE_THRESHOLD=500;const At={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function St(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,At[n])(o(e,t)),r}function Ot(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Et(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function Ct(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[f,p]=e.useState(0),y=e.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=St(t,u,d,h),b=Et(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===a&&u===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),f})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const p=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=St(t,u,h,g),k=Et(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&y>0&&y+A>d&&(m++,y=0),p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===a&&u===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=A});let x=0,k=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),f+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${f},0)`},o.items)),f+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8})),f+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function Mt(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let f,p;return"left"===a?(f=4,p=i.top):"top"===a?(f=0,p=s?32:8):"bottom"===a?(f=0,p=r-i.bottom+50):(f=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${f}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(jt,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Ct,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function Pt(e){return"string"==typeof e?{type:e}:e}function Lt({orient:t,config:o,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=a-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),f=(o-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*f,x2:c,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-f-g:m+f,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-f-g:m+f,x2:r,y2:"top"===t?m-f:m+f+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(f+g/2),y1:c,x2:m+y*(f+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:c,x2:m+y*(f+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-f-g:m+f,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-f-g:m+f,y1:r,x2:"left"===t?m-f:m+f+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=T().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _t(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Tt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Bt(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Tt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=a?u?[a]:_t(a,c):[],y=i?u?[i]:_t(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-text, #333)";p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t)))),v=p.length*f),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t))));let k=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),k)}(l,v,b,h))}function Nt(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Dt(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function Ht(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function $t(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Dt(e,n),c=Ht(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function It(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Wt={linear:re,monotoneX:oe,monotoneY:ne,step:te,stepAfter:ee,stepBefore:J,basis:Z,cardinal:Q,catmullRom:K};function Ft(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,M,P,L,_,T,B,N,D,H,$,I,W,z,R,G,Y,q,X,V,K,Q,Z,J;switch(t.type){case"label":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return It(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return It(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Dt(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Ht(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ht(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=F(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ht(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Dt(n,o),s=Ht(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Dt(t,o),i=Ht(t,o);return e.createElement(Nt,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",f=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!y)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?ce.polynomial(f,{order:t.order||2}):ce.linear(f)).points;const b=v.map(([e,t])=>`${p(e)},${y(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:p(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(f=null==r?void 0:r(t.y0))&&void 0!==f?f:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(m=null===(y=o.scales)||void 0===y?void 0:y.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Wt[o.curve||"linear"]||re,g=U().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:f,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==S?S:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(j=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==j?j:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",v=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,b=s(c+h*d),x=s(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},f&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const r=Dt(t,o),i=Ht(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(T=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(D=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==D?D:null===(H=o.scales)||void 0===H?void 0:H.value;if(!s||!l)return null;const c=r.map(e=>[e[i],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>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=ce.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),y=null!==($=t.confidence)&&void 0!==$?$:.95,m=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(I=t.steps)&&void 0!==I?I:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(b)},${l(u(b))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(W=t.fillOpacity)&&void 0!==W?W:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:E,strokeWidth:null!==(z=t.strokeWidth)&&void 0!==z?z:2,strokeDasharray:null!==(R=t.strokeDasharray)&&void 0!==R?R:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=$t(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!It(r,i,o))return null;const a=null!==(G=t.dx)&&void 0!==G?G:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(q=t.width)&&void 0!==q?q:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(V=t.content)&&void 0!==V?V:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(K=o.scales)||void 0===K?void 0:K.o,a=null===(Q=o.scales)||void 0===Q?void 0:Q.x,s=null===(Z=o.scales)||void 0===Z?void 0:Z.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(J=t.opacity)&&void 0!==J?J:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===a)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}}}let zt={positions:new Map};const Rt=new Set;function Gt(){for(const e of Rt)e()}function Yt(e,t){const n=zt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(zt.positions);o.delete(e),zt={positions:o},Gt()}function qt(e,t){const n=zt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(zt.positions);o.delete(e),zt={positions:o},Gt()}function Xt(){return zt}function Vt(e){return Rt.add(e),()=>Rt.delete(e)}const Ut={positions:new Map};function Kt(){return()=>{}}function Qt(){return Ut}function Zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Jt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function en(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,f=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||tn,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,a)})),c=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);return nn(s,Math.max(55,c+8))},[l,u,h,o]),p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),y=d&&l,m=c&&l;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&(()=>{var t,n;const i=Zt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),a=Zt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},f.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i})),p.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:Jt("bottom",o,r),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:Jt("left",o,r),fill:"none",stroke:S,strokeWidth:1})))}function tn(e,t,n){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 n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function on(r){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:M,marginalGraphics:P,xValues:L,yValues:_,annotations:T,svgAnnotationRules:B,xAccessor:N,yAccessor:D,annotationData:H,pointNodes:$,curve:I,underlayRendered:W,linkedCrosshairName:F,linkedCrosshairSourceId:z,children:R}=r,G=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),s=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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=nn(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[f,g,p,b,l]),Y=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[f,g,p,x,c]),q=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tn,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[f,g,p,x,c]),X=t(new Map),V=t(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),U=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;V.current!==U&&(V.current=U,X.current=new Map);const K=n(()=>{if(!T||0===T.length)return null;const e=Ft(),t={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:l,height:c,data:H,frameType:"xy",pointNodes:$,curve:I,stickyPositionCache:X.current};return T.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[T,B,l,c,N,D,H,g,$,I]),Q=function(e){var t;const n=i(e?Vt:Kt,e?Xt:Qt,e?Xt:Qt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(F);return o(()=>{if(!(null==Q?void 0:Q.locked)||!F)return;const e=e=>{"Escape"===e.key&&qt(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,F]),f||w||A||M||P||K&&K.length>0||k||R||Q?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${h.left},${h.top})`},k&&g&&!W&&(()=>{var t,n;const o=Zt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Zt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},G.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),Y.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r})))})(),f&&g&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,s=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",f="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=l/Math.max(G.length-1,1),t=G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!W&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!W&&a&&e.createElement("path",{d:Jt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):rt(t.value,n>0?G[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),y&&e.createElement("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},y),!W&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!W&&i&&e.createElement("path",{d:Jt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):rt(t.value,n>0?Y[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:l,y1:0,x2:l,y2:c,stroke:d,strokeWidth:1}),q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):rt(t.value,o>0?q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${l},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:l+h.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),K,P&&g&&L&&_&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"top",config:Pt(P.top),values:L,scale:g.x,size:h.top,length:l})),P.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Lt,{orient:"bottom",config:Pt(P.bottom),values:L,scale:g.x,size:h.bottom,length:l})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"left",config:Pt(P.left),values:_,scale:g.y,size:h.left,length:c})),P.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Lt,{orient:"right",config:Pt(P.right),values:_,scale:g.y,size:h.right,length:c}))),M,Q&&Q.sourceId!==z&&(null==g?void 0:g.x)&&(()=>{const t=g.x(Q.xValue);if(null==t||0>t||t>l)return null;const n=Q.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),R),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),Mt({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j})):null}function rn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const an="undefined"==typeof window||"undefined"==typeof document,sn=e.createContext(null);function ln({children:t}){const[n,o]=e.useState(!1),r=e.useMemo(()=>({visible:n,setVisible:o}),[n]);return e.createElement(sn.Provider,{value:r},t)}function cn(){return e.useContext(sn)}const un={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function dn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function hn(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},fn={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"},pn={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},yn={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"},vn={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)"},bn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},xn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function kn({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=cn(),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{a||c||s(!0)},[a,c]),f=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:un}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:un,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const p=function(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const E=[];if(!Array.isArray(e))return E;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":E.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 n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.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 n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.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:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=j.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=j.datum)||void 0===s?void 0:s.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":E.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":E.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":E.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 E}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gn(e.min)} to ${gn(e.max)}, mean ${gn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),v=p.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:fn,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:mn},e.createElement("caption",{style:xn},"First ",v.length," of ",p.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"type"),x.map(t=>e.createElement("th",{key:t,style:vn},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.label),x.map(n=>{return e.createElement("td",{key:n,style:bn},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":gn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function wn({nodes:t,edges:n,chartType:o,tableId:r,chartTitle:i}){var a,s,l,c,u,d,h,g,f,p,y,m,v,b;const[x,k]=e.useState(!1),w=cn(),A=null!==(a=null==w?void 0:w.visible)&&void 0!==a&&a,S=x||A,O=i?"Data summary for "+i:r?`Data summary for ${o} ${r}`:"Data summary for "+o,E=e.useRef(null),j=e.useCallback(()=>{x||A||k(!0)},[x,A]),C=e.useCallback(e=>{var t;A||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[A]);if(!t||0===t.length)return r?e.createElement("span",{id:r,tabIndex:-1,style:un}):null;if(!S)return e.createElement("div",{id:r,tabIndex:-1,onFocus:j,style:un,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",n.length," edges)"));const M=Array.isArray(t)?t:[],P=Array.isArray(n)?n:[],L=new Map,_=new Map,T=new Map,B=new Map;for(const e of P){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";_.set(e,(null!==(u=_.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+r)}if(null!=o&&""!==o){const e=o+"";L.set(e,(null!==(h=L.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(g=T.get(e))&&void 0!==g?g:0)+r)}}const N=[];for(let e=0;M.length>e;e++){const t=M[e];if(!t||"object"!=typeof t)continue;const n=null!==(p=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==p?p:t.id,o=null!=n?n+"":"node-"+e,r=null!==(y=L.get(o))&&void 0!==y?y:0,i=null!==(m=_.get(o))&&void 0!==m?m:0,a=null!==(v=T.get(o))&&void 0!==v?v:0,s=null!==(b=B.get(o))&&void 0!==b?b:0;N.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}N.sort((e,t)=>t.degree-e.degree);let D=0,H=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>H&&(H=t.degree);D=e/N.length}const $=P.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),I=[`${N.length} nodes, ${P.length} edges.`];N.length>0&&I.push(`Mean degree: ${gn(D)}, max degree: ${H}.`);const W=N.slice(0,5);return e.createElement("div",{ref:E,id:r,tabIndex:-1,onBlur:C,style:fn,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>{A&&w&&w.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},I.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+o,style:mn},e.createElement("caption",{style:xn},"Top ",W.length," of ",N.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"id"),e.createElement("th",{style:vn},"degree"),e.createElement("th",{style:vn},"in"),e.createElement("th",{style:vn},"out"),$&&e.createElement("th",{style:vn},"w. degree"),$&&e.createElement("th",{style:vn},"w. in"),$&&e.createElement("th",{style:vn},"w. out"))),e.createElement("tbody",null,W.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.id),e.createElement("td",{style:bn},t.degree),e.createElement("td",{style:bn},t.inDeg),e.createElement("td",{style:bn},t.outDeg),$&&e.createElement("td",{style:bn},gn(t.wDegree)),$&&e.createElement("td",{style:bn},gn(t.wInDeg)),$&&e.createElement("td",{style:bn},gn(t.wOutDeg)))))))}function An({summary:t}){return t?e.createElement("div",{role:"note",style:un},t):null}function Sn({tableId:t}){return e.createElement("a",{href:"#"+t,style:un,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,un)}},"Skip to data table")}function On({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:un},n)}const En="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:En,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Cn({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,s,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Mn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Pn(){const[e,t]=r(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Mn(e,e=>t(e.matches))},[]),e}function Ln(o){const r=a(null),c=_n(o);return[function({children:t}){const i=n(()=>_n(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=s(r))&&void 0!==n?n:c,a=t(e);a.current=e;const u=l(()=>a.current(o.getState()),[o]),d=l(()=>a.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function _n(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Tn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Bn={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Nn={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Dn={mode:"light",colors:{primary:"#0000cc",categorical:Tn,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},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"},[Hn,$n]=Ln(e=>({theme:Bn,setTheme(t){e(e=>{if("light"===t)return{theme:Bn};if("dark"===t)return{theme:Nn};if("high-contrast"===t)return{theme:Dn};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Nn:Bn;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function In(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Wn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Fn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function zn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Rn(e,t,n,o,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Gn=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const p=null!==(r=s.style.opacity)&&void 0!==r?r:1;Rn(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Fn(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,f=s._decayOpacities;if(f&&f.length===s.path.length&&!g){e.strokeStyle=l;const y=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(f[m]+f[m+1])*y,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.path[m+1][1]),e.stroke()}else if(g){let v=null,b=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function S(){w&&(e.stroke(),w=!1)}for(let O=0;s.path.length>O;O++){const[E,j]=s.path[O],C=d[O],M=zn(C,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(E,j);else{const P=[];for(const L of u){const _=L.value;(x>_||_>C)&&(_>x||C>_)||x===_||C===_||P.push({t:(_-x)/(C-x)})}P.sort((e,t)=>e.t-t.t);for(const T of P){const B=v+(E-v)*T.t,N=b+(j-b)*T.t,D=zn(x+(C-x)*Math.min(T.t+1e-4,1),u,l);e.lineTo(B,N),S(),A(D,B,N)}e.lineTo(E,j)}v=E,b=j,x=C,k=M}else A(M,E,j),v=E,b=j,x=C,k=M}S()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=l;else{const H=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const $ of s.strokeGradient.colorStops)H.addColorStop(Math.max(0,Math.min(1,$.offset)),$.color);e.strokeStyle=H}if(h)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[I,W]=s.path[0];e.moveTo(I,W);for(let F=1;s.path.length>F;F++)e.lineTo(s.path[F][0],s.path[F][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=s.style.fill,h&&!g)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[R,G]=s.path[0];e.moveTo(R,G);for(let Y=1;s.path.length>Y;Y++)e.lineTo(s.path[Y][0],s.path[Y][1])}const z=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(z,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Yn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function qn(e,t,n=.3){Yn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Xn(e,t,n=.6){var o,r,i,a,s;if(!Yn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Vn(e,t,n,o=.35){Yn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Un(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Kn(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function Qn(e,t){const n=Un(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=U().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Zn=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;const n=t.style.fill||"#4e79a7",o=t._decayOpacities;if(o&&o.length===t.topPath.length){const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=n;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1])*i,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=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const s=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(Qn(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 r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=e.createLinearGradient(0,o,0,r);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const e=Kn("string"==typeof n?n:"#4e79a7");i.addColorStop(0,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=s}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*s,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Qn(e,t),Vn(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=s,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Un(t.curve);if(e.beginPath(),n)ae().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}e.globalAlpha=1}},Jn=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Xn(e,t),e.globalAlpha=1}}finally{e.restore()}}},eo=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?to(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),qn(e,t),e.globalAlpha=1};function to(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}function no(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function oo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const ro=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function io(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${ro[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${ro[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const ao={line:[Zn,Gn,Jn],area:[Zn,Jn],stackedarea:[Zn,Jn],scatter:[Jn],bubble:[Jn],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),qn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):oo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=no(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[eo],swarm:[Jn],waterfall:[(e,t,n,o)=>{var r,i,a;eo(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;if(null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke(),t.isRange){const n=Math.max(2*t.wickWidth,4);e.fillStyle=t.wickColor,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}e.restore()}}],mixed:[Zn,Gn,Jn]},so={top:20,right:20,bottom:30,left:40},lo={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"},co={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 uo({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:co},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const ho=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:S,xAccessor:O,yAccessor:E,colorAccessor:j,sizeAccessor:C,groupAccessor:M,lineDataAccessor:P,curve:L,normalize:_,binSize:T,valueAccessor:B,arrowOfTime:N="right",windowMode:D="sliding",windowSize:H=200,timeAccessor:$,xExtent:I,yExtent:W,extentPadding:F=.1,scalePadding:z,sizeRange:R,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:U,lineStyle:K,pointStyle:Q,areaStyle:Z,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:ne,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:ae,lineGradient:se,areaGroups:le,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,showAxes:fe=!0,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:be,yFormat:xe,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,customClickBehavior:Ce,enableHover:Me,hoverRadius:Pe=30,tooltipMode:Le,annotations:_e,svgAnnotationRules:Te,showGrid:Be,legend:Ne,legendHoverBehavior:De,legendClickBehavior:He,legendHighlightedCategory:$e,legendIsolatedCategories:Ie,legendPosition:We,backgroundGraphics:Fe,foregroundGraphics:ze,canvasPreRenderers:Re,svgPreRenderers:Ge,title:Ye,categoryAccessor:qe,brush:Xe,onBrush:Ve,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,marginalGraphics:it,pointIdAccessor:lt,xScaleType:ct,yScaleType:ut,accessibleTable:dt=!0,description:ht,summary:gt,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}=i,At=Pn(),St=t(At);St.current=At;const[Ot,Et]=kt(G,Y,q),jt=Object.assign(Object.assign({},so),X);if(it){const e=60;it.top&&e>jt.top&&(jt.top=e),it.bottom&&e>jt.bottom&&(jt.bottom=e),it.left&&e>jt.left&&(jt.left=e),it.right&&e>jt.right&&(jt.right=e)}const Ct=Et[0]-jt.left-jt.right,Mt=Et[1]-jt.top-jt.bottom,Pt="function"==typeof ze?ze({size:Et,margin:jt}):ze,Lt="function"==typeof Fe?Fe({size:Et,margin:jt}):Fe,_t=null!=Oe?Oe:Me,Tt=t(null),Bt=t(null),Nt=t(0),Dt=t(!1),Ht=$n(e=>e.theme),[$t,It]=r(0),[Wt,Ft]=r(null),zt=t(null),Rt=t(null),[Gt,Yt]=r(null),[qt,Xt]=r(!1),[Vt,Ut]=r([]),[Kt,Qt]=r([]),Zt=t(()=>{}),Jt="streaming"===k||["bar","swarm","waterfall"].includes(x),tn=n(()=>({chartType:x,runtimeMode:Jt?"streaming":"bounded",windowSize:H,windowMode:D,arrowOfTime:Jt?N:"right",extentPadding:F,scalePadding:z,xAccessor:Jt?void 0:O,yAccessor:Jt?void 0:E,timeAccessor:Jt?$:void 0,valueAccessor:B,colorAccessor:j,sizeAccessor:C,groupAccessor:M||(P?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:P,xScaleType:ct,yScaleType:ut,xExtent:I,yExtent:W,sizeRange:R,binSize:T,normalize:_,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:!0===ae?{topOpacity:.8,bottomOpacity:.05}:!1===ae?void 0:ae,areaGroups:le?new Set(le):void 0,lineGradient:se,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,lineStyle:K,pointStyle:Q,areaStyle:Z,swarmStyle:ee,waterfallStyle:J,colorScheme:ne,barColors:te,annotations:_e,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,pointIdAccessor:lt,curve:L}),[x,H,D,N,F,z,O,E,$,B,ct,ut,j,C,M,qe,P,I,W,R,T,_,oe,re,ie,ae,se,le,ce,ue,de,he,ge,K,Q,Z,ee,J,ne,te,_e,Ue,Ke,Qe,Ze,Je,tt,nt,ot,rt,Jt,lt,L]),nn=t(null);nn.current||(nn.current=new et(tn));const sn=l(()=>{Nt.current||(Nt.current=requestAnimationFrame(()=>Zt.current()))},[]);o(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),Dt.current=!0,sn()},[tn,sn]),o(()=>{Dt.current=!0,sn()},[Ht,sn]);const ln=t(null);ln.current||(ln.current=new we(e=>{const t=nn.current;t&&t.ingest(e)&&(Dt.current=!0,sn())},{chunkThreshold:A,chunkSize:S})),o(()=>{var e;null===(e=ln.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:S})},[A,S]);const cn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.push(e)},[]),un=l(e=>{var t;null===(t=ln.current)||void 0===t||t.pushMany(e)},[]),hn=l(()=>{var e,t;null===(e=ln.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),Dt.current=!0,sn()},[sn]);u(a,()=>({push:cn,pushMany:un,clear:hn,getData:()=>{var e,t,n;return null===(e=ln.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[cn,un,hn]),o(()=>{var e,t;if(w){if(P&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof P?P:"coordinates";if(Array.isArray(w[0][t])){const n=[];for(const e of w){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=ln.current)||void 0===e||e.setBoundedData(n))}}null===(t=ln.current)||void 0===t||t.setBoundedData(w)}},[w,P]);const gn=t(()=>{}),fn=t(()=>{});gn.current=e=>{if(!_t)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Mt)return void(zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn()));const i=nn.current;if(!i||0===i.scene.length)return;const a=at(i.scene,o,r,Pe,i.quadtree);if(!a)return void(zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&je(null),sn()));const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{data:s,time:a.x,value:a.y,x:a.x,y:a.y});if("multi"===Le&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=st(e.path,t,n);if(null===i)continue;const a=pt(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=st(e.topPath,t,n);if(null===i)continue;const a=pt(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.topPath[a][0],y:i,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,a.x,Pe),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(a.x):a.x;l.xValue=o,l.xPx=a.x,l.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}zt.current=l,Rt.current=a.node,Yt(l),je&&(je(l),Dt.current=!0),sn()},fn.current=()=>{zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn())},l(e=>gn.current(e),[]);const pn=l(()=>fn.current(),[]),yn=t(()=>{});yn.current=e=>{if(!Ce)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Mt)return void Ce(null);const i=nn.current;if(!i||0===i.scene.length)return void Ce(null);const a=at(i.scene,o,r,Pe,i.quadtree);if(!a)return void Ce(null);const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{data:s,time:a.x,value:a.y,x:a.x,y:a.y});Ce(l)};const mn=l(e=>yn.current(e),[]),vn=t(-1),bn=t(null),xn=t(null),wn=l(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(xn.current&&xn.current.version===n)o=xn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)switch(a.type){case"point":i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(t=a.group)&&void 0!==t?t:"_default"});break;case"line":{const e=a,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=a,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:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(r=a.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=yt(e),xn.current={version:n,graph:o}}const r=vn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),vn.current=0;const t=o.flat[0];bn.current={shape:t.shape,w:t.w,h:t.h};const n=xt(t);return zt.current=n,Yt(n),je&&je(n),void sn()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return vn.current=-1,bn.current=null,zt.current=null,Rt.current=null,Yt(null),je&&je(null),void sn();vn.current=a;const s=o.flat[a];bn.current={shape:s.shape,w:s.w,h:s.h};const l=xt(s);zt.current=l,Yt(l),je&&je(l),sn()},[je,sn]),En=l(e=>{vn.current=-1,bn.current=null,gn.current(e)},[]);Zt.current=()=>{var e,t;Nt.current=0;const n=Tt.current,o=Bt.current;if(!n||!o)return;const r=nn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(St.current?i+1e6:i),s=!St.current&&a,l=Dt.current||a;l&&!s&&r.computeScene({width:Ct,height:Mt});const c=Wn(),u=function(e){if(!e)return lo;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||lo.axisStroke,tickText:i||lo.tickText,crosshair:i?i+"66":lo.crosshair,hoverFill:l?l+"4D":lo.hoverFill,hoverStroke:i?i+"99":lo.hoverStroke,pointRing:l||lo.pointRing}:lo}(n),d=null!==(e=null==Ze?void 0:Ze.threshold)&&void 0!==e?e:5e3,h=Ze&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=In(n,Et,jt,c);if(e){e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),h&&(e.globalAlpha=null!==(t=null==Ze?void 0:Ze.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=U||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-jt.left,-jt.top,Et[0],Et[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ct,Mt),e.clip()),Re&&r.scales)for(const t of Re)e.save(),t(e,r.scene,r.scales,{width:Ct,height:Mt}),e.restore();const a=ao[x];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:Ct,height:Mt});e.restore(),h&&(e.globalAlpha=1)}}{const e=In(o,Et,jt,c);if(e&&(e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),_t&&zt.current&&r.scales&&function(e,t,n,o,r,i,a){var s,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||a.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(u?d:t.x,0),e.lineTo(u?d:t.x,o),e.stroke(),u||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),u){e.lineWidth=2,e.strokeStyle=a.pointRing;for(const t of c)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||"#007bff",e.fill(),e.stroke())}else{let n="";try{(null===(l=e.canvas)||void 0===l?void 0:l.parentElement)&&(n=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||n||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,zt.current,Ct,Mt,"object"==typeof _t?_t:{},Rt.current,u),Rt.current&&Array.isArray(Oe))){const t=Oe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Rt.current,t)}}l&&n&&n.setAttribute("aria-label",dn(r.scene,x+" chart"));const g=Dt.current;if(Dt.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Wt||e(Wt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Wt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Wt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Wt.y.domain()[1])!==e(r.scales.y.domain()[1])||Wt.x.range()[0]!==r.scales.x.range()[0]||Wt.x.range()[1]!==r.scales.x.range()[1]||Wt.y.range()[0]!==r.scales.y.range()[0]||Wt.y.range()[1]!==r.scales.y.range()[1])&&Ft(r.scales),it){const e=r.getData(),t="function"==typeof O?O:e=>e[O||"x"],n="function"==typeof E?E:e=>e[E||"y"];Ut(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Qt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&_e&&_e.length>0&&It(e=>e+1),(null==Ze?void 0:Ze.showBadge)&&Xt(!!h),(s||r.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Zt.current()))},o(()=>(sn(),()=>{Nt.current&&(cancelAnimationFrame(Nt.current),Nt.current=0)}),[sn]),o(()=>{Dt.current=!0,sn()},[x,Ct,Mt,fe,U,K,Re,sn]),wt(Ze,nn,Dt,sn,qt,Xt);const Mn=n(()=>{if(be||Ae)return;const e=nn.current;return(null==e?void 0:e.xIsDate)&&Wt?io(Wt.x.domain()):void 0},[be,Ae,Wt]),Ln=be||Ae||Mn,_n=_t&&Gt?Ee?Ee(Gt):e.createElement(uo,{hover:Gt}):null,Tn=_n?e.createElement(Cn,{x:Gt.x,y:Gt.y,containerWidth:Ct,containerHeight:Mt,margin:jt,className:"stream-frame-tooltip"},_n):null,Bn=bn.current,Nn=e.createElement(jn,{active:vn.current>=0,hoverPoint:Gt,margin:jt,size:Et,shape:null==Bn?void 0:Bn.shape,width:null==Bn?void 0:Bn.w,height:null==Bn?void 0:Bn.h}),Dn=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},Hn=Dn(O,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),Fn=Dn(E,B,"__semiotic_resolvedY","__semiotic_resolvedValue"),zn=Hn.key,Rn=Fn.key,Gn=_e&&_e.length>0,Yn=e=>{if(!e||!Gn||!Hn.fn&&!Fn.fn)return e;let t=!1;const n=e.map(e=>{const n=Hn.fn&&Hn.key&&!(Hn.key in e),o=Fn.fn&&Fn.key&&!(Fn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[Hn.key]=Hn.fn(e)),o&&(r[Fn.key]=Fn.fn(e)),r});return t?n:e};if(an){const t=nn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Ct,height:Mt}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=Ln||(()=>{if((null==t?void 0:t.xIsDate)&&o)return io(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:Et[0],height:Et[1]}},e.createElement(An,{summary:gt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Et[0],height:Et[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt),e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},U&&e.createElement("rect",{x:0,y:0,width:Ct,height:Mt,fill:U}),Ge&&o&&Ge.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Ct,height:Mt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const a=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),s=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${a}L${s}Z`,fill:rn(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:rn(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,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]}(o.fill),s=.299*r+.587*i+.114*a>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),a=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:a,stroke:a,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(on,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:o,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:r,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:He,legendHighlightedCategory:$e,legendIsolatedCategories:Ie,legendPosition:We,foregroundGraphics:Pt,marginalGraphics:it,xValues:[],yValues:[],annotations:_e,svgAnnotationRules:Te,annotationFrame:0,xAccessor:zn,yAccessor:Rn,annotationData:Yn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}))}const qn="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ot,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Et[0],height:q?"100%":Et[1],overflow:"visible"},onKeyDown:wn},dt&&e.createElement(Sn,{tableId:qn}),dt&&e.createElement(kn,{scene:null!==(h=null===(d=nn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:qn,chartTitle:"string"==typeof Ye?Ye:void 0}),e.createElement(An,{summary:gt}),e.createElement("div",{role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?En:void 0,onMouseLeave:_t?pn:void 0,onClick:Ce?mn:void 0},Lt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Et[0],height:Et[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt)),e.createElement(en,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Wt,showAxes:fe,axes:pe,showGrid:Be,xFormat:Ln,yFormat:xe||Se}),e.createElement("canvas",{ref:Tt,"aria-label":dn(null!==(f=null===(g=nn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(On,{hoverPoint:Gt}),e.createElement(on,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Wt,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:Ln,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:He,legendHighlightedCategory:$e,legendIsolatedCategories:Ie,legendPosition:We,foregroundGraphics:Pt,marginalGraphics:it,xValues:Vt,yValues:Kt,annotations:_e,svgAnnotationRules:Te,annotationFrame:$t,xAccessor:zn,yAccessor:Rn,annotationData:Yn(null===(p=nn.current)||void 0===p?void 0:p.getData()),pointNodes:null===(y=nn.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,underlayRendered:!0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}),(Xe||Ve)&&e.createElement(ke,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,dimension:null!==(m=null==Xe?void 0:Xe.dimension)&&void 0!==m?m:"xy",scales:Wt,onBrush:null!=Ve?Ve:()=>{},binSize:T,snap:null==Xe?void 0:Xe.snap,binBoundaries:null!==(v=null==Xe?void 0:Xe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=nn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Xe?void 0:Xe.snapDuring,streaming:"streaming"===k}),(null==Ze?void 0:Ze.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ze.badgePosition?{top:4,left:4}:"bottom-left"===Ze.badgePosition?{bottom:4,left:4}:"bottom-right"===Ze.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qt?"#dc3545":"#28a745",color:"white"})},qt?"STALE":"LIVE"),Nn,Tn))});function go(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function fo(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=B(e,.25))&&void 0!==t?t:i,median:null!==(n=B(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=B(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}ho.displayName="StreamXYFrame";const po={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize,f=[];if(a){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),f.push(t))}}else f.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of f){const c=t.get(i);if(!c)continue;let f=c.total;g&&n>0&&(f/=n);const p=s(c.pieces[0],a?i:e.name),y=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const t=l(0>f?r:o+f),n=0>f?l(r+f)-l(r):l(o)-l(o+f);u.push(Ve(e.x,t,e.width,Math.abs(n),p,y,i)),0>f?r+=f:o+=f}else if(h){const t=l(0>f?r+f:o),n=0>f?l(r)-l(r+f):l(o+f)-l(o);u.push(Ve(t,e.x,Math.abs(n),e.width,p,y,i)),0>f?r+=f:o+=f}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=a(l,d[i]);if(u){const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Ve(r,Math.min(a,u),o,Math.abs(a-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Ve(Math.min(a,u),r,Math.abs(u-a),o,g,l,d[i]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:go,donut:go,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,f=[],p="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=B(t,.25))&&void 0!==n?n:s,g=null!==(o=B(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=B(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,w=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,A=d(e.pieceData[0],e.name),S=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(w),stats:{n:t.length,min:k,q1:c,median:g,q3:m,max:w,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:S}),y)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){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 i=t[0],a=t[t.length-1],s=(a-i)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;f>t;t++){const n=u(i+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(i+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=B(t,.25))&&void 0!==n?n:i,l=null!==(o=B(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=B(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:fo(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,p=Math.max(...i,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/p)*e.width*.9,a=l(n+t*r),s=l(n+(t+1)*r);c.push(Ve(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/f*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:fo(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Ve(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Ve(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,a,s,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,g=[],f=t.width/2,p=!1!==e.config.showLabels,y=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===y.length)return g;const v=[],b=new Set;for(const e of y)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let w=0;for(const e of y){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}k.push({col:e,groups:t,stepTotal:n}),x||n>w&&(w=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>w&&(w=o)}if(0===w)return g;const A=new Map;for(const e of v){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,O=x?.95*f:.9*t.width,E=m().domain([0,w]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let e=0;k.length>e;e++){const t=k[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,y=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=f,i=f;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const k=h(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,S=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:S,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=f,O.__funnelStepLabelY=d,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+m/2,O.__funnelValueLabelY=d,O.__funnelBarW=m),g.push(Ve(x,d,m,u,k,O,l)),y.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,a=E(e),s=f-a/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});p&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=f,w.__funnelStepLabelY=d,w.__funnelRowWidth=a,w.__funnelValueLabelX=f,w.__funnelValueLabelY=d,w.__funnelBarW=a),g.push(Ve(s,d,a,u,x,w,b)),y.set(l,{x:s,y:d,w:a,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=y.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),a={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:j},datum:null!==(l=null===(s=t.groups.get(o))||void 0===s?void 0:s.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};g.push(a)}}C=y}return g},"bar-funnel":function(e,t){var n,o,r,i;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[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 n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=s(o);r.total+=i,r.pieces.push(o),n+=i}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-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!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(i=null==k?void 0:k.total)&&void 0!==i?i:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),E=v(0)-O,j=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ve(S,O,u,E,j,C,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),r=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ve(S,e,u,t,o,r,p?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=a(n,l);if(u){const r=s(t),i=s(t+o);c.push(Ve(r,e.x,i-r,e.width,d,n,l))}else{const r=s(t+o),i=s(t);c.push(Ve(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class yo{constructor(e){this.rExtent=new Se,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.version=0,this.config=e,this.buffer=new Ae(e.windowSize),this.getO=Me(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new Se)):(this.getR=je(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Me(e.stackBy),this.getGroup=Me(e.groupBy),this.getColor=Me(e.colorAccessor),this.getConnector=Me(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),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.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=x().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(a).range([o,n])}else s?(c=x().domain(i).range([0,e.height]).padding(l),u=m().domain(a).range([0,e.width])):(c=x().domain(i).range([0,e.width]).padding(l),u=m().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[a,l]=i.extent;a===1/0&&(a=0,l=1);const c=l-a,u=c>0?c*(t.extentPadding||.05):1;return a-=u,l+=u,a>0&&(a=0),s?m().domain([a,l]).range([0,e.width]):m().domain([a,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i;const a=this.config.chartType,s=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let l=0,c=0;if("bar"===a&&this.getStack&&this.config.normalize)l=0,c=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>c&&(c=e);for(const e of n.values())l>e&&(l=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e),l>e&&(l=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>c&&(c=e),l>e&&(l=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(l=e),t!==-1/0&&(c=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(l=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(c=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])&&(l>0&&(l=0),0>c&&(c=0)),"bar-funnel"!==a){const e=c-l,t=e>0?e*s:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===l||(l-=t),null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])||u&&!this.config.baselinePadding&&0===c||(c+=t)}return[l,c]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}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){if(!this.scales)return[];const n=this.getSceneContext(),o=po[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}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 n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}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){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._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(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=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 g=!1;const f=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(f.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(f.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)f.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:Re(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Fe(e,this.activeTransition),i=We(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 o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ze(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=ze(o.x,e._targetX,i),e.y=ze(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=ze(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,i),e.y=ze(n.y,e._targetY,i),void 0!==n.w&&(e.w=ze(n.w,e._targetW,i),e.h=ze(n.h,e._targetH,i))}}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)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}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}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!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.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(Ee(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Me(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!Ee(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Se)):(this.getR=je(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ee(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Me(this.config.stackBy):void 0),"groupBy"in e&&!Ee(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Me(this.config.groupBy):void 0),"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Me(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ee(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Me(this.config.connectorAccessor):void 0)}}function mo(e,t,n){const o=tt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function vo(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function bo(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))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 xo(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>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 r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ko(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function wo(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,h="radial"===(null==l?void 0:l.projection),g="horizontal"===(null==l?void 0:l.projection),f=n(()=>!l||h?[]:l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(d||Ao)(e)})),[l,d,h]),p=u&&l&&!h,y=c&&l&&!h;return p||y?e.createElement("svg",{width:i,height:a,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},p&&e.createElement("g",{className:"ordinal-grid"},f.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:g?t.pixel:0,y1:g?0:t.pixel,x2:g?t.pixel:o,y2:g?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&e.createElement(e.Fragment,null,g?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Ao(e){return Math.round(100*e)/100+""}function So(o){var r,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:f,rLabel:p,oFormat:y,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",foregroundGraphics:E,annotations:j,svgAnnotationRules:C,xAccessor:M,yAccessor:P,annotationData:L,underlayRendered:_,children:T}=o,B="radial"===(null==d?void 0:d.projection),N="horizontal"===(null==d?void 0:d.projection),D=!1!==g,H=n(()=>h&&D&&d&&!B?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:y?y(e,t):e}}):[],[h,D,d,y,B]),$=n(()=>h&&d&&!B?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(m||Ao)(e)})):[],[h,d,m,B]),I=t(new Map),W=t(null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0),F=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;W.current!==F&&(W.current=F,I.current=new Map);const z=n(()=>{if(!j||0===j.length)return null;const e=Ft(),t="horizontal"===(null==d?void 0:d.projection),n=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,o={scales:d?{x:t?d.r:n||d.r,y:t&&n||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:M,yAccessor:P,width:a,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:I.current};return j.map((t,n)=>{if(C){const r=C(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[j,C,a,s,d,M,P,L]);return h||b||x||E||z&&z.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!B&&!_&&e.createElement("g",{className:"ordinal-grid"},$.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:N?t.pixel:0,y1:N?0:t.pixel,x2:N?t.pixel:a,y2:N?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!B&&e.createElement("g",{className:"ordinal-axes"},N?e.createElement(e.Fragment,null,!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&a-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),$.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p)):e.createElement(e.Fragment,null,!_&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):s,n=0>t||t>s?s:t;return e.createElement("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),H.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))),z,E,T),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),Mt({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:O,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}function Oo({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,onBrush:c}){const u=t(null),d=t(null),p=t(c);p.current=c;const y=t(l);y.current=l;const m=t(!1),v=t(null),b="horizontal"===(null==l?void 0:l.projection),x=t(b);return x.current=b,o(()=>{if(!u.current)return;const e=h(u.current).select(".brush-g"),t=b?g():f();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(m.current)return;const t=y.current;if(!t)return;if(!e.selection)return v.current=null,void p.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};v.current=i,p.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,b]),o(()=>{if(!l||!d.current||!v.current)return;if(!u.current)return;const e=v.current,t=h(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(m.current=!0,t.call(d.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(d.current.move,[o,n]),m.current=!1)},[l,b]),e.createElement("svg",{ref:u,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}}))}function Eo(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()}const jo=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)Eo(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(Eo(e,t),Vn(e,t)),e.globalAlpha=1},Co=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Mo=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}};function Po(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 Lo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let _o=null;function To(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(_o||(_o=document.createElement("canvas")),_o.width=e,_o.height=e,_o)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Bo=new Map;function No(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Bo.get(n);if(void 0!==o)return o;const r=To({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Bo.set(n,r),r}function Do(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Ho(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 $o(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Io=e=>[Mo,...e],Wo={bar:Io([eo]),clusterbar:Io([eo]),point:Io([Jn]),swarm:Io([Jn]),pie:[jo],donut:[jo],boxplot:Io([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(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(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Jn]),violin:Io([Co]),histogram:Io([eo]),ridgeline:Io([Co]),timeline:Io([eo]),funnel:[eo,(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Po(r):null!=i?`${Po(r)} (${Lo(i)})`:Po(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Po(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s: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":[eo,(e,t,n,o)=>{var r,i;const a=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 a){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=No(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,a=i?$o(r):"",s=Ho(o);e.font="bold 13px sans-serif";const l=i?e.measureText(a).width:0;e.font="11px sans-serif";const c=e.measureText(s).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,f=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Do(e,g,f,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Do(e,g,f,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(a,h,f+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(s,h,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(s,h,f+3))}e.lineWidth=1}}],swimlane:Io([eo])},Fo={top:50,right:40,bottom:60,left:70},zo={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 Ro({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:zo},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:zo},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:zo},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:zo},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:zo},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:zo},f&&e.createElement("div",{style:{fontWeight:"bold"}},f+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Go=c(function(i,a){var s,c,d,h,g,f,p,y,m,v;const{chartType:b,runtimeMode:x,data:k,oAccessor:w="category",rAccessor:A="value",colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:C,valueAccessor:M,categoryAccessor:P,projection:L="vertical",size:_=[600,400],responsiveWidth:T,responsiveHeight:B,margin:N,barPadding:D,baselinePadding:H,innerRadius:$,normalize:I,startAngle:W,sweepAngle:F,dynamicColumnWidth:z,bins:R,showOutliers:G,showIQR:Y,amplitude:q,connectorOpacity:X,showLabels:V,connectorAccessor:U,connectorStyle:K,rExtent:Q,oExtent:Z,extentPadding:J=.05,oSort:ee,windowMode:te="sliding",windowSize:ne=200,pieceStyle:oe,summaryStyle:re,colorScheme:ae,barColors:se,showAxes:le=!0,showCategoryTicks:ce,oLabel:ue,rLabel:de,oFormat:he,rFormat:ge,enableHover:fe=!0,hoverAnnotation:pe,tooltipContent:ye,customHoverBehavior:me,annotations:ve,svgAnnotationRules:be,showGrid:xe=!1,legend:ke,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Oe,legendIsolatedCategories:Ee,legendPosition:je,backgroundGraphics:Ce,foregroundGraphics:Me,title:Pe,className:Le,background:_e,centerContent:Te,decay:Be,pulse:Ne,transition:De,staleness:He,brush:$e,onBrush:Ie,accessibleTable:We=!0,description:Fe,summary:ze}=i,Re=Pn(),Ge=t(Re);Ge.current=Re;const[Ye,qe]=kt(_,T,B),Xe=n(()=>Object.assign(Object.assign({},Fo),N),[N]),Ve=qe[0]-Xe.left-Xe.right,Ue=qe[1]-Xe.top-Xe.bottom,Ke="function"==typeof Me?Me({size:qe,margin:Xe}):Me,Qe=t(null),Ze=t(!0),Je=$n(e=>e.theme),et=t(0),tt=t(null),nt=t(()=>{}),[ot,rt]=r(null),[it,at]=r(null),[st,lt]=r(0),[ct,ut]=r(!1),dt=fe||pe,ht="streaming"===x,gt=n(()=>({chartType:b,runtimeMode:ht?"streaming":"bounded",windowSize:ne,windowMode:te,extentPadding:J,projection:L,oAccessor:ht?void 0:w,rAccessor:ht?void 0:A,colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:ht?C:void 0,valueAccessor:ht?M||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:ht?P||w:void 0,rExtent:Q,oExtent:Z,barPadding:D,baselinePadding:H,innerRadius:$,normalize:I,startAngle:W,sweepAngle:F,dynamicColumnWidth:z,bins:R,showOutliers:G,showIQR:Y,amplitude:q,connectorOpacity:X,showLabels:V,connectorAccessor:U,connectorStyle:K,oSort:ee,pieceStyle:oe,summaryStyle:re,colorScheme:ae,barColors:se,decay:Be,pulse:Ne,transition:De,staleness:He}),[b,ne,te,J,L,w,A,S,O,E,j,C,M,P,Q,Z,D,H,$,I,W,F,z,R,G,Y,q,X,V,U,K,ee,oe,re,ae,se,Be,Ne,De,He,ht]),ft=t(null);ft.current||(ft.current=new yo(gt));const pt=l(()=>{et.current||(et.current=requestAnimationFrame(()=>nt.current()))},[]);o(()=>{var e;null===(e=ft.current)||void 0===e||e.updateConfig(gt),Ze.current=!0,pt()},[gt,pt]),o(()=>{Ze.current=!0,pt()},[Je,pt]);const bt=t(null);bt.current||(bt.current=new we(e=>{const t=ft.current;t&&t.ingest(e)&&(Ze.current=!0,pt())}));const At=l(e=>{var t;null===(t=bt.current)||void 0===t||t.push(e)},[]),St=l(e=>{var t;null===(t=bt.current)||void 0===t||t.pushMany(e)},[]),Ot=l(()=>{var e,t;null===(e=bt.current)||void 0===e||e.clear(),null===(t=ft.current)||void 0===t||t.clear(),Ze.current=!0,pt()},[pt]);u(a,()=>({push:At,pushMany:St,clear:Ot,getData:()=>{var e,t,n;return null===(e=bt.current)||void 0===e||e.flush(),null!==(n=null===(t=ft.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ft.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[At,St,Ot]),o(()=>{var e;k&&(null===(e=bt.current)||void 0===e||e.setBoundedData(k))},[k]);const Et=t(()=>{}),jt=t(()=>{});Et.current=e=>{if(!dt)return;const t=Qe.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Xe.left,r=e.clientY-n.top-Xe.top;if(0>o||o>Ve||0>r||r>Ue)return void(tt.current&&(tt.current=null,rt(null),me&&me(null),pt()));const i=ft.current;if(!i||0===i.scene.length)return;const a="radial"===L,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=mo(i,t,n);break;case"point":e=vo(i,t,n,o);break;case"wedge":e=bo(i,t,n);break;case"boxplot":e=xo(i,t,n);break;case"violin":e=ko(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Ve/2:o,a?r-Ue/2:r);if(!s)return void(tt.current&&(tt.current=null,rt(null),me&&me(null),pt()));const l=s.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:s.x,value:s.y,x:s.x,y:s.y}),s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});tt.current=c,rt(c),me&&(me(c),Ze.current=!0),pt()},jt.current=()=>{tt.current&&(tt.current=null,rt(null),me&&(me(null),Ze.current=!0),pt())},l(e=>Et.current(e),[]);const Ct=l(()=>jt.current(),[]),Mt=t(-1),Pt=t(null),Lt=t(null),_t=l(e=>{const t=ft.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Lt.current&&Lt.current.version===n)o=Lt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)if("rect"===a.type&&null!=a.x){const e=null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=a.group)&&void 0!==o?o:e})}else if("point"===a.type)i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(r=a.group)&&void 0!==r?r:"_default"});else if("wedge"===a.type&&null!=a.cx){const e=((a.startAngle||0)+(a.endAngle||0))/2,t=((a.innerRadius||0)+(a.outerRadius||50))/2;i.push({x:a.cx+Math.cos(e)*t,y:a.cy+Math.sin(e)*t,datum:a.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;o=yt(e),Lt.current={version:n,graph:o}}const r=Mt.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Mt.current=0;const t=o.flat[0];Pt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},xt(t)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return tt.current=n,rt(n),me&&me(n),void pt()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return Mt.current=-1,Pt.current=null,tt.current=null,rt(null),me&&me(null),void pt();Mt.current=a;const s=o.flat[a];Pt.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},xt(s)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});tt.current=l,rt(l),me&&me(l),pt()},[me,pt]),Tt=l(e=>{Mt.current=-1,Pt.current=null,Et.current(e)},[]);nt.current=()=>{var e,t;et.current=0;const n=Qe.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=ft.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(Ge.current?i+1e6:i),s=!Ge.current&&a,l=Ze.current;l&&!a&&(r.computeScene({width:Ve,height:Ue}),Ze.current=!1),(l||s)&&n.setAttribute("aria-label",dn(r.scene,b+" chart"));const c=Wn(),u=qe[0]*c,d=qe[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=qe[0]+"px",n.style.height=qe[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,qe[0],qe[1]);const h=null!==(e=null==He?void 0:He.threshold)&&void 0!==e?e:5e3,g=He&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==He?void 0:He.dimOpacity)&&void 0!==t?t:.5);const f=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=_e||(f&&"transparent"!==f?f:null);p&&(o.fillStyle=p,o.fillRect(0,0,qe[0],qe[1]));const y="radial"===L;o.save(),o.beginPath(),o.rect(Xe.left,Xe.top,Ve,Ue),o.clip(),y?(o.save(),o.translate(Xe.left+Ve/2,Xe.top+Ue/2)):o.translate(Xe.left,Xe.top);const m=Wo[b]||[],v={width:Ve,height:Ue};for(const e of m)e(o,r.scene,r.scales,v);y&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(at(r.scales),lt(e=>e+1)),(null==He?void 0:He.showBadge)&&ut(!!g),(s||r.hasActivePulses)&&(et.current=requestAnimationFrame(()=>nt.current()))},o(()=>(pt(),()=>{et.current&&(cancelAnimationFrame(et.current),et.current=0)}),[pt]),o(()=>{Ze.current=!0,pt()},[b,Ve,Ue,le,_e,pt]),wt(He,ft,Ze,pt,ct,ut);const Bt=dt&&ot?ye?ye(ot):e.createElement(Ro,{hover:ot}):null,Nt="radial"===L,Dt=Bt?e.createElement(Cn,{x:ot?Nt?ot.x+Ve/2:ot.x:0,y:ot?Nt?ot.y+Ue/2:ot.y:0,containerWidth:Ve,containerHeight:Ue,margin:Xe,className:"stream-ordinal-tooltip"},Bt):null;if(an){const t=ft.current;t&&k&&(t.ingest({inserts:k,bounded:!0}),t.computeScene({width:Ve,height:Ue}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===L,i=r?Xe.left+Ve/2:Xe.left,a=r?Xe.top+Ue/2:Xe.top;return e.createElement("div",{className:"stream-ordinal-frame"+(Le?" "+Le:""),role:"img","aria-label":Fe||("string"==typeof Pe?Pe:"Ordinal chart"),style:{position:"relative",width:qe[0],height:qe[1]}},e.createElement(An,{summary:ze}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:qe[0],height:qe[1],style:{position:"absolute",left:0,top:0}},Ce&&e.createElement("g",{transform:`translate(${Xe.left},${Xe.top})`},Ce),e.createElement("g",{transform:`translate(${i},${a})`},_e&&e.createElement("rect",{x:0,y:0,width:Ve,height:Ue,fill:_e}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=t.category||t.group||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:rn(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=ie().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:u,d:o,transform:`translate(${n.cx},${n.cy})`,fill:rn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:rn(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:rn(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:rn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:rn(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(So,{width:Ve,height:Ue,totalWidth:qe[0],totalHeight:qe[1],margin:Xe,scales:o,showAxes:le,showCategoryTicks:ce,oLabel:ue,rLabel:de,oFormat:he,rFormat:ge,showGrid:xe,title:Pe,legend:ke,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Oe,legendIsolatedCategories:Ee,legendPosition:je,foregroundGraphics:Ke,annotations:ve,svgAnnotationRules:be,annotationFrame:0,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),Te&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Xe.left+Ve/2,top:Xe.top+Ue/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Te))}const Ht="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ye,className:"stream-ordinal-frame"+(Le?" "+Le:""),role:"group","aria-label":Fe||("string"==typeof Pe?Pe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":qe[0],height:B?"100%":qe[1],overflow:"visible"},onKeyDown:_t},We&&e.createElement(Sn,{tableId:Ht}),We&&e.createElement(kn,{scene:null!==(h=null===(d=ft.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Ht,chartTitle:"string"==typeof Pe?Pe:void 0}),e.createElement(An,{summary:ze}),e.createElement("div",{role:"img","aria-label":Fe||("string"==typeof Pe?Pe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:dt?Tt:void 0,onMouseLeave:dt?Ct:void 0},Ce&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Xe.left},${Xe.top})`},Ce)),e.createElement(wo,{width:Ve,height:Ue,totalWidth:qe[0],totalHeight:qe[1],margin:Xe,scales:it,showAxes:le,showGrid:xe,rFormat:ge}),e.createElement("canvas",{ref:Qe,"aria-label":dn(null!==(f=null===(g=ft.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1]}}),e.createElement(On,{hoverPoint:ot}),e.createElement(So,{width:Ve,height:Ue,totalWidth:qe[0],totalHeight:qe[1],margin:Xe,scales:it,showAxes:le,showCategoryTicks:ce,oLabel:ue,rLabel:de,oFormat:he,rFormat:ge,showGrid:xe,title:Pe,legend:ke,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Oe,legendIsolatedCategories:Ee,legendPosition:je,foregroundGraphics:Ke,annotations:ve,svgAnnotationRules:be,annotationFrame:st,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(p=ft.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),($e||Ie)&&"radial"!==L&&e.createElement(Oo,{width:Ve,height:Ue,totalWidth:qe[0],totalHeight:qe[1],margin:Xe,scales:it,onBrush:Ie||(()=>{})}),Te&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Xe.left+Ve/2,top:Xe.top+Ue/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Te),(null==He?void 0:He.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===He.badgePosition?{top:4,left:4}:"bottom-left"===He.badgePosition?{bottom:4,left:4}:"bottom-right"===He.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ct?"#dc3545":"#28a745",color:"white"})},ct?"STALE":"LIVE"),e.createElement(jn,{active:Mt.current>=0,hoverPoint:ot,margin:Xe,size:qe,shape:null===(y=Pt.current)||void 0===y?void 0:y.shape,width:null===(m=Pt.current)||void 0===m?void 0:m.w,height:null===(v=Pt.current)||void 0===v?void 0:v.h}),Dt))});Go.displayName="StreamOrdinalFrame";const Yo={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},qo={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Xo{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=Vo(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function Vo(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=Uo(l,c,u,d,s),g=d.x-l.x,f=d.y-l.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;h.x+=-f/p*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=Uo(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function Uo(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function Ko(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Qo(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var f=i[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}i[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(r[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[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),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];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:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];i[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function Zo(e){return e.y0-e.y1>0?"up":"down"}function Jo(e,t){return t(e.source)==t(e.target)}function er(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function tr(e){return e.target.x0-e.source.x1}function nr(e,t){var n=rr(e),o=tr(t)/Math.tan(n);return"up"==Zo(e)?e.y1-o:e.y1+o}function or(e,t){var n=rr(e),o=tr(t)/Math.tan(n);return"up"==Zo(e)?e.y1+o:e.y1-o}function rr(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ir(e,t){return t(e)}function ar(e){return lr(e.source)}function sr(e){return lr(e.target)}function lr(e){return(e.y0+e.y1)/2}function cr(e){return e.virtual?0:e.value}function ur(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Jo(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Jo(e,t)?o+1:o}),n+o}function dr(e){return e.target.depth}function hr(e,t){return e.sourceLinks.length?e.depth:t-1}function gr(e,t){return e.y0-t.y0}function fr(e,t){return t.y0-e.y0}function pr(e,t){return e.y1-t.y1}function yr(e,t){return t.y1-e.y1}function mr(e,t){return br(e.source,t.source)||e.index-t.index}function vr(e,t){return br(e.target,t.target)||e.index-t.index}function br(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function xr(e,t){return kr(e)==kr(t)?"bottom"==e.circularLinkType?fr(e,t):gr(e,t):kr(t)-kr(e)}function kr(e){return e.target.column-e.source.column}function wr(e,t){return Ar(e)==Ar(t)}function Ar(e){return e.y0-e.y1>0?"up":"down"}function Sr(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=N(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.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}),Or(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Or(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,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,Jo(e,t)&&er(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+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-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?fr:gr);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?yr:pr),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-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,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function Or(e,t,n){e.sort(xr);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Jo(e,t)&&er(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Er(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Er(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function jr(e){return function(){return e}}function Cr(e){return e.index}function Mr(e){return e.nodes}function Pr(e){return e.links}function Lr(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=lr(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=lr(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=o.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(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ur(t,n)-ur(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ur(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function _r(e,t,n,o,r,i){var a=D(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 s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&ur(r,n)>0){var l=I(r.sourceLinks,sr),c=I(r.targetLinks,ar),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-lr(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=I(r.sourceLinks,sr),g=I(r.targetLinks,ar),f=((h&&g?(h+g)/2:h||g)-lr(r))*t;r.y0+=f,r.y1+=f}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||br),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function Tr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(vr),e.targetLinks.sort(mr)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function Br(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=Cr,l=hr,c=void 0,u=32,d=2,h=Mr,g=Pr;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=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return W(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=Ko(n,o)),"object"!=typeof r&&(r=e.target=Ko(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Qo(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){ir(e,t)!=ir(r.source,t)&&ir(e,t)!=ir(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Jo(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max($(e.sourceLinks,cr),$(e.targetLinks,cr)),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,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var f=D(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=H(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=D(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 r=N(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/$(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=H(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),Lr(h,c,s),_r(h,c,s,g,g,u),Tr(h),Sr(h,s,d,10,8),Lr(h,c,s),_r(h,c,s,g,g,u),Tr(h),Sr(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return ir(n.source,t)==ir(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!wr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=nr(t,e);return e.y1-n}if(t.target.column>e.target.column)return nr(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 i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return ir(n.target,t)==ir(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!wr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=or(t,e);return e.y0-n}if(t.source.column>e.source.column)return or(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 i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=N(t,function(e){return e.y0}),a=H(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Sr(h,s,d,10,8)}(f),f}return f.update=function(e){return Tr(e),Sr(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(r=+e,f):r},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:jr(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:jr(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:jr(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:jr(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(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],f):[[e,t],[n,o]]},f.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],f):[n-e,o-t]},f}const Nr=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ue(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=ue(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function Dr(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const Hr=new Set,$r=new WeakMap;function Ir(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=$r.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,$r.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;Hr.has(e)||(Hr.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const Wr={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(dr))-1:0},justify:hr},Fr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,f=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=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 v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=Br().extent(v).links(m).nodes(y).nodeAlign(Wr[h]||hr).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.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 m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=k.get(e._edgeKey?e._edgeKey:`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:_,f=new Map;e.forEach((e,t)=>{f.set(e.id,g[t%g.length])});const p=[],y=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(Ir(t,"nodeStyle")):{},r={fill:o.fill||f.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};v.set(t.id,("string"==typeof r.fill?r.fill:null)||f.get(t.id)||"#4d430c"),p.push("down"===l?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const b=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of b){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 o="#999";o="function"==typeof h?h(e)||o:"target"===h?v.get(n.id)||f.get(n.id)||o:v.get(t.id)||f.get(t.id)||o;const r=u?u(Ir(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?Dr(e):Nr(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};y.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:y,labels:m}}},zr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__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),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=Rr(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const r=Gr(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=Gr(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const g=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=h?40:g,p=Yr(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e),m=de().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),v=he().force("charge",ge().strength(e=>-25*y(e))).force("center",fe(s,l).strength(.8)).force("x",pe(s).strength(.15)).force("y",ye(l).strength(.15));if(v.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}));v.force("link",m),v.force("link").links(e)}h?v.alpha(.3):.1>v.alpha()&&v.alpha(1),v.stop();for(let e=0;f>e;++e)v.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(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=b.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=b.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=Yr(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:_,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],f=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(Ir(t,"nodeSize")),n=s?s(Ir(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(Ir(e,"edgeStyle")):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(Ir(n,"nodeSize"));f.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:g,labels:f}}};function Rr(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function Gr(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Yr(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=N(a))&&void 0!==o?o:0,l=null!==(r=H(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=m().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const qr=_,Xr={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.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,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const y=ve().padAngle(r);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=ie().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.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,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}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 m){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:qr,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=me().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(Ir(n,"nodeStyle")).fill||y.get(n.id)||p[t%p.length]:y.get(n.id)||p[t%p.length];const a=h?h(Ir(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=Vr(n,u,d);let r="#999";if(g)r=g(Ir(e,"edgeStyle")).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===f&&n?r=y.get(n.id)||r:t&&(r=y.get(t.id)||r)}const a=g?g(Ir(e,"edgeStyle")):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Vr(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const Ur=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Kr(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}function Qr(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Zr(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function Jr(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const ei={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),c=z(i,s);c.sum(l),c.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[u,d]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=V();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(c,n,u,d);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=X();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(c,n,u,d);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=Y().size([n,o]).tile(q).padding(a);s>0&&l.paddingTop(s),l(e)}(c,n,u,d);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(c,n,u,d);break;case"partition":!function(e,t,n,o){var r;R().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(c,n,u,d)}const h=c.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;h.length>t;t++){const o=h[t],i={id:Qr(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?ti(i,o,n):"treemap"===a||"partition"===a?ni(i,o):"circlepack"===a&&oi(i,o),i.__hierarchyNode=o,e.push(i),g.set(o,i)}if("tree"===a||"cluster"===a)for(const e of h)if(e.parent){const n=g.get(e.parent),o=g.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],f=n.treeOrientation||"vertical",p="radial"===f,y=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;p&&(e+=y,o+=m);const i=r(Ir(t,"nodeStyle"));let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=Ur[t.depth%Ur.length]);const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=n.edgeOpacity)&&void 0!==s?s:.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 o=t.x,r=t.y,a=n.x,s=n.y;p&&(o+=y,r+=m,a+=y,s+=m);const u=Jr(o,r,a,s,f),d=i(Ir(e,"edgeStyle")),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Zr(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(p&&(a+=y,s+=m),p){const e=a-y,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===f?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(Ir(n,"nodeStyle"));let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=Ur[n.depth%Ur.length]);const c={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:c,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Zr(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,c=l.y1-l.y0;if(0>=e||0>=c)continue;const u=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===r&&!u)continue;if("parent"===r&&u)continue}const d=n?n(l):l.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>c)continue;let h=o(Ir(l,"nodeStyle")).fill||"#4d430c";t.colorByDepth&&void 0!==l.depth&&(h=Ur[l.depth%Ur.length]);const g=Kr(h);s.push(u?{x:l.x0+e/2,y:l.y0+c/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(Ir(n,"nodeStyle"));let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=Ur[n.depth%Ur.length]);const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Zr(t.nodeLabel);for(const r of e){const e=null!==(s=r.__radius)&&void 0!==s?s:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=r.data)||void 0===l?void 0:l.children)&&r.data.children.length>0);let c=o(Ir(r,"nodeStyle")).fill||"#4d430c";if(t.colorByDepth&&void 0!==r.depth&&(c=Ur[r.depth%Ur.length]),a){const t=Kr(c);u.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:r.x,y:r.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function ti(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(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 ni(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 oi(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function ri(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const ii={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=ri(n);f.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,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,n,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,E=le().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=E(k),C=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=i+O*Math.sin(s),g=a+O*Math.cos(s)*C;o.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:s,depth:d,parentId:n,eccentricity:C}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l;const c=n.nodeStyle,u=n.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],g=[],f=[];if(!1!==n.orbitShowRings){const t=ri(n),o=new Map;for(const t of e)o.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;g.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(Ir(t,"nodeSize")),n=c?c(Ir(t,"nodeStyle")):{},o={fill:n.fill||"#6366f1",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=d(Ir(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(l=null===(s=n.data)||void 0===s?void 0:s[t])&&void 0!==l?l:n.id;f.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:f}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=ri(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o: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 n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},ai={sankey:Fr,force:zr,chord:Xr,tree:ei,cluster:ei,treemap:ei,circlepack:ei,partition:ei,orbit:ii};function si(e){return ai[e]}class li{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=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({},Yo),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Xo(2e3))}updateConfig(e){const t=this.config,n=e;t.__orbitState&&(n.__orbitState=t.__orbitState),t.__hierarchyRoot&&(n.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Yo),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Xo(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},ci(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=Number(u(n))||1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},ci(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},ci(r)),{data:n}));const a=`${o}\0${r}\0${e}`;this.edges.set(a,{source:o,target:r,value:i,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:a})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,ci(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,ci(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=si(this.config.chartType);if(!s)return;let l=Array.from(this.nodes.values()),c=Array.from(this.edges.values());if(0===l.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of l)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(l,c,this.config,e),delete this.config.__previousPositions,s.hierarchical&&l.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of l)this.nodes.set(e.id,e);for(let e=0;c.length>e;e++){const t=c[e],n=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=n,this.edges.set(n,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),l.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.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=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=si(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=si(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=si(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),r=Array.from(this.edges.values());return n.tick(o,r,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=Fe(e,this.transition),n=We(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=ze(e._prevX0,e._targetX0,n),e.x1=ze(e._prevX1,e._targetX1,n),e.y0=ze(e._prevY0,e._targetY0,n),e.y1=ze(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=ze(e._prevY0,e._targetY0,n),e.y1=ze(e._prevY1,e._targetY1,n),e.sankeyWidth=ze(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}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);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,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,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t,n,o,r;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const l=this._decaySortedNodes,c=new Map;for(let e=0;l.length>e;e++)c.set(l[e][0],e);for(const e of this.sceneNodes){const l=e.id;if(!l)continue;const u=c.get(l);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(n=i.stepThreshold)&&void 0!==n?n:.5*s)>d?1:a;break;default:h=1}const g=null!==(r=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;e.style=Object.assign(Object.assign({},e.style),{opacity:g*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),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,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(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 n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}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.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function ci(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 ui(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=di(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=pi(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function di(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=tt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let hi=null,gi=null;function fi(){return gi||(hi=document.createElement("canvas"),hi.width=1,hi.height=1,gi=hi.getContext("2d")),gi}function pi(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=fi();if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}const s=a.lineWidth;a.lineWidth=10;const l=a.isPointInStroke(i,t,n);if(a.lineWidth=s,l)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=fi();if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function yi(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",foregroundGraphics:p,sceneNodes:y,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof l?l:"Network Chart"),e.createElement("desc",null,"string"==typeof l?l+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,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"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,r)=>{if(v){const i=v(t,r,{width:n,height:o,sceneNodes:y});if(i)return e.createElement(e.Fragment,{key:"annotation-"+r},i)}return null}),p),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,Mt({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:f,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&y).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=y.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const f=a.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=a.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),m=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,b=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.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+n,style:{position:"absolute",left:f+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function mi(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s: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 vi(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n: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!==(o=t.style.strokeWidth)&&void 0!==o?o: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 bi(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function xi(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}yi.displayName="NetworkSVGOverlay";const ki={top:20,right:80,bottom:20,left:80},wi={top:40,right:40,bottom:40,left:40},Ai=new Set(["chord","force","circlepack","orbit"]),Si=[800,600],Oi={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 Ei({data:t}){var n,o,r,i,a,s;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:Oi},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:Oi},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:Oi},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const ji=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b,x,k,w;const{chartType:A,nodes:S,edges:O,data:E,initialEdges:j,nodeIDAccessor:C="id",sourceAccessor:M="source",targetAccessor:P="target",valueAccessor:L="value",childrenAccessor:_,hierarchySum:T,orientation:B="horizontal",nodeAlign:N="justify",nodePaddingRatio:D=.05,nodeWidth:H=15,iterations:$=300,forceStrength:I=.1,padAngle:W=.01,groupWidth:F=20,sortGroups:z,edgeSort:R,treeOrientation:G="vertical",edgeType:Y="curve",padding:q,paddingTop:X,tensionConfig:V,showParticles:U=!1,particleStyle:K,nodeStyle:Q,edgeStyle:Z,colorBy:J,colorScheme:ee="category10",edgeColorBy:te="source",edgeOpacity:ne=.5,colorByDepth:oe=!1,nodeSize:re=8,nodeSizeRange:ae=[5,20],nodeLabel:se,showLabels:le=!0,labelMode:ce,size:ue=Si,responsiveWidth:de,responsiveHeight:he,margin:ge,className:fe,background:pe,enableHover:ye=!0,tooltipContent:me,customHoverBehavior:ve,customClickBehavior:be,onObservation:xe,chartId:ke,onTopologyChange:we,annotations:Ae,svgAnnotationRules:Se,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,title:_e,foregroundGraphics:Te,backgroundGraphics:Be,decay:Ne,pulse:De,staleness:He,thresholds:$e,accessibleTable:Ie=!0,description:We,summary:Fe,orbitMode:ze,orbitSize:Re,orbitSpeed:Ge,orbitRevolution:Ye,orbitRevolutionStyle:qe,orbitEccentricity:Xe,orbitShowRings:Ve,orbitAnimated:Ue}=i,Ke=Pn(),Qe=t(Ke);Qe.current=Ke;const Ze="semiotic-table-"+e.useId(),Je=Ai.has(A)?wi:ki,[et,tt]=kt(ue,de,he),nt=Object.assign(Object.assign({},Je),ge),ot=tt[0]-nt.left-nt.right,rt=tt[1]-nt.top-nt.bottom,it="function"==typeof Te?Te({size:tt,margin:nt}):Te,at=n(()=>Object.assign(Object.assign({},Yo),V),[V]),st=n(()=>Object.assign(Object.assign({},qo),K),[K]),lt=n(()=>({chartType:A,nodeIDAccessor:C,sourceAccessor:M,targetAccessor:P,valueAccessor:L,childrenAccessor:_,hierarchySum:T,orientation:B,nodeAlign:N,nodePaddingRatio:D,nodeWidth:H,iterations:$,forceStrength:I,padAngle:W,groupWidth:F,sortGroups:z,edgeSort:R,treeOrientation:G,edgeType:Y,padding:q,paddingTop:X,tensionConfig:at,showParticles:U,particleStyle:st,nodeStyle:Q,edgeStyle:Z,nodeLabel:se,showLabels:le,labelMode:ce,colorBy:J,colorScheme:ee,edgeColorBy:te,edgeOpacity:ne,colorByDepth:oe,nodeSize:re,nodeSizeRange:ae,decay:Ne,pulse:De,staleness:He,thresholds:$e,orbitMode:ze,orbitSize:Re,orbitSpeed:Ge,orbitRevolution:Ye,orbitRevolutionStyle:qe,orbitEccentricity:Xe,orbitShowRings:Ve,orbitAnimated:Ue}),[A,C,M,P,L,_,T,B,N,D,H,$,I,W,F,z,R,G,Y,q,X,at,U,st,Q,Z,se,le,ce,J,ee,te,ne,oe,re,ae,Ne,De,He,$e,ze,Re,Ge,Ye,qe,Xe,Ve,Ue]),ct=t(null),ut=t(0),dt=t(0),ht=t(!0),gt=$n(e=>e.theme),ft=t(()=>{}),pt=t(null);pt.current||(pt.current=new li(lt));const[bt,xt]=r(null),[At,St]=r(0),[Ot,Et]=r(0),[jt,Ct]=r(!1),Mt=t(null),Pt=t(new Map),Lt=t(0),_t=l(e=>{if("function"==typeof J)return J(e)+"";if("string"==typeof J&&e.data){const t=e.data[J];if(void 0!==t){if(!Pt.current.has(t+"")){const e=Array.isArray(ee)?ee:Le;Pt.current.set(t+"",e[Lt.current++%e.length])}return Pt.current.get(t+"")}}if(Pt.current.has(e.id))return Pt.current.get(e.id);const t=Array.isArray(ee)?ee:Le,n=J?t[Lt.current++%t.length]:t[0];return Pt.current.set(e.id,n),n},[J,ee]),Tt=l(e=>{if("function"==typeof te)return te(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===te&&n?_t(n):t?_t(t):"#999"},[te,_t]),Bt=l(e=>{if(!(null==K?void 0:K.colorBy))return Tt(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===st.colorBy&&n?_t(n):t?_t(t):"#999"},[null==K?void 0:K.colorBy,st.colorBy,_t,Tt]),Nt="sankey"===A&&U||!!De||null!==(c=null===(s=pt.current)||void 0===s?void 0:s.isAnimating)&&void 0!==c&&c,Dt=l(()=>{ut.current&&!Nt||ut.current||(ut.current=requestAnimationFrame(()=>ft.current()))},[Nt]);o(()=>{var e;null===(e=pt.current)||void 0===e||e.updateConfig(lt),ht.current=!0,Dt()},[lt,Dt]),o(()=>{ht.current=!0,Dt()},[gt,Dt]);const Ht=l(()=>{var e;const t=pt.current;if(!t)return;t.runLayout([ot,rt]),t.buildScene([ot,rt]),ht.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Pt.current.set(n.id,n.style.fill);const n=Array.isArray(ee)?ee:Le,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Pt.current.has(t.id)||Pt.current.set(t.id,n[e%n.length])}if(Lt.current=o.length,St(t.layoutVersion),we){const{nodes:e,edges:n}=t.getLayoutData();we(e,n)}},[ot,rt,we,ee]),$t=l(e=>{const t=pt.current;t&&(t.ingestEdge(e)&&Ht(),Dt())},[Ht,Dt]),It=l(e=>{const t=pt.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Ht(),Dt()},[Ht,Dt]),Wt=l(()=>{var e;null===(e=pt.current)||void 0===e||e.clear(),Pt.current.clear(),Lt.current=0,St(0),xt(null),Mt.current=null,ht.current=!0,Dt()},[Dt]),Ft=l(()=>{const e=pt.current;e&&(e.tension+=999,Ht(),Dt())},[Ht,Dt]);u(a,()=>({push:$t,pushMany:It,clear:Wt,getTopology:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=pt.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:Ft,getTension:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[$t,It,Wt,Ft]);const zt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),Rt=zt?E||(Array.isArray(O)?void 0:O):void 0;o(()=>{var e;const t=pt.current;if(t)if(zt&&Rt)t.ingestHierarchy(Rt,[ot,rt]),t.buildScene([ot,rt]),ht.current=!0,Dt();else{const n=S||[],o=Array.isArray(O)?O:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[ot,rt]),t.buildScene([ot,rt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Pt.current.set(n.id,n.style.fill+"");const r=Array.isArray(ee)?ee:Le,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Pt.current.has(t.id)||Pt.current.set(t.id,r[e%r.length])}Lt.current=i.length,ht.current=!0,Dt()}},[S,O,E,Rt,zt,ot,rt,lt,Dt,ee]),o(()=>{j&&j.length>0&&It(j)},[]);const Gt=l(e=>{if(ve&&ve(e),xe){const t=Date.now();xe(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ke}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ke})}},[ve,xe,ke]),Yt=l(e=>{if(be&&be(e),xe){const t=Date.now();xe(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ke}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ke})}},[be,xe,ke]),qt=t(()=>{}),Xt=t(()=>{});qt.current=e=>{if(!ye)return;const t=ct.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-nt.left,r=e.clientY-n.top-nt.top;if(0>o||o>ot||0>r||r>rt)return void(Mt.current&&(Mt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt()));const i=pt.current;if(!i)return;const a=ui(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(Mt.current&&(Mt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt()));const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:a.type,data:s,x:a.x,y:a.y});Mt.current=l,xt(l),Gt&&(Gt(l),ht.current=!0),Dt()},Xt.current=()=>{Mt.current&&(Mt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt())};const Vt=t(()=>{});Vt.current=e=>{if(!be&&!xe)return;const t=ct.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-nt.left,r=e.clientY-n.top-nt.top;if(0>o||o>ot||0>r||r>rt)return;const i=pt.current;if(!i)return;const a=ui(i.sceneNodes,i.sceneEdges,o,r);if(a){const e=a.datum||{};Yt(Object.assign(Object.assign({},"object"!=typeof e||null===e||Array.isArray(e)?{}:e),{type:a.type,data:e,x:a.x,y:a.y}))}else Yt(null)},l(e=>qt.current(e),[]);const Ut=l(()=>Xt.current(),[]),Kt=l(e=>Vt.current(e),[]),Qt=t(-1),Zt=t(null),Jt=t(-1),en=l(e=>{var t;const n=pt.current;if(!n)return;const o=function(e){var t,n,o,r,i,a;const s=[];for(const l of e)"circle"===l.type&&null!=l.cx?s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"}):"rect"===l.type&&null!=l.x?s.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!==(r=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"}):"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(i=l.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const r=yt(o),i=Qt.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Qt.current=0,Jt.current=-1;const t=r.flat[0];Zt.current={shape:t.shape,w:t.w,h:t.h};const n=t.datum||{},o=Object.assign(Object.assign({},"object"!=typeof n||null===n||Array.isArray(n)?{}:n),{type:"node",data:n,x:t.x,y:t.y});return Mt.current=o,xt(o),Gt&&(Gt(o),ht.current=!0),void Dt()}const a=mt(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return vt(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n,o,r;const i=e+"",a=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,s="object"==typeof t.source?null===(o=t.source)||void 0===o?void 0:o.id:t.source,l="object"==typeof t.target?null===(r=t.target)||void 0===r?void 0:r.id:t.target,c=null!=s,u=null!=l;c&&s+""===i&&u?a.push(l+""):u&&l+""===i&&c&&a.push(s+"")}return a}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=vt(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Jt);if(null===s)return;if(e.preventDefault(),0>s)return Qt.current=-1,Zt.current=null,Jt.current=-1,Mt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),void Dt();Qt.current=s;const l=r.flat[s];Zt.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{type:"node",data:c,x:l.x,y:l.y});Mt.current=u,xt(u),Gt&&(Gt(u),ht.current=!0),Dt()},[Gt,Dt]),tn=l(e=>{Qt.current=-1,Zt.current=null,qt.current(e)},[]);ft.current=()=>{var e,t,n,o,r,i,a;ut.current=0;const s=ct.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=pt.current;if(!c)return;const u=performance.now(),d=dt.current?Math.min((u-dt.current)/1e3,.1):.016;dt.current=u;const h=c.advanceTransition(Qe.current?u+1e6:u),g=!Qe.current&&h,f=!Qe.current&&c.tickAnimation([ot,rt],d);(h||ht.current||f)&&c.buildScene([ot,rt]);const p=Wn();if(!In(s,tt,nt,p))return;l.clearRect(-nt.left,-nt.top,tt[0],tt[1]),pe&&(l.fillStyle=pe,l.fillRect(0,0,ot,rt)),Ne&&c.applyDecay(),De&&c.applyPulse(u),$e&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==He?void 0:He.threshold)&&void 0!==e?e:5e3,m=He&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==He?void 0:He.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":mi(e,n);break;case"line":vi(e,n);break;case"ribbon":bi(e,n);break;case"curved":xi(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),qn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;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=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),Xn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;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=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),U&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:qo.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:qo.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,st);const t=.5*(null!==(n=st.speedMultiplier)&&void 0!==n?n:1);let o;if(st.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:qo.radius,l=null!==(a=o.opacity)&&void 0!==a?a:qo.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,st,Bt)}}m&&(l.globalAlpha=1);const v=ht.current;if(ht.current=!1,v||g||f){const e=ct.current;e&&e.setAttribute("aria-label",hn(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||g||f)&&Et(e=>e+1),(Nt||g||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(ut.current=requestAnimationFrame(()=>ft.current()))},o(()=>(Dt(),()=>{ut.current&&(cancelAnimationFrame(ut.current),ut.current=0)}),[Dt]),o(()=>{ht.current=!0,Dt()},[A,ot,rt,pe,Dt]),wt(He,pt,ht,Dt,jt,Ct);const nn=ye&&bt?e.createElement(Cn,{x:bt.x,y:bt.y,containerWidth:ot,containerHeight:rt,margin:nt,className:"stream-network-tooltip",zIndex:2},me?me(bt):e.createElement(Ei,{data:bt})):null;if(an){const t=pt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),n=e?E||(Array.isArray(O)?void 0:O):void 0;if(e&&n)t.ingestHierarchy(n,[ot,rt]),t.buildScene([ot,rt]);else{const e=S||[],n=Array.isArray(O)?O:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[ot,rt]),t.buildScene([ot,rt]))}}const n=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],o=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],r=null!==(g=null==t?void 0:t.labels)&&void 0!==g?g:[];return e.createElement("div",{className:"stream-network-frame"+(fe?" "+fe:""),role:"img","aria-label":We||("string"==typeof _e?_e:"Network chart"),style:{position:"relative",width:tt[0],height:tt[1]}},e.createElement(An,{summary:Fe}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:tt[0],height:tt[1],style:{position:"absolute",left:0,top:0}},Be&&e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Be),e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},pe&&e.createElement("rect",{x:0,y:0,width:ot,height:rt,fill:pe}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+n,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});case"bezier":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"ribbon":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"curved":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.createElement("circle",{key:"net-circle-"+n,cx:o.cx,cy:o.cy,r:o.r,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"rect":{const o=t;return e.createElement("rect",{key:"net-rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"arc":{const o=t,r=ie().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle).endAngle(o.endAngle)({})||"";return e.createElement("path",{key:"net-arc-"+n,d:r,transform:`translate(${o.cx},${o.cy})`,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e.createElement("text",{key:"net-label-"+n,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},t.text)}(t,n)).filter(Boolean))),e.createElement(yi,{width:ot,height:rt,totalWidth:tt[0],totalHeight:tt[1],margin:nt,labels:r,sceneNodes:n,title:_e,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,foregroundGraphics:it,annotations:Ae,svgAnnotationRules:Se,annotationFrame:0}))}const on=pt.current;return e.createElement("div",{ref:et,className:"stream-network-frame"+(fe?" "+fe:""),role:"group","aria-label":We||("string"==typeof _e?_e:"Network chart"),tabIndex:0,style:{position:"relative",width:de?"100%":tt[0],height:he?"100%":tt[1],overflow:"visible"},onKeyDown:en},Ie&&e.createElement(Sn,{tableId:Ze}),Ie&&e.createElement(wn,{nodes:null!==(f=null==on?void 0:on.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==on?void 0:on.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:Ze,chartTitle:"string"==typeof _e?_e:void 0}),e.createElement(An,{summary:Fe}),e.createElement("div",{role:"img","aria-label":We||("string"==typeof _e?_e:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ye?tn:void 0,onMouseLeave:ye?Ut:void 0,onClick:be||xe?Kt:void 0},Be&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:tt[0],height:tt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Be)),e.createElement("canvas",{ref:ct,"aria-label":hn(null!==(m=null===(y=null==on?void 0:on.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==on?void 0:on.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(On,{hoverPoint:bt}),e.createElement(yi,{width:ot,height:rt,totalWidth:tt[0],totalHeight:tt[1],margin:nt,labels:(null==on?void 0:on.labels)||[],sceneNodes:null==on?void 0:on.sceneNodes,title:_e,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,foregroundGraphics:it,annotations:Ae,svgAnnotationRules:Se,annotationFrame:Ot}),e.createElement(jn,{active:Qt.current>=0,hoverPoint:bt,margin:nt,size:tt,shape:null===(x=Zt.current)||void 0===x?void 0:x.shape,width:null===(k=Zt.current)||void 0===k?void 0:k.w,height:null===(w=Zt.current)||void 0===w?void 0:w.h}),nn,(null==He?void 0:He.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===He.badgePosition?{top:4,left:4}:"bottom-left"===He.badgePosition?{bottom:4,left:4}:"bottom-right"===He.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:jt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},jt?"STALE":"LIVE")))});ji.displayName="StreamNetworkFrame";const Ci={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 Mi(e,t){return"function"==typeof t?t(e):e[t]}function Pi(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 Li(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=Mi(t,o);s=Pi(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Mi(t,o);l.push({label:n,value:Pi(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Pi(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Pi(t[e[0]],r))}}const c=Object.assign(Object.assign({},Ci),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function _i(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Mi(t,o);c.push({value:Pi(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Pi(Mi(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:Pi(t[e],r)})});const u=Object.assign(Object.assign({},Ci),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function Ti(t){if(!0===t)return Li();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:Ci},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Li(t):Li())}function Bi(e){return"string"==typeof e?e:"value"}function Ni(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Di(e,t){return"function"==typeof t?t(e):e[t]}function Hi(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?Ni(Di(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=Ni(Di(r,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function $i({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=Di(l,t),u=Di(l,n),d=o?Di(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},e.createElement("div",{style:{fontWeight:"bold"}},Ni(c)),e.createElement("div",{style:{marginTop:4}},Ni(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Bi(o),": ",Ni(d)))}}const Ii=a(null);function Wi({colors:t,categories:o,colorScheme:r="category10",children:i}){const a=n(()=>{if(t)return t;if(o){const e=Array.isArray(r)?r:Pe[r]||Le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,r]);return e.createElement(Ii.Provider,{value:a},i)}function Fi(){return s(Ii)}function zi(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Ri(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(zi(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Gi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Wi.displayName="CategoryColorProvider";const[Yi,qi]=Ln(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Gi(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Gi(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Xi,Vi]=Ln(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ui(e){const t=d(),o=e.clientId||t,{name:r}=e,i=qi(e=>e.selections.get(r)),a=qi(e=>e.setClause),s=qi(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?Ri(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:l(()=>{s(r,o)},[s,r,o]),clientId:o}}function Ki(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Ui({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}function Qi(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=Ui({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&s(t)},[u,o,r,s,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Zi(e,t,o){const r=qi(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=Ri(r,o);return e.filter(t)},[e,r,o])}function Ji(e={}){const{limit:t=50,types:o,chartId:r}=e,i=Vi(e=>e.version),a=Vi(e=>e.observations),s=Vi(e=>e.clearObservations),l=n(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[a,o,r,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const ea=a(!1);function ta({selections:e}){const t=qi(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function na({categoryColors:n,interaction:i,selectionName:a,field:s}){const c=Object.entries(n);if(0===c.length)return null;const u=c.map(([e])=>e),d=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],h=Ki({name:a,fields:[s]}),g=Ui({name:a,clientId:"__linked-legend-isolate__"}),[f,p]=r(new Set),[y,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(f.size>0?v.current({[s]:Array.from(f)}):b.current())},[i,f,s]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[s]:e.label})):(m(null),h.onHover(null)))},[i,s,h]),k=l(e=>{"isolate"===i&&p(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[i,u.length]);return e.createElement("svg",{width:"100%",height:30,style:{display:"block",overflow:"visible"}},e.createElement(Ct,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:y,isolatedCategories:f}))}function oa({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=Fi(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(Yi,null,e.createElement(Xi,null,n&&e.createElement(ta,{selections:n}),e.createElement(ea.Provider,{value:c},c&&"top"===r&&l&&e.createElement(na,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(na,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function ra({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_e[i%_e.length];return{label:r+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:s,label:""}]}}function ia(e){return e?"string"==typeof e?{name:e}:e:null}function aa(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const sa=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],la={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},ca={light:Bn,dark:Nn,"high-contrast":Dn,pastels:{mode:"light",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc"},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",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc"},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",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#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",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6"},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",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000"},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",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333"},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",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},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",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050"},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",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},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",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b"},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",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6"},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",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa"},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",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe"},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",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#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 ua(e){return ca[e]}function da(e,t=":root"){var n,o,r,i,a;const s=[];return s.push(` --semiotic-bg: ${e.colors.background};`),s.push(` --semiotic-text: ${e.colors.text};`),s.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),s.push(` --semiotic-grid: ${e.colors.grid};`),s.push(` --semiotic-border: ${e.colors.border};`),s.push(` --semiotic-primary: ${e.colors.primary};`),s.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&s.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&s.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&s.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&s.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&s.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&s.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(r=e.tooltip)||void 0===r?void 0:r.borderRadius)&&s.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)&&s.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(a=e.tooltip)||void 0===a?void 0:a.shadow)&&s.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&s.push(` --semiotic-border-radius: ${e.borderRadius};`),`${t} {\n${s.join("\n")}\n}`}function ha(e){var t,n,o,r,i,a;return{semiotic:Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.text)||e.colors.text,$type:"color"},radius:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(a=e.colors.selectionOpacity)&&void 0!==a?a:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{})}}const ga=e.createContext(void 0);function fa({theme:t}){const n=$n(e=>e.setTheme),o=$n(e=>e.theme),r=e.useRef(o);r.current=o;const i=e.useRef(null);return e.useEffect(()=>{if(void 0!==t)return;if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(forced-colors: active)");return e.matches&&(i.current=r.current,n(Dn)),Mn(e,e=>{var t;e.matches?(i.current=r.current,n(Dn)):(n(null!==(t=i.current)&&void 0!==t?t:Bn),i.current=null)})},[t,n]),e.useEffect(()=>{if(void 0!==t)if("string"==typeof t){const e=ua(t);n(e||t)}else n(t)},[t,n]),null}function pa({children:t}){var n,o,r,i,a;const s=$n(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":s.colors.background,"--semiotic-text":s.colors.text,"--semiotic-text-secondary":s.colors.textSecondary,"--semiotic-grid":s.colors.grid,"--semiotic-border":s.colors.border,"--semiotic-primary":s.colors.primary,"--semiotic-font-family":s.typography.fontFamily},s.colors.focus?{"--semiotic-focus":s.colors.focus}:{}),(null===(n=s.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":s.tooltip.background}:{}),(null===(o=s.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":s.tooltip.text}:{}),(null===(r=s.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":s.tooltip.borderRadius}:{}),(null===(i=s.tooltip)||void 0===i?void 0:i.fontSize)?{"--semiotic-tooltip-font-size":s.tooltip.fontSize}:{}),(null===(a=s.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":s.tooltip.shadow}:{}),s.borderRadius?{"--semiotic-border-radius":s.borderRadius}:{}),s.colors.selection?{"--semiotic-selection-color":s.colors.selection}:{}),null!=s.colors.selectionOpacity?{"--semiotic-selection-opacity":s.colors.selectionOpacity+""}:{}),s.colors.diverging?{"--semiotic-diverging":s.colors.diverging}:{}),c=e.useContext(ga),u={};return c&&(u["data-semiotic-theme"]=c),e.createElement("div",Object.assign({style:l},u),t)}function ya({theme:t,children:n}){const o="string"==typeof t&&ua(t)?t:void 0;return e.createElement(Hn,null,e.createElement(ga.Provider,{value:o},e.createElement(fa,{theme:t}),e.createElement(pa,null,n)))}function ma(){return $n(e=>e.theme)}const va="#007bff";function ba(){var e;const t=ma(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function xa(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Pe[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:va}function ka(e){return"function"==typeof e?e:t=>t[e]}function wa(e,t,o){const r=Fi(),i=ba();return n(()=>{var n;if(!t)return;const a=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=De(n.map(e=>({_cat:e})),"_cat",a);return t=>r[t]||e(t)}return De(n.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const n=De(e,t,a);return e=>r[e]||n(e)}return De(e,t,a)}if(r&&Object.keys(r).length>0){const e=De([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Aa(e,t,o){return n(()=>{if(!t)return e;const n=[...e];if("function"==typeof t)return n.sort(t);const r=ka(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function Sa({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:a=!1,onObservation:s,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:f}){const p=d(),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,i),m=Ui({name:(null==e?void 0:e.name)||"__unused__"}),v=Ki({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||i||[]}),b=Vi(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=r(null),A=f||i[0],S=n(()=>{if(!g||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,k,A]),O=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=zt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(zt={positions:new Map(zt.positions).set(e,{xValue:t,sourceId:n})},Gt())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Yt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(g&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,y,p,s,c,u,b,g,A]),E=l(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=zt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(zt.positions);return t.delete(e),zt={positions:t},Gt(),!1}zt={positions:new Map(zt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(y.name||"hover",Number(n),p)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[h,s,b,c,u,y,p]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{qt(e,p),Yt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:p}}function Oa(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Ea({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(ea),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return ra({data:e,colorBy:t,colorScale:o,getColor:Ne,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,i]);return{legend:h,margin:g,legendPosition:i}}function ja(e,t,o){const[i,a]=r(null),[s,c]=r(new Set),u=l(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&c(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=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const Ca={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 Ma(e,t,n){var o,r,i,a,s,l;const c=Ca[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?c.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?c.height:n.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Pa(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function Pa(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function La({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("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}},o)))}class _a extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(La,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Ta(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ba(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ta(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Na(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Da(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Ba(e,t,3))&&void 0!==n?n:null)}function Ha({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Na(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Da(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function $a({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Ia({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Na(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=Da(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Wa={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"}},Fa={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},za={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Ra=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ga=["vertical","horizontal"],Ya={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),Fa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ra},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({},Wa),Fa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ra},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),Fa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ra},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({},Wa),Fa),{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({},Wa),Fa),{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({},Wa),Fa),{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({},Wa),Fa),{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({},Wa),Fa),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),Fa),{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({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),za),{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:Ga},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},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({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Wa),za),{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({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},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({},Wa),za),{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({},Wa),za),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ga},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Wa),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Wa),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Wa),{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({},Wa),za),{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({},Wa),za),{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({},Wa),{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({},Wa),{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:Ga},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({},Wa),{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({},Wa),{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({},Wa),{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({},Wa),{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({},Wa),{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"}}}};function qa(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Xa=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Va=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Ua=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Ka=new Set(["LineChart","AreaChart","StackedAreaChart"]),Qa=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Za(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Ja(e,t){const n=Za(e),o=Za(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const es=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];var ts;const ns="undefined"!=typeof process&&"production"!==(null===(ts=process.env)||void 0===ts?void 0:ts.NODE_ENV);function os({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(_a,{fallback:i=>{let a="";if(ns&&r)try{const e=function(e,t){const n=[],o=function(e,t){const n=[],o=Ya[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Ya).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!qa(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Ba(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=Ha({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=$a({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=Ia({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Ya[e]?(function(e,t,n){const o=Ya[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Ya[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Xa.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Va.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Ya[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Ua.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!Ka.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Ya[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Qa.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Ja(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Ja(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of es)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(La,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const rs={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"},is={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function as(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},rs),{width:n,height:o})},r||"No data available"):null}function ss(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},is),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function ls(e,t,n,o){if(!ns)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function cs(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:j,customClickBehavior:C,crosshairSourceId:M}=Sa({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:S}),P=Oa(c,M),L=wa(t,r,i),_=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),T=ja(a,r,_),B=n(()=>E||(T.legendSelectionHook?T.legendSelectionHook:O),[E,T.legendSelectionHook,O]),{legend:N,margin:D,legendPosition:H}=Ea({data:t,colorBy:r,colorScale:L,showLegend:p,legendPosition:s,userMargin:y,defaults:m}),$=n(()=>{const e={};return N&&(e.legend=N,e.legendPosition=H),a&&"none"!==a&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),e},[N,H,a,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories]),I=ss(x,w,A),W=I?null:as(o,w,A,k);return{colorScale:L,allCategories:_,legendState:T,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:C,legend:N,margin:D,legendPosition:H,earlyReturn:I||W||null,legendBehaviorProps:$,crosshairProps:P}}const us=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:E={},selection:j,linkedHover:C,linkedBrush:M,onObservation:P,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:H,color:$}=o,I=a.width,W=a.height,F=a.enableHover,z=a.showGrid,R=a.title,G=a.description,Y=a.summary,q=a.accessibleTable,X=a.xLabel,V=a.yLabel,U=s||[],K=cs({data:U,rawData:s,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:H,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:_,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:B,emptyContent:N,width:I,height:W}),Q=ia(M),Z=Qi({name:(null==Q?void 0:Q.name)||"__unused_brush__",xField:(null==Q?void 0:Q.xField)||("string"==typeof f?f:void 0),yField:(null==Q?void 0:Q.yField)||("string"==typeof p?p:void 0)}),J=Q?"xyBrush"===Z.brushInteraction.brush?"xy":"xBrush"===Z.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(Z.brushInteraction);ee.current=Z.brushInteraction;const te=l(e=>{const t=ee.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(K.earlyReturn)return K.earlyReturn;ls("Scatterplot",U,"xAccessor",f),ls("Scatterplot",U,"yAccessor",p);const ne=n(()=>{if(!v||0===U.length)return;const e=U.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[U,v]),oe=n(()=>e=>{const t={fillOpacity:k};return y?K.colorScale&&(t.fill=Ne(e,y,K.colorScale)):t.fill=$||va,t.r=v?He(e,v,b,ne):x,t},[y,K.colorScale,v,b,ne,x,k,$]),re=n(()=>aa(oe,K.effectiveSelectionHook,j),[oe,K.effectiveSelectionHook,j]),ie=n(()=>Hi([{label:X||Bi(f),accessor:f,role:"x"},{label:V||Bi(p),accessor:p,role:"y"},...y?[{label:Bi(y),accessor:y,role:"color"}]:[],...v?[{label:Bi(v),accessor:v,role:"size"}]:[]]),[f,p,X,V,y,v]),ae=Ha({componentName:"Scatterplot",data:s,accessors:{xAccessor:f,yAccessor:p}});if(ae)return e.createElement(La,{componentName:"Scatterplot",message:ae,width:I,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({chartType:"scatter"},null!=s&&{data:U}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[I,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,showAxes:a.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:F,showGrid:z}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),{tooltipContent:!1===w?()=>null:Ti(w)||ie}),(C||P||L||_)&&{customHoverBehavior:K.customHoverBehavior}),(P||L||C)&&{customClickBehavior:K.customClickBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),Q&&{brush:{dimension:J},onBrush:te}),K.crosshairProps),E);return e.createElement(os,{componentName:"Scatterplot",width:I,height:W},e.createElement(ho,Object.assign({ref:i},se)))});function ds(e,t){return S(1===t?.5:e/(t-1))}us.displayName="Scatterplot";const hs=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:f,orderLabel:p,pointRadius:y=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:M}=o,P=a.width,L=a.height,_=a.enableHover,T=a.showGrid,B=a.title,N=a.description,D=a.summary,H=a.accessibleTable,$=a.xLabel,I=a.yLabel,W=s||[],{safeData:F,orderMap:z}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=W;if(f&&W.length>0){const e="function"==typeof f?f:e=>e[f];n=[...W].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[W,f,h,g]);ls("ConnectedScatterplot",F,"xAccessor",h),ls("ConnectedScatterplot",F,"yAccessor",g);const{activeSelectionHook:R,hoverSelectionHook:G,customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:X}=Sa({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:S,chartType:"ConnectedScatterplot",chartId:E,hoverHighlight:O,colorByField:void 0}),V=Oa(w,X),U=ja(M,void 0,[]),K=n(()=>G||(U.legendSelectionHook?U.legendSelectionHook:R),[G,U.legendSelectionHook,R]),Q=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==K?void 0:K.isActive,a=null==K?void 0:K.predicate,s=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=ds(t,l),h=!i||!a||a(null!==(n=c.datum)&&void 0!==n?n:c)||a(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;s&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=y+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=y,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[y,K]),Z=n(()=>[Q],[Q]),J=n(()=>(t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const s=a.length,l=100>s,c=[];for(let t=0;s-1>t;t++){const n=a[t],o=a[t+1],u=ds(t,s),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:y+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:y,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[y]),ee=n(()=>[J],[J]),te=n(()=>e=>{var t,n;const o=z.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?ds(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:y,fillOpacity:1}},[y,z]),ne=n(()=>aa(te,K,k),[te,K,k]),oe=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),re=p||("string"==typeof f?f:"Order"),ie=n(()=>Hi([{label:$||Bi(h),accessor:h,role:"x"},{label:I||Bi(g),accessor:g,role:"y"},...f?[{label:re,accessor:f,role:"group"}]:[]]),[h,g,$,I,f,re]),ae=Ha({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),se=ss(j,P,L),le=se?null:as(s,P,L,C),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:"scatter"},null!=s&&{data:F}),{xAccessor:h,yAccessor:g,pointStyle:ne,size:[P,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,showAxes:a.showAxes,xLabel:$,yLabel:I,xFormat:c,yFormat:d,enableHover:_,showGrid:T}),B&&{title:B}),N&&{description:N}),D&&{summary:D}),void 0!==H&&{accessibleTable:H}),l&&{className:l}),{tooltipContent:!1===m?()=>null:Ti(m)||ie}),(w||A||S||O)&&{customHoverBehavior:Y}),(A||S||w)&&{customClickBehavior:q}),v&&{pointIdAccessor:v}),{canvasPreRenderers:Z,svgPreRenderers:ee}),b&&b.length>0&&{annotations:b}),V),x);return se||le||(ae?e.createElement(La,{componentName:"ConnectedScatterplot",message:ae,width:P,height:L}):e.createElement(os,{componentName:"ConnectedScatterplot",width:P,height:L},e.createElement(ho,Object.assign({ref:i},ce))))});function gs(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}hs.displayName="ConnectedScatterplot","function"==typeof SuppressedError&&SuppressedError;const fs="__forecastSegment";let ps=null;function ys(){return gs(this,void 0,void 0,function*(){return ps||(ps=yield import("./semiotic-statisticalOverlays-DGX_WWc5.js")),ps})}const ms=c(function(i,a){var s,c;const d=t(null);u(a,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const h=Ma(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,description:i.description,summary:i.summary,accessibleTable:i.accessibleTable,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:f,className:p,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:E=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:_,annotations:T,directLabel:B,gapStrategy:N="break",anomaly:D,forecast:H,frameProps:$={},selection:I,linkedHover:W,onObservation:F,onClick:z,hoverHighlight:R,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:K,yScaleType:Q,color:Z}=i,J=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,ae=h.summary,se=h.accessibleTable,le=h.xLabel,ce=h.yLabel,ue=ss(q,J,ee),de=ue?null:as(g,J,ee,X),he=g||[];ls("LineChart",he,"xAccessor",v),ls("LineChart",he,"yAccessor",b);const ge="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[pe,ye]=r(null),[me,ve]=r([]),be=n(()=>{if(!H&&!D)return he;const e="function"==typeof v,t="function"==typeof b;return e||t?he.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):he},[he,H,D,v,b]),xe=t(H),ke=t(D);o(()=>{if(!H&&!D)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=H,ke.current=D));let e=!1;const t=H!==xe.current||D!==ke.current;if(xe.current=H,ke.current=D,t&&(ye(null),ve([])),H){const t=x&&"string"==typeof x&&"object"==typeof H?Object.assign(Object.assign({},H),{_groupBy:x}):H;(function(...e){return gs(this,void 0,void 0,function*(){return(yield ys()).buildForecast(...e)})})(be,ge,fe,t,D).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else D&&function(...e){return gs(this,void 0,void 0,function*(){return(yield ys()).buildAnomalyAnnotations(...e)})}(D).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,H,D,ge,fe]);const we=pe?pe.processedData:he,Ae="__compoundGroup",Se=!(!H||!x),Oe=Se?Ae:H?fs:x,Ee=n(()=>{if(!Se)return we;const e="function"==typeof x?x:e=>e[x];return we.map(t=>{const n=Object.assign({},t);return n[Ae]=`${e(t)}__${t[fs]||"observed"}`,n})},[we,Se,x]),je=Se?Ee:we,Ce=n(()=>{if(!H)return;const e=H.upperBounds,t=H.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const a=pe?pe.processedData:he;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[H,pe,he,b]),{activeSelectionHook:Me,hoverSelectionHook:Pe,customHoverBehavior:Le,customClickBehavior:_e,crosshairSourceId:Te}=Sa({selection:I,linkedHover:W,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:F,onClick:z,chartType:"LineChart",chartId:Y,hoverHighlight:R,colorByField:"string"==typeof w?w:void 0}),Be=Oa(W,Te),De=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),He=void 0!==(null===(s=je[0])||void 0===s?void 0:s[k]),$e=n(()=>{if(He)return je;if(Oe){const e=je.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[k]:[]};"string"==typeof Oe&&(o[Oe]=n),Se&&(o[fs]=t[fs],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:je}]},[je,Oe,k,He]),{gapProcessedLineData:Ie,hasGaps:We}=n(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of $e){const o=(n[k]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of $e){const o=n[k]||[];let r=[],i=0;const a=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const s of o)if(De(s))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of $e){const r=o[k]||[],i=[];for(const n of r)De(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:$e,hasGaps:!1}},[$e,N,k,De,Oe,b]),Fe=wa(we,w,A),ze=n(()=>{if(!w)return[];const e=new Set;for(const t of we){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[we,w]),Re=ja(V,w,ze),Ge=n(()=>Pe||(Re.legendSelectionHook?Re.legendSelectionHook:Me),[Pe,Re.legendSelectionHook,Me]),Ye=n(()=>(e,t)=>{const n={strokeWidth:M},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return w?Fe&&(n.stroke=Ne(e,w,Fe),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=Z||va,o&&(n.fill=Z||va,n.fillOpacity=C)),n},[w,Fe,M,j,C,Z]),[qe,Xe]=r(null);o(()=>{if(!H)return void Xe(null);let e=!1;return function(...e){return gs(this,void 0,void 0,function*(){return(yield ys()).createSegmentLineStyle(...e)})}(Ye,H).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,H]);const Ve=qe||Ye,Ue=n(()=>aa(Ve,Ge,I),[Ve,Ge,I]),Ke=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return w?Fe&&(t.fill=Ne(e.parentLine||e,w,Fe)):t.fill=Z||va,t}},[O,E,w,Fe,Z]),Qe=Array.isArray(j)?"mixed":j?"area":"line",Ze="object"==typeof B?B:{},Je=Ze.position||"end",et=Ze.fontSize||11,tt=n(()=>{var e,t;if(!B||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of Ie){const o=n[k]||[];if(0===o.length)continue;const a="end"===Je?o[o.length-1]:o[0],s=null!==(t=null!==(e=r(a))&&void 0!==e?e:r(n))&&void 0!==t?t:"";s&&!i.has(s+"")&&i.set(s+"",a)}const a=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===Je?6:-6,dy:0,color:Fe?Fe(e):va,fontSize:et}));a.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;a.length>e;e++){const t="string"==typeof b?b:"y",n=a[e-1],o=a[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return a},[B,w,Fe,Ie,k,v,b,Je,et]),nt=(!B||void 0!==oe)&&oe,ot=n(()=>{if(!B)return h.marginDefaults;const e=tt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*et);return Math.max(e,o)},0),t=e+10,n="end"===Je?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[B,tt,et,Je,h.marginDefaults]),{legend:rt,margin:it,legendPosition:at}=Ea({data:Ie,colorBy:w,colorScale:Fe,showLegend:nt,legendPosition:U,userMargin:f,defaults:ot}),st=x||w,lt=n(()=>Hi([{label:le||Bi(v),accessor:v,role:"x"},{label:ce||Bi(b),accessor:b,role:"y"},...st?[{label:Bi(st),accessor:st,role:"group"}]:[]]),[v,b,le,ce,st]),ct=Ha({componentName:"LineChart",data:He?(null===(c=we[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),ut=n(()=>He||Oe||We?Ie.flatMap(e=>{const t=e[k]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):je,[Ie,k,He,Oe,je,We]),dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Qe},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=G&&{hoverRadius:G}),null!=g&&{data:ut}),{xAccessor:v,yAccessor:b,xScaleType:K,yScaleType:Q}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===N&&We?"_gapSegment":Oe||void 0,curve:S,lineStyle:Ue}),O&&{pointStyle:Ke}),{size:[J,ee],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:it,showAxes:h.showAxes,xLabel:le,yLabel:ce,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),rt&&{legend:rt,legendPosition:at}),V&&"none"!==V&&{legendHoverBehavior:Re.onLegendHover,legendClickBehavior:Re.onLegendClick,legendHighlightedCategory:Re.highlightedCategory,legendIsolatedCategories:Re.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),ae&&{summary:ae}),void 0!==se&&{accessibleTable:se}),p&&{className:p}),{tooltipContent:!1===L?()=>null:"multi"===L?t=>{var n,o,r,i,a,s,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const s=null!==(a=null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(r=t.data)||void 0===r?void 0:r.y)&&void 0!==i?i:t.value)&&void 0!==a?a:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},e.createElement("div",null,Pi(s)))}const g=null!==(d=null!==(c=null!==(s=t.xValue)&&void 0!==s?s:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},Pi(g)),h.map((t,n)=>e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"}},e.createElement("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.createElement("span",{style:{flex:1,fontSize:"0.85em"}},t.group),e.createElement("span",{style:{fontWeight:500,fontSize:"0.85em"}},Pi(t.value)))))}:Ti(L)||lt}),"multi"===L&&{tooltipMode:"multi"}),(W||F||z||R)&&{customHoverBehavior:Le}),(F||z||W)&&{customClickBehavior:_e}),_&&{pointIdAccessor:_}),((null==T?void 0:T.length)||me.length||tt.length)&&{annotations:[...T||[],...me,...tt]}),Be),$);return ue||de||(ct?e.createElement(La,{componentName:"LineChart",message:ct,width:J,height:ee}):e.createElement(os,{componentName:"LineChart",width:J,height:ee},e.createElement(ho,Object.assign({ref:d},dt))))});ms.displayName="LineChart";const vs=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const s=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:E=2,showPoints:j=!1,pointRadius:C=3,tooltip:M,annotations:P,frameProps:L={},selection:_,linkedHover:T,onObservation:B,onClick:N,hoverHighlight:D,chartId:H,loading:$,emptyContent:I,legendInteraction:W,legendPosition:F,color:z}=o,R=s.width,G=s.height,Y=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,K=s.summary,Q=s.accessibleTable,Z=s.xLabel,J=s.yLabel,ee=ss($,R,G),te=ee?null:as(l,R,G,I),ne=l||[];ls("AreaChart",ne,"xAccessor",f),ls("AreaChart",ne,"yAccessor",p);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:ae,crosshairSourceId:se}=Sa({selection:_,linkedHover:T,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:B,onClick:N,chartType:"AreaChart",chartId:H,hoverHighlight:D,colorByField:"string"==typeof x?x:void 0}),le=Oa(T,se),ce=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),ue=n(()=>{if(ce)return ne;if(y){const e=ne.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:ne}]},[ne,y,b,ce]),de=wa(ne,x,k),he=n(()=>{if(!x)return[];const e=new Set;for(const t of ne){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[ne,x]),ge=ja(W,x,he),fe=n(()=>re||(ge.legendSelectionHook?ge.legendSelectionHook:oe),[re,ge.legendSelectionHook,oe]),pe=n(()=>e=>{const t={};if(x){if(de){const n=Ne(e,x,de);t.fill=n,O?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else{const e=z||va;t.fill=e,O?(t.stroke=e,t.strokeWidth=E):t.stroke="none"}return t.fillOpacity=A,t},[x,de,z,A,O,E]),ye=n(()=>aa(pe,fe,_),[pe,fe,_]),me=n(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return x?de&&(t.fill=Ne(e.parentLine||e,x,de)):t.fill=va,t}},[j,C,x,de]),{legend:ve,margin:be,legendPosition:xe}=Ea({data:ue,colorBy:x,colorScale:de,showLegend:X,legendPosition:F,userMargin:c,defaults:s.marginDefaults}),ke=y||x,we=n(()=>Hi([{label:Z||Bi(f),accessor:f,role:"x"},{label:J||Bi(p),accessor:p,role:"y"},...ke?[{label:Bi(ke),accessor:ke,role:"group"}]:[]]),[f,p,Z,J,ke]),Ae=Ha({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Se=n(()=>ce||y?ue.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[ue,b,ce,y,ne]),Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Se}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),S&&{lineGradient:S}),{curve:w,lineStyle:ye}),j&&me&&{pointStyle:me}),{size:[R,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:h,yFormat:g,enableHover:Y,showGrid:q}),ve&&{legend:ve,legendPosition:xe}),W&&"none"!==W&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),{tooltipContent:!1===M?()=>null:Ti(M)||we}),(T||B||N||D)&&{customHoverBehavior:ie}),(B||N||T)&&{customClickBehavior:ae}),P&&P.length>0&&{annotations:P}),le),L);return ee||te||(Ae?e.createElement(La,{componentName:"AreaChart",message:Ae,width:R,height:G}):e.createElement(os,{componentName:"AreaChart",width:R,height:G},e.createElement(ho,Object.assign({ref:a},Oe))))});function bs({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:s="right"}){const c=t(new Set),u=t([]),[d,h]=r(0),g=l(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),f=l(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),p=l(e=>t=>{f([t]),e(t)},[f]),y=l(e=>t=>{f(t),e(t)},[f]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:_e,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return ra({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Ne})},[e,o,a,i,d]),b=n(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}vs.displayName="AreaChart";const xs=c(function(o,r){var i;const a=t(null),s=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:E=3,normalize:j=!1,tooltip:C,annotations:M,frameProps:P={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:H,emptyContent:$,legendInteraction:I,legendPosition:W,color:F}=o,z=s.width,R=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,K=s.accessibleTable,Q=s.xLabel,Z=s.yLabel,J=ss(H,z,R),ee=J?null:as(c,z,R,$),te=c||[],ne=bs({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:W}),oe=l(ne.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=l(ne.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[ne.wrapPushMany]);u(r,()=>({push:oe,pushMany:re,clear:()=>{var e;ne.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:[]}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:ae,customHoverBehavior:se,customClickBehavior:le,crosshairSourceId:ce}=Sa({selection:L,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"StackedAreaChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ue=Oa(_,ce),de=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),he=n(()=>{if(de)return te;if(m){const e=te.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:te}]},[te,m,v,de]),ge=wa(te,b,x),fe=n(()=>{if(!b)return[];const e=new Set;for(const t of te){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[te,b]),pe=ja(I,b,fe),ye=n(()=>ae||(pe.legendSelectionHook?pe.legendSelectionHook:ie),[ae,pe.legendSelectionHook,ie]),me=n(()=>e=>{const t={};if(b&&ge){const n=Ne(e,b,ge);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=F||va;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,ge,w,A,S,F]),ve=n(()=>aa(me,ye,L),[me,ye,L]),be=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return b?ge&&(t.fill=Ne(e.parentLine||e,b,ge)):t.fill=F||va,t}},[O,E,b,ge,F]),{legend:xe,margin:ke,legendPosition:we}=Ea({data:he,colorBy:b,colorScale:ge,showLegend:q,legendPosition:W,userMargin:d,defaults:s.marginDefaults}),Ae=ne.streamingLegend||xe,Se=W||we,Oe=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},ke);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return ke},[ke,ne.streamingMarginAdjust]),Ee=m||b,je=n(()=>Hi([{label:Q||Bi(p),accessor:p,role:"x"},{label:Z||Bi(y),accessor:y,role:"y"},...Ee?[{label:Bi(Ee),accessor:Ee,role:"group"}]:[]]),[p,y,Q,Z,Ee]),Ce=Ha({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Me=n(()=>de||m?he.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[he,v,de,m,te]),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:"stackedarea"},null!=c&&{data:Me}),{xAccessor:p,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:j,lineStyle:ve}),O&&be&&{pointStyle:be}),{size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Oe,showAxes:s.showAxes,xLabel:Q,yLabel:Z,xFormat:g,yFormat:f,enableHover:G,showGrid:Y}),Ae&&{legend:Ae,legendPosition:Se}),I&&"none"!==I&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),{tooltipContent:!1===C?()=>null:Ti(C)||je}),(_||T||B||N)&&{customHoverBehavior:se}),(T||B||_)&&{customClickBehavior:le}),M&&M.length>0&&{annotations:M}),ue),P);return J||ee||(Ce?e.createElement(La,{componentName:"StackedAreaChart",message:Ce,width:z,height:R}):e.createElement(os,{componentName:"StackedAreaChart",width:z,height:R},e.createElement(ho,Object.assign({ref:a},Pe))))});xs.displayName="StackedAreaChart";const ks=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ma(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:x="#fff",cellBorderWidth:w=1,tooltip:A,annotations:O,frameProps:E={},selection:P,linkedHover:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:H,showLegend:$,legendPosition:I,legendInteraction:W}=o,F=a.width,z=a.height,R=a.enableHover,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,K=ss(D,F,z),Q=K?null:as(s,F,z,H),Z=s||[],J=null!=$&&$,ee=null!=I?I:"right",{margin:te}=Ea({data:Z,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Sa({selection:P,linkedHover:L,fallbackFields:[],onObservation:_,onClick:T,chartType:"Heatmap",chartId:N,hoverHighlight:B,colorByField:void 0}),se=Oa(L,ae),le=ja(W,void 0,[]),ce=n(()=>oe||(le.legendSelectionHook?le.legendSelectionHook:ne),[oe,le.legendSelectionHook,ne]),ue=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),de=n(()=>{const e=Z.map(ue);return[Math.min(...e),Math.max(...e)]},[Z,ue]),he=n(()=>"custom"===y&&m?m:k({blues:M,reds:C,greens:j,viridis:S}[y]||M).domain(de),[y,m,de]);n(()=>{const e=ka(d),t=ka(h);return{xBinCount:new Set(Z.map(e)).size,yBinCount:new Set(Z.map(t)).size}},[Z,d,h]),n(()=>({coordinates:Z}),[Z]);const ge=n(()=>e=>{const t=ue(e);return{fill:he(t),stroke:x,strokeWidth:w}},[ue,he,x,w]);n(()=>aa(ge,ce,P),[ge,ce,P]);const fe=n(()=>Hi([{label:V||Bi(d),accessor:d,role:"x"},{label:U||Bi(h),accessor:h,role:"y"},{label:Bi(g),accessor:g,role:"value"}]),[d,h,V,U,g]),pe=Ha({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ye=n(()=>{if(J)return{gradient:{colorFn:e=>he(e),domain:de,label:"string"==typeof g?g:"value",format:b}}},[J,he,de,g,b]),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({chartType:"heatmap"},null!=s&&{data:Z}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:f,yFormat:p,enableHover:R}),ye&&{legend:ye,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===A?()=>null:Ti(A)||fe}),(L||_||T||B)&&{customHoverBehavior:re}),(_||T||L)&&{customClickBehavior:ie}),O&&O.length>0&&{annotations:O}),se),E);return K||Q||(pe?e.createElement(La,{componentName:"Heatmap",message:pe,width:F,height:z}):e.createElement(os,{componentName:"Heatmap",width:F,height:z},e.createElement(ho,Object.assign({ref:i},me))))});ks.displayName="Heatmap";const ws=c(function(o,i){const a=t(null),s=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:E,annotations:j,frameProps:C={},selection:M,linkedHover:P,linkedBrush:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:H,legendInteraction:$,legendPosition:I,color:W}=o,F=s.width,z=s.height,R=s.enableHover,G=s.showGrid,Y=s.showLegend,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,K=s.xLabel,Q=s.yLabel,Z=ss(D,F,z),J=Z?null:as(c,F,z,H),ee=c||[],te=void 0===c,ne=t(null),[oe,re]=r(0),ie=l(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];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,m]),ae=bs({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:I}),se=l(ae.wrapPush(e=>{var t;ie([e]),null===(t=a.current)||void 0===t||t.push(e)}),[ae.wrapPush,ie]),le=l(ae.wrapPushMany(e=>{var t;ie(e),null===(t=a.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,ie]);u(i,()=>({push:se,pushMany:le,clear:()=>{var e;ae.resetCategories(),ne.current=null,re(e=>e+1),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:[]}}),[se,le,ae.resetCategories]);const{activeSelectionHook:ce,hoverSelectionHook:ue,customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=Sa({selection:M,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:_,onClick:T,chartType:"BubbleChart",chartId:N,hoverHighlight:B,colorByField:"string"==typeof b?b:void 0}),fe=Oa(P,ge),pe=ia(L);Qi({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof p?p:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof y?y:void 0)});const ye=wa(ee,b,x),me=n(()=>{if(!b)return[];const e=new Set;for(const t of ee){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ee,b]),ve=ja($,b,me),be=n(()=>ue||(ve.legendSelectionHook?ve.legendSelectionHook:ce),[ue,ve.legendSelectionHook,ce]),xe=n(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m,te,oe]),ke=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ye&&(t.fill=Ne(e,b,ye)):t.fill=W||va,t.r=He(e,m,v,xe),t},[b,ye,m,v,xe,k,w,A,W]),we=n(()=>aa(ke,be,M),[ke,be,M]),{legend:Ae,margin:Se,legendPosition:Oe}=Ea({data:ee,colorBy:b,colorScale:ye,showLegend:Y,legendPosition:I,userMargin:d,defaults:s.marginDefaults}),Ee=ae.streamingLegend||Ae,je=I||Oe,Ce=n(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Se);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Se},[Se,ae.streamingMarginAdjust]),Me=n(()=>Hi([{label:K||Bi(p),accessor:p,role:"x"},{label:Q||Bi(y),accessor:y,role:"y"},{label:Bi(m),accessor:m,role:"size"},...b?[{label:Bi(b),accessor:b,role:"color"}]:[]]),[p,y,K,Q,m,b]),Pe=Ha({componentName:"BubbleChart",data:c,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:m}});if(Pe)return e.createElement(La,{componentName:"BubbleChart",message:Pe,width:F,height:z});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:we,colorScheme:x,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:s.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:R,showGrid:G}),Ee&&{legend:Ee,legendPosition:je}),$&&"none"!==$&&{legendHoverBehavior:ve.onLegendHover,legendClickBehavior:ve.onLegendClick,legendHighlightedCategory:ve.highlightedCategory,legendIsolatedCategories:ve.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),{tooltipContent:!1===S?()=>null:Ti(S)||Me}),(P||_||T||B)&&{customHoverBehavior:de}),(_||T||P)&&{customClickBehavior:he}),O&&{marginalGraphics:O}),E&&{pointIdAccessor:E}),j&&j.length>0&&{annotations:j}),fe),C);return Z||J||e.createElement(os,{componentName:"BubbleChart",width:F,height:z},e.createElement(ho,Object.assign({ref:a},Le)))});ws.displayName="BubbleChart";const As="__splomIdx",Ss={top:4,bottom:4,left:4,right:4};function Os({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-Ss.left-Ss.right,l=r-Ss.top-Ss.bottom;return o(()=>{if(!a.current)return;const e=h(a.current).select(".brush-g"),t=p().extent([[0,0],[s,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,a],[s,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(a)],[o.x.invert(s),o.y.invert(l)]];i(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,l,n,i]),e.createElement("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Ss.left},${Ss.top})`}))}function Es({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:s,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:f,onPointHover:p}){const y=t(null),m=Ui({name:d,clientId:`splom-${o}-${r}`}),v=Qi({name:d,xField:o,yField:r}),b=Ui({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=l(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=l(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[As];void 0!==n&&(x({[As]:[n]}),null==p||p(t,e.x+Ss.left,e.y+Ss.top))},[x,p]),A=l(e=>{const t={opacity:s,r:a};return t.fill=c?Ne(e,c,u):va,"hover"===f?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*s):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,s,a,f,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(ho,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:Ss,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?w:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.createElement(Os,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function js({data:t,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=Ui({name:c,clientId:"splom-diag-"+o}),g=Ui({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/a||1,l="string"==typeof s?s:null,c=l?[...new Set(t.map(e=>e[l]).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 t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),a-1);if(d[i]++,p&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!y(e)||f[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})});return{bars:d.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,a,i,p,y,s]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):va,opacity:p?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:va,opacity:p?.3:.6})),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):va,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:va,opacity:.7}))))}function Cs({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Ms(t){const{data:o,fields:i,fieldLabels:a={},colorBy:s,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:f="histogram",histogramBins:p=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:O}=t,E="splom",j="splom-hover",C=m?"hover":y?"brush":"hover",M=qi(e=>e.clearSelection),[P,L]=r(null),_=l(()=>{M(j),L(null)},[M,j]),T=n(()=>(o||[]).map((e,t)=>void 0!==e[As]?e:Object.assign(Object.assign({},e),{[As]:t})),[o]),B=wa(T,s,c),N=void 0!==k?k:!!s,D=n(()=>{if(!N||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):va})):null},[N,s,T,B]),H=n(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>u+"px").join(" "),gridTemplateRows:i.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[i,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},D&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},D.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:H,onMouseLeave:"hover"===C?_:void 0},i.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t),i.map((o,r)=>n===r?"label"===f?e.createElement(Cs,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(js,{key:"diag-"+t,data:T,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,mode:C}):e.createElement(Es,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,a)=>{e?(L({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O})):(L(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O}))}:void 0})))),e.createElement("div",null)," ",i.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t))),P&&"hover"===C&&(()=>{const t=P.datum,n=a[P.xField]||P.xField,o=a[P.yField]||P.yField,r=s?"function"==typeof s?s(t):t[s]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[As];return e.createElement("div",{style:{position:"absolute",left:40+P.colIndex*(u+d)+P.px,top:P.rowIndex*(u+d)+P.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[P.xField]?Number(t[P.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[P.yField]?Number(t[P.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",r+""))})())}function Ps(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(oa,{selections:r},e.createElement(Ms,Object.assign({},t)))}function Ls({width:n,height:r,margin:i,scales:a,brushDirection:s,extent:l,onBrush:c}){const u=t(null),d=t(null),p=t(!1),y=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!a)return;const e=h(u.current).select(".brush-group"),t="x"===s?g().extent([[0,0],[n,r]]):f().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(p.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?a.x:a.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,n,r,s,c]),o(()=>{if(!d.current||!a||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===s?a.x:a.y;if(p.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);p.current=!1},[l,a,s]),e.createElement("svg",{ref:u,width:y,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function _s(i){var a,s;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:f,description:p,summary:y,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:S="coordinates",colorBy:O,colorScheme:E,curve:j="linear",lineWidth:C=2,fillArea:M=!1,areaOpacity:P=.3,showPoints:L=!1,pointRadius:_=3,enableHover:T=!0,showGrid:B=!1,showLegend:N,legendPosition:D,tooltip:H,minimap:$={},renderBefore:I=!1,onBrush:W,brushExtent:F,frameProps:z={},loading:R,emptyContent:G}=i,Y=ss(R,u,d),q=Y?null:as(c,u,d,G),X=c||[],[V,U]=r(null),K=null!=F?F:V,Q=l(e=>{F||U(e),null==W||W(e)},[F,W]),Z=t(null),[J,ee]=r(null);o(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=Z.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?ee(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const te=void 0!==(null===(a=X[0])||void 0===a?void 0:a[S]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[S]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:X}]},[X,A,S,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[S]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,S,te,A,X]),re=wa(X,O,E),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=O?Ne(e,O,re):va,M&&(t.fill=t.stroke,t.fillOpacity=P),t},[O,re,C,M,P]),ae=n(()=>$.lineStyle?$.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=O?Ne(e,O,re):va,t},[O,re,$.lineStyle]),se=n(()=>{if(L)return e=>{const t={r:_,fillOpacity:1};return t.fill=O?Ne(e.parentLine||e,O,re):va,t}},[L,_,O,re]),{legend:le,margin:ce,legendPosition:ue}=Ea({data:ne,colorBy:O,colorScale:re,showLegend:N,legendPosition:D,userMargin:h}),de=$.height||60,he=n(()=>{var e,t,n,o,r,i,a,s;return{top:null!==(t=null===(e=$.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=$.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=$.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ce.left,right:null!==(s=null===(a=$.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:ce.right}},[$.margin,ce]),ge=$.brushDirection||"x",fe=Ha({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(fe)return e.createElement(La,{componentName:"MinimapChart",message:fe,width:u,height:d});const pe=M?"area":"line",ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ie},L&&{pointStyle:se}),{size:[u,d],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:ce,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:T,showGrid:B}),le&&{legend:le,legendPosition:ue}),f&&{title:f}),p&&{description:p}),y&&{summary:y}),H&&{tooltipContent:Ti(H)||void 0}),K&&{xExtent:K}),z),me={chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ae,size:[u,de+he.top+he.bottom],margin:he,showAxes:null!==(s=$.showAxes)&&void 0!==s&&s,background:$.background,enableHover:!1},ve=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(ho,Object.assign({ref:Z},me)),e.createElement(Ls,{width:u-he.left-he.right,height:de,margin:he,scales:J,brushDirection:ge,extent:K,onBrush:Q})),be=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(ho,Object.assign({},ye)));return Y||q||e.createElement(os,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},I?ve:be,I?be:ve))}Ps.displayName="ScatterplotMatrix",_s.displayName="MinimapChart";const Ts=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",xCenter:p,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:S=[3,15],pointRadius:O=5,pointOpacity:E=.8,tooltip:j,pointIdAccessor:C,annotations:M,frameProps:P={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:H,emptyContent:$,legendInteraction:I,legendPosition:W,color:F}=o,z=a.width,R=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Q=a.xLabel,Z=a.yLabel,J=ss(H,z,R),ee=J?null:as(s,z,R,$),te=s||[];ls("QuadrantChart",te,"xAccessor",g),ls("QuadrantChart",te,"yAccessor",f);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Sa({selection:L,linkedHover:_,fallbackFields:"string"==typeof k?[k]:[],onObservation:T,onClick:B,chartType:"QuadrantChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof k?k:void 0}),se=Oa(_,ae),le=wa(te,k,w),ce=n(()=>{if(!k)return[];const e=new Set;for(const t of te){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[te,k]),ue=ja(I,k,ce),de=n(()=>oe||(ue.legendSelectionHook?ue.legendSelectionHook:ne),[oe,ue.legendSelectionHook,ne]),he=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof f?f:e=>+e[f];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const a of te){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=p&&isFinite(p)&&(n>p&&(n=p),p>o&&(o=p)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(i-r)||1;return{xExtent:[n-a,o+a],yExtent:[r-s,i+s]}},[te,g,f,p,y]),ge=n(()=>{if(!A||0===te.length)return;const e=te.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,A]),fe=n(()=>"function"==typeof g?g:e=>+e[g],[g]),pe=n(()=>"function"==typeof f?f:e=>+e[f],[f]),ye=n(()=>e=>{const t={fillOpacity:E};if(k)le&&(t.fill=Ne(e,k,le));else{const n=fe(e),o=pe(e),r=null!=p?n>=p:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?F||va:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?He(e,A,S,ge):O,t},[k,le,A,S,ge,O,E,fe,pe,p,y,m,F]),me=n(()=>aa(ye,de,L),[ye,de,L]),{legend:ve,margin:be,legendPosition:xe}=Ea({data:te,colorBy:k,colorScale:le,showLegend:q,legendPosition:W,userMargin:l,defaults:a.marginDefaults}),ke=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof f&&e.add(f),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,g,f,k,A]),we=n(()=>Hi([...ke?[{label:ke,accessor:ke,role:"title"}]:[],{label:Q||Bi(g),accessor:g,role:"x"},{label:Z||Bi(f),accessor:f,role:"y"},...k?[{label:Bi(k),accessor:k,role:"color"}]:[],...A?[{label:Bi(A),accessor:A,role:"size"}]:[]]),[ke,g,f,Q,Z,k,A]),Ae=Ha({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:f}}),Se=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=r.width,s=r.height,l=null!=p?o.x(p):a/2,c=null!=y?o.y(y):s/2;if(null!=p&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:a-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:s-d},{config:m.bottomRight,x:u,y:d,w:a-u,h:s-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[p,y,m,v]),Oe=n(()=>b?[...Se,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,a=null!=p?n.x(p):r/2,s=null!=y?n.y(y):i/2;(null==p||isFinite(a))&&(null==y||isFinite(s))&&(e.font=`600 ${x}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,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:Se,[Se,b,x,m,p,y]),Ee=n(()=>{const e=P.canvasPreRenderers||[];return[...Oe,...e]},[Oe,P.canvasPreRenderers]),je=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,a=r.height,s=null!=p?o.x(p):i/2,l=null!=y?o.y(y):a/2;if(null!=p&&!isFinite(s))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:a-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:a-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:a,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:a-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:a-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[p,y,m,v,b,x]),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:g,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:S,pointStyle:me,colorScheme:w,size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),he&&{xExtent:he.xExtent,yExtent:he.yExtent}),ve&&{legend:ve,legendPosition:xe}),I&&"none"!==I&&{legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:ue.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?we:Ti(j)||we}),(_||T||B||N)&&{customHoverBehavior:re}),(T||B||_)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:Ee}),se),P),Ee.length>0&&{canvasPreRenderers:Ee}),{svgPreRenderers:je});return J||ee||(Ae?e.createElement(La,{componentName:"QuadrantChart",message:Ae,width:z,height:R}):e.createElement(os,{componentName:"QuadrantChart",width:z,height:R},e.createElement(ho,Object.assign({ref:i},Ce))))});Ts.displayName="QuadrantChart";const Bs="__ma_unitized",Ns="__ma_series";function Ds(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Hs(e,t){return t[0]+e*(t[1]-t[0])}const $s=c(function(o,r){var i,a;const s=t(null),l=t([]);u(r,()=>({push:e=>{if(!s.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&s.current.push(Object.assign(Object.assign({},t),{[Bs]:Ds(i,r),[Ns]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const a=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=a&&isFinite(a)&&t.push(Object.assign(Object.assign({},n),{[Bs]:Ds(a,i),[Ns]:r.label||"Series "+(e+1)}))}s.current.pushMany(t)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const c=Ma(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:g,xFormat:f,xAccessor:p="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_}=o,T=c.width,B=c.height,N=c.enableHover,D=c.showGrid,H=null===(i=c.showLegend)||void 0===i||i,$=c.title,I=c.description,W=c.summary,F=c.accessibleTable,z=c.xLabel,R=2===y.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||R||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${y.length}. Rendering as a standard multi-line chart.`);const G=ss(M,T,B),Y=G?null:as(d,T,B,P),q=d||[],X=ba(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=Pe[m];e=Array.isArray(t)?t:Le}return y.map((t,n)=>t.color||e[n%e.length])},[y,m,X]),U=n(()=>y.map((e,t)=>e.label||"Series "+(t+1)),[y]),{unitizedData:K,extents:Q}=n(()=>{if(0===q.length){const e=y.map(e=>e.extent||null).filter(Boolean);return e.length===y.length&&(l.current=e),{unitizedData:[],extents:e.length===y.length?e:[]}}const e=y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(q,e.yAccessor));if(l.current=e,!R){const t=[];for(const e of q)for(let n=0;y.length>n;n++){const o=y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[Bs]:r,[Ns]:U[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of q)for(let o=0;2>o;o++){const r=y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[Bs]:Ds(i,e[o]),[Ns]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,R,U]),Z=n(()=>{if(R&&Q.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=Hs(e,Q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=Hs(e,Q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[R,Q,y,U]),J=cs({data:n(()=>K.length>0?K:U.map(e=>({[Ns]:e})),[K,U]),rawData:d,colorBy:Ns,colorScheme:V,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:[Ns],unwrapData:!1,onObservation:O,onClick:E,hoverHighlight:j,chartType:"MultiAxisLineChart",chartId:C,showLegend:H,userMargin:h,marginDefaults:R?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:M,emptyContent:P,width:T,height:B});if(J.earlyReturn)return J.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[Ns])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>aa(ee,J.effectiveSelectionHook,A),[ee,J.effectiveSelectionHook,A]),ne=n(()=>{if(!1===x)return()=>null;return Ti(x)||(t=>{var n;const o=t.data||t,r=o[Ns],i=U.indexOf(r),a=o[Bs],s=R&&i>=0&&Q[i]?Hs(a,Q[i]):a,l=i>=0&&(null===(n=y[i])||void 0===n?void 0:n.format)?y[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof p?p(o):o[p];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:V[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof p?p:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(s)}`))})},[x,U,V,Q,R,y,p]),oe=Ha({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:p}}),re=R?[0,1]:void 0,ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:K}),{xAccessor:p,yAccessor:Bs,groupAccessor:Ns,lineStyle:te,colorScheme:V,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),Z&&{axes:Z}),{xLabel:z}),R?{}:{yLabel:U[0]}),{xFormat:f}),R&&re&&{yExtent:re}),{enableHover:N,showGrid:D,curve:v}),J.legendBehaviorProps),$&&{title:$}),I&&{description:I}),W&&{summary:W}),void 0!==F&&{accessibleTable:F}),g&&{className:g}),{tooltipContent:ne}),k&&{annotations:k}),(S||O||E||j)&&{customHoverBehavior:J.customHoverBehavior}),(O||E||S)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return G||Y||(oe?e.createElement(La,{componentName:"MultiAxisLineChart",message:oe,width:T,height:B}):e.createElement(os,{componentName:"MultiAxisLineChart",width:T,height:B},e.createElement(ho,Object.assign({ref:s},ie))))});$s.displayName="MultiAxisLineChart";const Is=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=40,baselinePadding:b=!1,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N}=o,D=i.width,H=i.height,$=i.enableHover,I=i.showGrid,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=cs({data:q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"BarChart",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:P,width:D,height:H});if(X.earlyReturn)return X.earlyReturn;ls("BarChart",q,"categoryAccessor",d),ls("BarChart",q,"valueAccessor",h);const V=Aa(q,m,h),U=ba(),K=n(()=>new Map,[q]),Q=n(()=>(e,t)=>{const n={};return n.fill=p?Ne(e,p,X.colorScale):xa(T,U,y,void 0,K),n},[p,X.colorScale,T,U,y,K]),Z=n(()=>aa(Q,X.effectiveSelectionHook,A),[Q,X.effectiveSelectionHook,A]),J=n(()=>$i({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),ee=Ha({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ee)return e.createElement(La,{componentName:"BarChart",message:ee,width:D,height:H});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:Z,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:v,baselinePadding:b,enableHover:$,showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:f}),N&&{oFormat:N}),{showGrid:I,showCategoryTicks:B,oSort:m}),X.legendBehaviorProps),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Ti(x)||J}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(os,{componentName:"BarChart",width:D,height:H},e.createElement(Go,Object.assign({ref:a},te)))});function Ws({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s,setup:c}){const d=bs({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s}),h=l(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=l(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:s||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,s]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}Is.displayName="BarChart";const Fs=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,barPadding:v=40,baselinePadding:b=!1,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_,color:T,categoryFormat:B}=o,N=i.width,D=i.height,H=i.enableHover,$=i.showGrid,I=i.showLegend,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=p||d,V=void 0===s,U=cs({data:q,rawData:s,colorBy:X,colorScheme:y,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"StackedBarChart",chartId:C,showLegend:I,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:P,width:N,height:D});if(U.earlyReturn)return U.earlyReturn;const K=ba(),Q=n(()=>new Map,[q]),Z=n(()=>(e,t)=>X?U.colorScale?{fill:Ne(e,X,U.colorScale)}:{}:{fill:xa(T,K,y,t,Q)},[X,U.colorScale,T,K,y,Q]),J=n(()=>aa(Z,U.effectiveSelectionHook,A),[Z,U.effectiveSelectionHook,A]),ee=n(()=>$i({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),te=Ha({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Ws({ref:r,frameRef:a,isPushMode:V,colorBy:X,colorScheme:y,showLegend:I,legendPosition:_,setup:U}),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(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:q}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:J,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,barPadding:v,baselinePadding:b,enableHover:H,showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:f}),B&&{oFormat:B}),{showGrid:$}),ne),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Ti(x)||ee}),(S||O||E||j)&&{customHoverBehavior:U.customHoverBehavior}),(O||E||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),w);return te?e.createElement(La,{componentName:"StackedBarChart",message:te,width:N,height:D}):e.createElement(os,{componentName:"StackedBarChart",width:N,height:D},e.createElement(Go,Object.assign({ref:a},re)))});Fs.displayName="StackedBarChart";const zs="__likert_neutral_neg",Rs="__likert_neutral_pos";function Gs(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Ys(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(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 n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function qs(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:zs,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:Rs,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function Xs(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===zs?i=n:n.__likertLevel===Rs?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const Vs=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null),{data:s,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:f,countAccessor:p="count",levels:y,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,valueFormat:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,categoryFormat:B}=o,N=i.width,D=i.height,H=i.enableHover,$=i.showGrid,I=i.showLegend,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q="horizontal"===m,X=void 0===s,V=!f,U=n(()=>v&&Array.isArray(v)&&v.length>=y.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&a.push(o);for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return a}(y.length),[v,y.length]),K=n(()=>{const e=new Map;for(let t=0;y.length>t;t++)e.set(y[t],U[t]||"#888");return e},[y,U]),{processedData:Q,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:o,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>Gs(r,"question"),[r]),g=n(()=>d?Gs(i,"score"):null,[d,i]),f=n(()=>d?null:Gs(a,"level"),[d,a]),p=n(()=>d?null:Gs(s,"count"),[d,s]),y=e||[],m=t([]),v=n(()=>{if(0===y.length)return[];let e=Ys(y,o,h,g,f,p);return c&&(e=qs(e,o),e=Xs(e,o)),e},[y,o,h,g,f,p,c]),b=l(e=>{var t,n;let r=Ys(e,o,h,g,f,p);c&&(r=qs(r,o),r=Xs(r,o)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(n=u.current)||void 0===n||n.pushMany(r))},[o,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:s,levels:y,categoryAccessor:h,valueAccessor:g,levelAccessor:f,countAccessor:p,isDiverging:q,frameRef:a}),ee="__likertLevelLabel",te=bs({isPushMode:X,colorBy:ee,colorScheme:U,showLegend:I,legendPosition:T}),ne=l(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=l(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,clear:()=>{var e;J.current=[],te.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:[]}}),[ne,oe,te.resetCategories,J]);const re=cs({data:Q,rawData:s,colorBy:ee,colorScheme:U,legendInteraction:_,legendPosition:T,selection:A,linkedHover:S,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"LikertChart",chartId:C,showLegend:I,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:D});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=y.length;return e%2!=0&&K.get(y[Math.floor(e/2)])||"#888"},[y,K]),ae=n(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===zs||r===Rs)return{fill:ie};const i=o||r;return i&&K.has(i)?{fill:K.get(i)}:{fill:"#888"}},[K,ie]),se=n(()=>aa(ae,re.effectiveSelectionHook,A),[ae,re.effectiveSelectionHook,A]),le=n(()=>{const e=y.length;return e%2!=0?y[Math.floor(e/2)]:""},[y]),ce=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===zs||o===Rs?le:o,i=n.__likertCategory||"",a=Math.abs(n.__likertPct||0),s=o===zs||o===Rs?2*a:a,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${l})`))},[le]),ue=n(()=>{if(!y||2>y.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&f)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(f&&!p)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:h};return V?g&&(e.valueAccessor=g):(f&&(e.levelAccessor=f),p&&(e.countAccessor=p)),Ha({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:y}})},[s,h,g,f,p,y,V]),de=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:y.map(e=>({label:e})),label:""}],[y,K]),he=n(()=>!1!==I?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:de},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,I,de]),ge=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==I){const t=T||"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(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return q&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,q,X,I,T]),fe=n(()=>M||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,M]),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({chartType:"bar"},null!=s&&{data:Q}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:se,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge,barPadding:b,enableHover:H,showAxes:i.showAxes,oLabel:G,rLabel:Y||(q?void 0:"Percentage"),rFormat:fe}),B&&{oFormat:B}),{showGrid:$}),he),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?ce:Ti(x)||ce}),(S||O||E||j)&&{customHoverBehavior:re.customHoverBehavior}),(O||E||S)&&{customClickBehavior:re.customClickBehavior}),k&&k.length>0&&{annotations:k}),w);return ue?e.createElement(La,{componentName:"LikertChart",message:ue,width:N,height:D}):e.createElement(os,{componentName:"LikertChart",width:N,height:D},e.createElement(Go,Object.assign({ref:a},pe)))});function Us({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=ia("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),a=Qi({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),s=t(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(i){s.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Vs.displayName="LikertChart";const Ks=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:E,frameProps:j={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:H,color:$,showCategoryTicks:I,categoryFormat:W}=o,F=i.width,z=i.height,R=i.enableHover,G=i.showGrid,Y=i.title,q=i.description,X=i.summary,V=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Q=s||[],Z=cs({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:D,legendPosition:H,selection:C,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:_,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:N,width:F,height:z}),J=Us({brushProp:S,onBrushProp:O,linkedBrush:E,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{if(!m)return;const e=Q.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[Q,m]),te=ba(),ne=n(()=>new Map,[Q]),oe=n(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=p?Ne(e,p,Z.colorScale):xa($,te,y,void 0,ne),n.r=m?He(e,m,v,ee):b,n},[p,Z.colorScale,m,v,ee,b,x,$,te,y,ne]),re=n(()=>aa(oe,Z.effectiveSelectionHook,C),[oe,Z.effectiveSelectionHook,C]),ie=n(()=>$i({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),ae=Ha({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ae)return e.createElement(La,{componentName:"SwarmPlot",message:ae,width:F,height:z});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({chartType:"swarm"},null!=s&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:k,enableHover:R,showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),W&&{oFormat:W}),{showGrid:G,showCategoryTicks:I}),Z.legendBehaviorProps),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===w?()=>null:Ti(w)||ie}),(M||P||L||_)&&{customHoverBehavior:Z.customHoverBehavior}),(P||L||M)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),J.brushStreamProps),j);return e.createElement(os,{componentName:"SwarmPlot",width:F,height:z},e.createElement(Go,Object.assign({ref:a},se)))});function Qs(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:Ci},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=i.length,s=a>0?a%2!=0?i[Math.floor(a/2)]:(i[a/2-1]+i[a/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:Ci},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}Ks.displayName="SwarmPlot";const Zs=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_,showCategoryTicks:T,categoryFormat:B}=o,N=i.width,D=i.height,H=i.enableHover,$=i.showGrid,I=i.title,W=i.description,F=i.summary,z=i.accessibleTable,R=i.categoryLabel,G=i.valueLabel,Y=s||[],q=cs({data:Y,rawData:s,colorBy:p,colorScheme:y,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:M,width:N,height:D});if(q.earlyReturn)return q.earlyReturn;const X=ba(),V=n(()=>new Map,[Y]),U=n(()=>e=>{const t=p?Ne(e,p,q.colorScale):xa(_,X,y,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[p,q.colorScale,_,X,y,V]),K=n(()=>aa(U,q.effectiveSelectionHook,w),[U,q.effectiveSelectionHook,w]),Q=n(()=>Qs(),[]),Z=Ha({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(La,{componentName:"BoxPlot",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:q.margin,barPadding:v,enableHover:H,showAxes:i.showAxes,oLabel:R,rLabel:G,rFormat:f}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T}),q.legendBehaviorProps),I&&{title:I}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Ti(b)||Q}),(A||S||O||E)&&{customHoverBehavior:q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(os,{componentName:"BoxPlot",width:N,height:D},e.createElement(Go,Object.assign({ref:a},J)))});Zs.displayName="BoxPlot";const Js=c(function(o,r){const i=Ma(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=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,showCategoryTicks:D,categoryFormat:H}=o,$=i.width,I=i.height,W=i.enableHover,F=i.showGrid,z=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=cs({data:V,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"Histogram",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:$,height:I}),K=Us({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(U.earlyReturn)return U.earlyReturn;const Q=n(()=>{if(0===V.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,h]),Z=ba(),J=n(()=>new Map,[V]),ee=n(()=>e=>{const t=y?Ne(e,y,U.colorScale):xa(N,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[y,U.colorScale,N,Z,m,J]),te=n(()=>aa(ee,U.effectiveSelectionHook,O),[ee,U.effectiveSelectionHook,O]),ne=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=Ha({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(La,{componentName:"Histogram",message:oe,width:$,height:I});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:f}),Q&&{rExtent:Q}),{size:[$,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:W,showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:D}),U.legendBehaviorProps),z&&{title:z}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Ti(b)||ne}),(E||j||C||M)&&{customHoverBehavior:U.customHoverBehavior}),(j||C||E)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),S);return e.createElement(os,{componentName:"Histogram",width:$,height:I},e.createElement(Go,Object.assign({ref:a},re)))});Js.displayName="Histogram";const el=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:E,linkedHover:j,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:_,emptyContent:T,legendInteraction:B,legendPosition:N,color:D,showCategoryTicks:H,categoryFormat:$}=o,I=i.width,W=i.height,F=i.enableHover,z=i.showGrid,R=i.title,G=i.description,Y=i.summary,q=i.accessibleTable,X=i.categoryLabel,V=i.valueLabel,U=s||[],K=cs({data:U,rawData:s,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:N,selection:E,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:T,width:I,height:W}),Q=Us({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=ba(),J=n(()=>new Map,[U]),ee=n(()=>e=>{const t=m?Ne(e,m,K.colorScale):xa(D,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,D,Z,v,J]),te=n(()=>aa(ee,K.effectiveSelectionHook,E),[ee,K.effectiveSelectionHook,E]),ne=n(()=>Qs({valueAccessor:h}),[h]),oe=Ha({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(La,{componentName:"ViolinPlot",message:oe,width:I,height:W});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(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:f,showIQR:p,size:[I,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F,showAxes:i.showAxes,oLabel:X,rLabel:V,rFormat:y}),$&&{oFormat:$}),{showGrid:z,showCategoryTicks:H}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Ti(x)||ne}),(j||C||M||P)&&{customHoverBehavior:K.customHoverBehavior}),(C||M||j)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Q.brushStreamProps),O);return e.createElement(os,{componentName:"ViolinPlot",width:I,height:W},e.createElement(Go,Object.assign({ref:a},re)))});el.displayName="ViolinPlot";const tl=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N}=o,D=i.width,H=i.height,$=i.enableHover,I=i.showGrid,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=cs({data:q,rawData:s,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"RidgelinePlot",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:P,width:D,height:H});if(X.earlyReturn)return X.earlyReturn;const V=ba(),U=n(()=>new Map,[q]),K=n(()=>e=>{const t=m?Ne(e,m,X.colorScale):xa(T,V,v,void 0,U);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,V,v,U]),Q=n(()=>aa(K,X.effectiveSelectionHook,A),[K,X.effectiveSelectionHook,A]),Z=n(()=>Qs(),[]),J=Ha({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(La,{componentName:"RidgelinePlot",message:J,width:D,height:H});const ee=Object.assign(Object.assign(Object.assign(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!=s&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Q,bins:f,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:b,enableHover:$,showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:y}),N&&{oFormat:N}),{showGrid:I,showCategoryTicks:B,oSort:!1,amplitude:p}),X.legendBehaviorProps),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Ti(x)||Z}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(os,{componentName:"RidgelinePlot",width:D,height:H},e.createElement(Go,Object.assign({ref:a},ee)))});tl.displayName="RidgelinePlot";const nl=c(function(o,r){const i=Ma(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=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:[]}}));const{data:s,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_,categoryFormat:T}=o,B="vertical"===y,N=i.width,D=i.height,H=i.enableHover,$=i.title,I=i.description,W=i.summary,F=i.accessibleTable,z=s||[],R=f||g,G=!R,Y=cs({data:z,rawData:s,colorBy:R,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"FunnelChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:$?60:40,right:20,bottom:60,left:60}:{top:$?40:10,right:10,bottom:10,left:10},loading:C,emptyContent:M,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;ls("FunnelChart",z,"stepAccessor",d),ls("FunnelChart",z,"valueAccessor",h);const q=ba(),X=n(()=>new Map,[z]),V=n(()=>{if(G)return _||((null==q?void 0:q[0])?q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[G,_,q,p]),U=n(()=>(e,t)=>{const n={};return n.fill=V||(R?Ne(e,R,Y.colorScale):xa(_,q,p,t,X)),n},[V,R,Y.colorScale,_,q,p,X]),K=n(()=>aa(U,Y.effectiveSelectionHook,w),[U,Y.effectiveSelectionHook,w]),Q=n(()=>t=>{var n,o,r,i,a,s;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(a=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==a?a:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(s=null==l?void 0:l.__barFunnelCategory)&&void 0!==s?s:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:Ci},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),f&&f!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},f+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",p))},[]),Z=Ha({componentName:"FunnelChart",data:s,accessors:{stepAccessor:d,valueAccessor:h}});if(Z)return e.createElement(La,{componentName:"FunnelChart",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:z}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,enableHover:H,showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),Y.legendBehaviorProps),$&&{title:$}),I&&{description:I}),W&&{summary:W}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Q:Ti(b)||Q}),(A||S||O||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(os,{componentName:"FunnelChart",width:N,height:D},e.createElement(Go,Object.assign({ref:a},J)))});nl.displayName="FunnelChart";const ol=c(function(o,r){var i;const a=Ma(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,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:o.orientation}),s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=a.width,H=a.height,$=a.enableHover,I=a.showGrid,W=a.title,F=a.description,z=a.summary,R=a.accessibleTable,G=a.categoryLabel,Y=a.valueLabel,q=l||[],X=cs({data:q,rawData:l,colorBy:y,colorScheme:m,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:P,emptyContent:L,width:D,height:H});if(X.earlyReturn)return X.earlyReturn;const V=Aa(q,v,g),U=ba(),K=n(()=>new Map,[q]),Q=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=y?Ne(e,y,X.colorScale):xa(B,U,m,void 0,K),n},[y,X.colorScale,b,B,U,m,K]),Z=n(()=>aa(Q,X.effectiveSelectionHook,S),[Q,X.effectiveSelectionHook,S]),J=n(()=>$i({categoryAccessor:h,valueAccessor:g}),[h,g]),ee=Ha({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ee)return e.createElement(La,{componentName:"DotPlot",message:ee,width:D,height:H});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:V}),{oAccessor:h,rAccessor:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:Z,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:x,enableHover:$,showAxes:a.showAxes,oLabel:G,rLabel:Y,rFormat:p}),N&&{oFormat:N}),{showGrid:I,oSort:v}),X.legendBehaviorProps),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===k?()=>null:Ti(k)||J}),(O||E||j||C)&&{customHoverBehavior:X.customHoverBehavior}),(E||j||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(os,{componentName:"DotPlot",width:D,height:H},e.createElement(Go,Object.assign({ref:s},te)))});ol.displayName="DotPlot";const rl=c(function(o,r){var i,a;const s=Ma(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,hoverHighlight:S,chartId:O,loading:E,emptyContent:j,legendInteraction:C,legendPosition:M,color:P}=o,L=s.width,_=s.height,T=s.enableHover,B=s.showLegend,N=s.title,D=s.description,H=s.summary,$=s.accessibleTable,I=c||[],W=f||h,F=void 0===c,z=cs({data:I,rawData:c,colorBy:W,colorScheme:p,legendInteraction:C,legendPosition:M,selection:x,linkedHover:k,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:B,userMargin:u,marginDefaults:s.marginDefaults,loading:E,emptyContent:j,width:L,height:_});if(z.earlyReturn)return z.earlyReturn;const R=ba(),G=n(()=>new Map,[I]),Y=n(()=>(e,t)=>W?z.colorScale?{fill:Ne(e,W,z.colorScale)}:{}:{fill:xa(P,R,p,t,G)},[W,z.colorScale,P,R,p,G]),q=n(()=>aa(Y,z.effectiveSelectionHook,x),[Y,z.effectiveSelectionHook,x]),X=n(()=>$i({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),V=Ha({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:U,effectiveMargin:K}=Ws({ref:r,frameRef:l,isPushMode:F,colorBy:W,colorScheme:p,showLegend:B,legendPosition:M,setup:z}),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(Object.assign({chartType:"pie"},null!=c&&{data:I}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:q,startAngle:y,size:[L,_],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K,enableHover:T,showAxes:!1}),U),N&&{title:N}),D&&{description:D}),H&&{summary:H}),void 0!==$&&{accessibleTable:$}),d&&{className:d}),{tooltipContent:!1===m?()=>null:Ti(m)||X}),(k||w||A||S)&&{customHoverBehavior:z.customHoverBehavior}),(w||A||k)&&{customClickBehavior:z.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return V?e.createElement(La,{componentName:"PieChart",message:V,width:L,height:_}):e.createElement(os,{componentName:"PieChart",width:L,height:_},e.createElement(Go,Object.assign({ref:l},Q)))});rl.displayName="PieChart";const il=c(function(o,r){var i,a;const s=Ma(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:f=60,centerContent:p,colorBy:y,colorScheme:m,startAngle:v=0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_}=o,T=s.width,B=s.height,N=s.enableHover,D=s.showLegend,H=s.title,$=s.description,I=s.summary,W=s.accessibleTable,F=c||[],z=y||h,R=void 0===c,G=cs({data:F,rawData:c,colorBy:z,colorScheme:m,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"DonutChart",chartId:j,showLegend:D,userMargin:u,marginDefaults:s.marginDefaults,loading:C,emptyContent:M,width:T,height:B});if(G.earlyReturn)return G.earlyReturn;const Y=ba(),q=n(()=>new Map,[F]),X=n(()=>(e,t)=>z?G.colorScale?{fill:Ne(e,z,G.colorScale)}:{}:{fill:xa(_,Y,m,t,q)},[z,G.colorScale,_,Y,m,q]),V=n(()=>aa(X,G.effectiveSelectionHook,w),[X,G.effectiveSelectionHook,w]),U=n(()=>$i({categoryAccessor:h,valueAccessor:g,groupAccessor:y&&y!==h?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[h,g,y]),K=Ha({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:Z}=Ws({ref:r,frameRef:l,isPushMode:R,colorBy:z,colorScheme:m,showLegend:D,legendPosition:L,setup:G}),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({chartType:"donut"},null!=c&&{data:F}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,innerRadius:f,startAngle:v,centerContent:p,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z,enableHover:N,showAxes:!1}),Q),H&&{title:H}),$&&{description:$}),I&&{summary:I}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),{tooltipContent:!1===b?()=>null:Ti(b)||U}),(A||S||O||E)&&{customHoverBehavior:G.customHoverBehavior}),(S||O||A)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),k);return K?e.createElement(La,{componentName:"DonutChart",message:K,width:T,height:B}):e.createElement(os,{componentName:"DonutChart",width:T,height:B},e.createElement(Go,Object.assign({ref:l},J)))});il.displayName="DonutChart";const al=c(function(o,r){var i,a,s;const l=Ma(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:300,height:null!==(a=o.height)&&void 0!==a?a:250,enableHover:null===(s=o.enableHover)||void 0===s||s,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary}),c=t(null),{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!0,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:E={},className:j}=o,C=l.width,M=l.height,P=l.title,L=l.description,_=l.summary,T=l.accessibleTable,B=Math.max(d,Math.min(h,u)),N=h-d||1,D=(B-d)/N,{gaugeData:H,pieceStyle:$,gaugeAnnotations:I}=n(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],a=(i.value-r)/N;if(A){const o=(r-d)/N,s=Math.max(0,Math.min(D,(i.value-d)/N)-o),l=a-s;if(s>0){const o="fill-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:p,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:p},gaugeAnnotations:n}},[u,d,h,g,f,p,D,N,k,A]),W=w*Math.PI/180,F=180+(360-w)/2,z=-Math.PI/2+F*Math.PI/180,R=[[Math.cos(z),Math.sin(z)],[Math.cos(z+W),Math.sin(z+W)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-z)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>W+.001||R.push([Math.cos(e),Math.sin(e)]);const G=Math.min(...R.map(e=>e[0])),Y=Math.max(...R.map(e=>e[0])),q=Math.min(...R.map(e=>e[1])),X=Math.max(...R.map(e=>e[1])),V=(q+X)/2,U=(G+Y)/2,K=Math.max(10,Math.min((C-20)/(Y-G),(M-20)/(X-q))-4),Q=Math.max(10,K*(1-y)),Z=C/2-U*K,J=M/2-V*K,ee=2*(K+4),te=n(()=>{if(null!=b)return"function"==typeof b?b(B,d,h):b;const t=x?x(B):Math.round(B)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),k&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,B,d,h,x,k,K]),ne=n(()=>{if(!m)return null;const e=-Math.PI/2+F*Math.PI/180+D*W,t=Q-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,D,F,W,Q,v]),oe=n(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||C)/2},${(o.height||M)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+F*Math.PI/180+(t.value-d)/N*W,i=Q-14,a=(o.height||M)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||C)/2+Math.cos(r)*i,y:a+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[C,M,d,N,F,W,Q]),re=n(()=>{const e=[...I,...O||[]];return ne&&e.push(ne),e},[I,O,ne]),ie=n(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("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))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===H.length)return e.createElement(La,{componentName:"GaugeChart",message:"No data to display",width:C,height:M});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:H,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:Q,startAngle:F,sweepAngle:w,centerContent:te,size:[C,M],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:J-ee/2,bottom:M-J-ee/2,left:Z-ee/2,right:C-Z-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Ti(S)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),P&&{title:P}),L&&{description:L}),_&&{summary:_}),void 0!==T&&{accessibleTable:T}),j&&{className:j}),E);return e.createElement(os,{componentName:"GaugeChart",width:C,height:M},e.createElement(Go,Object.assign({ref:c},ae)))});al.displayName="GaugeChart";const sl=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m=60,baselinePadding:v=!1,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_,categoryFormat:T}=o,B=i.width,N=i.height,D=i.enableHover,H=i.showGrid,$=i.showLegend,I=i.title,W=i.description,F=i.summary,z=i.accessibleTable,R=i.categoryLabel,G=i.valueLabel,Y=s||[],q=p||d,X=void 0===s,V=cs({data:Y,rawData:s,colorBy:q,colorScheme:y,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"GroupedBarChart",chartId:j,showLegend:$,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:M,width:B,height:N});if(V.earlyReturn)return V.earlyReturn;const U=ba(),K=n(()=>new Map,[Y]),Q=n(()=>(e,t)=>q?V.colorScale?{fill:Ne(e,q,V.colorScale)}:{}:{fill:xa(_,U,y,t,K)},[q,V.colorScale,_,U,y,K]),Z=n(()=>aa(Q,V.effectiveSelectionHook,w),[Q,V.effectiveSelectionHook,w]),J=n(()=>$i({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ee=Ha({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:te,effectiveMargin:ne}=Ws({ref:r,frameRef:a,isPushMode:X,colorBy:q,colorScheme:y,showLegend:$,legendPosition:L,setup:V}),oe=Object.assign(Object.assign(Object.assign(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!=s&&{data:Y}),{oAccessor:u,rAccessor:h,groupBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:Z,size:[B,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne,barPadding:m,baselinePadding:v,enableHover:D,showAxes:i.showAxes,oLabel:R,rLabel:G,rFormat:f}),T&&{oFormat:T}),{showGrid:H}),te),I&&{title:I}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Ti(b)||J}),(A||S||O||E)&&{customHoverBehavior:V.customHoverBehavior}),(S||O||A)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),k);return ee?e.createElement(La,{componentName:"GroupedBarChart",message:ee,width:B,height:N}):e.createElement(os,{componentName:"GroupedBarChart",width:B,height:N},e.createElement(Go,Object.assign({ref:a},oe)))});sl.displayName="GroupedBarChart";const ll=c(function(o,r){const i=Ma(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N,showCategoryTicks:D}=o,H=i.width,$=i.height,I=i.enableHover,W=i.showGrid,F=i.showLegend,z=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=p||d,K=void 0===s,Q=cs({data:V,rawData:s,colorBy:U,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:H,height:$}),Z=Us({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const J=ba(),ee=n(()=>new Map,[V]),te=n(()=>(e,t)=>U?Q.colorScale?{fill:Ne(e,U,Q.colorScale)}:{}:{fill:xa(B,J,y,t,ee)},[U,Q.colorScale,B,J,y,ee]),ne=n(()=>aa(te,Q.effectiveSelectionHook,S),[te,Q.effectiveSelectionHook,S]),oe=n(()=>$i({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),re=Ha({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:ie,effectiveMargin:ae}=Ws({ref:r,frameRef:a,isPushMode:K,colorBy:U,colorScheme:y,showLegend:F,legendPosition:T,setup:Q}),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({chartType:"swimlane"},null!=s&&{data:V}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[H,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:m,enableHover:I,showAxes:i.showAxes,oLabel:!1===D?void 0:q,rLabel:X,rFormat:f}),N&&{oFormat:N}),void 0!==D&&{showCategoryTicks:D}),{showGrid:W}),ie),z&&{title:z}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===v?()=>null:Ti(v)||oe}),(O||E||j||C)&&{customHoverBehavior:Q.customHoverBehavior}),(E||j||O)&&{customClickBehavior:Q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Z.brushStreamProps),A);return re?e.createElement(La,{componentName:"SwimlaneChart",message:re,width:H,height:$}):e.createElement(os,{componentName:"SwimlaneChart",width:H,height:$},e.createElement(Go,Object.assign({ref:a},se)))});ll.displayName="SwimlaneChart";const cl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ma(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:E,frameProps:j={},onObservation:C,onClick:M,chartId:P,selection:L,linkedHover:_,loading:T,emptyContent:B,legendInteraction:N,legendPosition:D}=o,H=s.width,$=s.height,I=s.enableHover,W=s.showLegend,F=null!==(i=s.showLabels)&&void 0!==i&&i,z=s.title,R=s.description,G=s.summary,Y=s.accessibleTable,q=ss(T,H,$),X=q?null:as(l,H,$,B),V=l||[],U=c||[],K=wa(V,m,v),Q=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Z=ja(N,m,Q),J=ba(),ee=n(()=>new Map,[]),te=n(()=>{if(Array.isArray(v))return v;if(J&&J.length>0)return J;const e=Pe[v];return Array.isArray(e)?e:Le},[v,J]),ne=n(()=>e=>{const t={};return t.fill=m?Ne(e.data||e,m,K):xa(void 0,J,v,void 0,ee),"number"==typeof b&&(t.r=b),t},[m,K,b,J,v,ee]),oe=n(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),re=n(()=>{if(F&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[F,y]),{legend:ie,margin:ae,legendPosition:se}=Ea({data:V,colorBy:m,colorScale:K,showLegend:W,legendPosition:D,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ce}=Sa({selection:L,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:M,chartType:"ForceDirectedGraph",chartId:P}),ue=Ia({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ue?e.createElement(La,{componentName:"ForceDirectedGraph",message:ue,width:H,height:$}):q||X||e.createElement(os,{componentName:"ForceDirectedGraph",width:H,height:$},e.createElement(ji,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:V},null!=c&&{edges:U},{size:[H,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ne,edgeStyle:oe,colorBy:m,colorScheme:te,nodeSize:b,nodeSizeRange:x,nodeLabel:re,showLabels:F,enableHover:I,tooltipContent:!1===E?()=>null:Ti(E)||void 0,customHoverBehavior:_||C||M?le:void 0,customClickBehavior:C||M?ce:void 0,legend:ie,legendPosition:se},N&&"none"!==N&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:z,description:R,summary:G,accessibleTable:Y},j)))});function ul(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function dl(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function hl(e){return"function"==typeof e?e:t=>t[e]||1}function gl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}cl.displayName="ForceDirectedGraph";const fl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ma(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:E={},onObservation:j,onClick:C,chartId:M,selection:P,linkedHover:L,loading:_,emptyContent:T,legendInteraction:B}=o,N=s.width,D=s.height,H=s.enableHover,$=null===(i=s.showLabels)||void 0===i||i,I=s.title,W=s.description,F=s.summary,z=s.accessibleTable,R=ss(_,N,D),G=R?null:as(c,N,D,T),Y=c||[],q=n(()=>dl(l,Y,g,f),[l,Y,g,f]),X=wa(q,m,v),V=n(()=>{if(!m)return[];const e=new Set;for(const t of q){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[q,m]),U=ja(B,m,V),K=ba(),Q=n(()=>new Map,[]),Z=n(()=>{if(Array.isArray(v))return v;if(K&&K.length>0)return K;const e=Pe[v];return Array.isArray(e)?e:Le},[v,K]),J=q.length>0,ee=n(()=>{if(J)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Ne(e.data||e,m,X);else{const i=Array.isArray(v)?v:Pe[v]||Le,a=Array.isArray(i)?i:Le,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[J,m,X,v]),te=n(()=>{if(J)return gl({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:ee||(e=>({fill:xa(void 0,K,v,void 0,Q)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[J,b,m,X,ee,S,K,v,Q]),ne=n(()=>{if(!$)return;const e=A||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[$,A,y]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:re,customClickBehavior:ie}=Sa({selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ChordDiagram",chartId:M}),ae=Ia({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ae?e.createElement(La,{componentName:"ChordDiagram",message:ae,width:N,height:D}):R||G||e.createElement(os,{componentName:"ChordDiagram",width:N,height:D},e.createElement(ji,Object.assign({ref:a,chartType:"chord"},q.length>0&&{nodes:q},null!=c&&{edges:Y},{size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Z,edgeColorBy:b,edgeOpacity:S,nodeLabel:ne,showLabels:$,enableHover:H,tooltipContent:!1===O?()=>null:Ti(O)||void 0,customHoverBehavior:L||j||C?re:void 0,customClickBehavior:j||C?ie:void 0},B&&"none"!==B&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:h,title:I,description:W,summary:F,accessibleTable:z},E)))});fl.displayName="ChordDiagram";const pl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ma(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:E,tooltip:j,frameProps:C={},onObservation:M,onClick:P,chartId:L,selection:_,linkedHover:T,loading:B,emptyContent:N,legendInteraction:D}=o,H=s.width,$=s.height,I=s.enableHover,W=null===(i=s.showLabels)||void 0===i||i,F=s.title,z=s.description,R=s.summary,G=s.accessibleTable,Y=ss(B,H,$),q=Y?null:as(c,H,$,N),X=c||[],V=n(()=>dl(l,X,g,f),[l,X,g,f]),U=wa(V,m,v),K=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Q=ja(D,m,K),Z=ba(),J=n(()=>new Map,[]),ee=n(()=>{if(Array.isArray(v))return v;if(Z&&Z.length>0)return Z;const e=Pe[v];return Array.isArray(e)?e:Le},[v,Z]),te=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Ne(e.data||e,m,U):xa(void 0,Z,v,void 0,J),t},[m,U,Z,v,J]),ne=n(()=>gl({edgeColorBy:b,colorBy:m,colorScale:U,nodeStyleFn:te,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,U,te,O]),oe=n(()=>{if(!W)return;const e=S||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[W,S,y]),re=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=Sa({selection:_,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,onClick:P,chartType:"SankeyDiagram",chartId:L}),se=Ia({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return se?e.createElement(La,{componentName:"SankeyDiagram",message:se,width:H,height:$}):Y||q||e.createElement(os,{componentName:"SankeyDiagram",width:H,height:$},e.createElement(ji,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=c&&{edges:X},{size:[H,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:te,edgeStyle:ne,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:O,edgeSort:E,nodeLabel:oe,showLabels:W,enableHover:I,tooltipContent:!1===j?()=>null:Ti(j)||void 0,customHoverBehavior:T||M||P?ie:void 0,customClickBehavior:M||P?ae:void 0},D&&"none"!==D&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:h,title:F,description:z,summary:R,accessibleTable:G},C)))});function yl(t){var o;const r=Ma(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:i,margin:a,className:s,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:E,legendInteraction:j}=t,C=r.width,M=r.height,P=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=ss(E,C,M),H=n(()=>ul(null!=i?i:null,u),[i,u]),$=wa(H,p?void 0:g,f),I=n(()=>{if(!g||p)return[];const e=new Set;for(const t of H){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[H,g,p]),W=ja(j,p?void 0:g,I),F=ba(),z=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(f))return f;if(F&&F.length>0)return F;const e=Pe[f];return Array.isArray(e)?e:Le},[f,F]),G=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Te[(e.depth||0)%Te.length]:g?Ne(e.data||e,g,$):xa(void 0,F,f,void 0,z),t},[g,p,$,F,f,z]),Y=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),q=n(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return hl(d)},[l,d]),X=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:U}=Sa({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),K=$a({componentName:"TreeDiagram",data:i});return K?e.createElement(La,{componentName:"TreeDiagram",message:K,width:C,height:M}):D||e.createElement(os,{componentName:"TreeDiagram",width:C,height:M},e.createElement(ji,Object.assign({chartType:l},null!=i&&{data:i},{size:[C,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:q,treeOrientation:c,edgeType:y,nodeStyle:G,edgeStyle:Y,colorBy:g,colorScheme:R,colorByDepth:p,nodeSize:v,nodeLabel:L?m||h:void 0,showLabels:L,enableHover:P,tooltipContent:!1===b?()=>null:Ti(b)||void 0,customHoverBehavior:O||k||w?V:void 0,customClickBehavior:k||w?U:void 0},j&&"none"!==j&&{legendHoverBehavior:W.onLegendHover,legendClickBehavior:W.onLegendClick,legendHighlightedCategory:W.highlightedCategory,legendIsolatedCategories:W.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function ml(t){var o;const r=Ma(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:i,margin:a,className:s,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:E,legendInteraction:j}=t,C=r.width,M=r.height,P=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=ss(E,C,M),{activeSelectionHook:H,customHoverBehavior:$,customClickBehavior:I}=Sa({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),W=l(e=>{if(!e)return $(null);const t=e.data||e;$({data:(null==t?void 0:t.data)||t})},[$]),F=n(()=>ul(null!=i?i:null,c),[i,c]),z=wa(F,f?void 0:h,g),R=n(()=>{if(!h||f)return[];const e=new Set;for(const t of F){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[F,h,f]),G=ja(j,f?void 0:h,R),Y=ba(),q=n(()=>new Map,[]),X=n(()=>{if(Array.isArray(g))return g;if(Y&&Y.length>0)return Y;const e=Pe[g];return Array.isArray(e)?e:Le},[g,Y]),V=n(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Te[(e.depth||0)%Te.length]:h?Ne(e.data||e,h,z):xa(void 0,Y,g,void 0,q),t},[h,f,z,Y,g,q]),U=n(()=>H?e=>{var t;const n=Object.assign({},V(e));if(H.isActive)if(H.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(n,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(n,k.unselectedStyle)}return n}:V,[V,H,k]),K=n(()=>hl(u),[u]),Q=void 0!==v?v:!L||"parent"!==p&&"all"!==p?void 0:18,Z=Object.assign(Object.assign({},r.marginDefaults),a),J=$a({componentName:"Treemap",data:i});return J?e.createElement(La,{componentName:"Treemap",message:J,width:C,height:M}):D||e.createElement(os,{componentName:"Treemap",width:C,height:M},e.createElement(ji,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[C,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,padding:m,paddingTop:Q,nodeStyle:U,colorBy:h,colorScheme:X,colorByDepth:f,nodeLabel:L?y||d:void 0,showLabels:L,labelMode:p,enableHover:P,tooltipContent:!1===b?()=>null:Ti(b)||void 0},(w||A||S)&&{customHoverBehavior:W},(A||S)&&{customClickBehavior:I},j&&"none"!==j&&{legendHoverBehavior:G.onLegendHover,legendClickBehavior:G.onLegendClick,legendHighlightedCategory:G.highlightedCategory,legendIsolatedCategories:G.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function vl(t){var o;const r=Ma(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:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O}=t,E=r.width,j=r.height,C=r.enableHover,M=null===(o=r.showLabels)||void 0===o||o,P=r.title,L=r.description,_=r.summary,T=r.accessibleTable,B=ss(S,E,j),N=n(()=>ul(null!=i?i:null,l),[i,l]),D=wa(N,g?void 0:d,h),H=n(()=>{if(!d||g)return[];const e=new Set;for(const t of N){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[N,d,g]),$=ja(O,g?void 0:d,H),I=ba(),W=n(()=>new Map,[]),F=n(()=>{if(Array.isArray(h))return h;if(I&&I.length>0)return I;const e=Pe[h];return Array.isArray(e)?e:Le},[h,I]),z=n(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?Te[(e.depth||0)%Te.length]:d?Ne(e.data||e,d,D):xa(void 0,I,h,void 0,W),t},[d,g,D,p,I,h,W]),R=n(()=>hl(c),[c]),G=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:Y,customClickBehavior:q}=Sa({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),X=$a({componentName:"CirclePack",data:i});return X?e.createElement(La,{componentName:"CirclePack",message:X,width:E,height:j}):B||e.createElement(os,{componentName:"CirclePack",width:E,height:j},e.createElement(ji,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:R,padding:y,nodeStyle:z,colorBy:d,colorScheme:F,colorByDepth:g,nodeLabel:M?f||u:void 0,showLabels:M,enableHover:C,tooltipContent:!1===m?()=>null:Ti(m)||void 0,customHoverBehavior:A||b||x?Y:void 0,customClickBehavior:b||x?q:void 0},O&&"none"!==O&&{legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:$.isolatedCategories},{className:s,title:P,description:L,summary:_,accessibleTable:T},v)))}pl.displayName="SankeyDiagram",yl.displayName="TreeDiagram",ml.displayName="Treemap",vl.displayName="CirclePack";const bl=Te;function xl(t){const o=Ma(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:r,margin:i,className:a,childrenAccessor:s="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:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:E,onClick:j,chartId:C,selection:M,linkedHover:P,loading:L}=t,_=o.width,T=o.height,B=o.enableHover,N=o.title,D=o.description,H=o.summary,$=o.accessibleTable,I=ss(L,_,T),W=wa(n(()=>ul(r,s),[r,s]),d?void 0:c,u),F=ba(),z=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(u))return u;if(F&&F.length>0)return F;const e=Pe[u];return Array.isArray(e)?e:Le},[u,F]),G=n(()=>{if(Array.isArray(u))return u;const e=Pe[u];return Array.isArray(e)?e:Le},[u]),Y=n(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?G[0]:bl[(e.depth||0)%bl.length]:c?Ne(e.data||e,c,W):xa(void 0,F,u,void 0,z),n.opacity=o?1:.85,n},[c,d,W,G,F,u,z]),q=n(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),X=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:V,customClickBehavior:U}=Sa({selection:M,linkedHover:P,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:E,onClick:j,chartType:"OrbitDiagram",chartId:C}),K=n(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Q=n(()=>{if(U)return e=>{U(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[U]),Z=$a({componentName:"OrbitDiagram",data:r});return Z?e.createElement(La,{componentName:"OrbitDiagram",message:Z,width:_,height:T}):I||e.createElement(os,{componentName:"OrbitDiagram",width:_,height:T},e.createElement(ji,Object.assign({chartType:"orbit"},null!=r&&{data:r},{size:[_,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Y,edgeStyle:q,colorBy:c,colorScheme:R,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&B,tooltipContent:k?void 0:!1===w?()=>null:Ti(w)||void 0,customHoverBehavior:P||E||j?K:void 0,customClickBehavior:E||j?Q:void 0,foregroundGraphics:A,annotations:S,className:a,title:N,description:D,summary:H,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:$},O)))}xl.displayName="OrbitDiagram";const kl=c(function(n,o){var r,i,a,s;const c=Ma(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,background:E,tooltipContent:j,tooltip:C,onHover:M,annotations:P,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:H,linkedHover:$,selection:I,onObservation:W,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=j?j:C,Q=t(null),{customHoverBehavior:Z}=Sa({selection:I,linkedHover:$,unwrapData:!0,onObservation:W,chartType:"RealtimeLineChart",chartId:F}),J=l(e=>{M&&M(e),Z(e)},[M,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=ss(z,U[0],U[1]),te=ee?null:as(m,U[0],U[1],R),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return ee||te||e.createElement(ho,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:E,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:P,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:H,legendPosition:Y})});kl.displayName="RealtimeLineChart";const wl=c(function(n,o){var r,i,a,s;const c=Ma(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:E,stroke:j,strokeWidth:C,gap:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,linkedHover:$,selection:I,decay:W,pulse:F,staleness:z,transition:R,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U,brush:K,onBrush:Q,linkedBrush:Z}=n,J=c.showAxes,ee=c.enableHover,te=null!=g?g:c.marginDefaults,ne=null!=h?h:[c.width,c.height],oe=null!=L?L:_,re=t(null),{customHoverBehavior:ie}=Sa({selection:I,linkedHover:$,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),ae=l(e=>{T&&T(e),ie(e)},[T,ie]),se=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,le=ia(Z),ce=Qi(Object.assign({name:(null==le?void 0:le.name)||"__unused_hist_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof b?b:"time")},(null==le?void 0:le.yField)?{yField:le.yField}:{})),ue=t(ce.brushInteraction);ue.current=ce.brushInteraction;const de=l(e=>{if(Q&&Q(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}),le){const t=ue.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)}},[Q,G,Y,le]);u(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const he=ss(q,ne[0],ne[1]),ge=he?null:as(v,ne[0],ne[1],X),fe={};return null!=E&&(fe.fill=E),null!=j&&(fe.stroke=j),null!=C&&(fe.strokeWidth=C),null!=M&&(fe.gap=M),he||ge||e.createElement(ho,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:te,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:O,barStyle:fe,showAxes:J,background:P,hoverAnnotation:ee,tooltipContent:oe,customHoverBehavior:ae,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,decay:W,pulse:F,staleness:z,transition:R,legendPosition:U,brush:se||(Z?{dimension:"x"}:void 0),onBrush:se||Z?de:void 0})});wl.displayName="RealtimeTemporalHistogram";const Al=wl,Sl=c(function(n,o){var r,i,a,s;const c=Ma(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:E,opacity:j,stroke:C,strokeWidth:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,linkedHover:$,selection:I,onObservation:W,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Sa({selection:I,linkedHover:$,unwrapData:!0,onObservation:W,chartType:"RealtimeSwarmChart",chartId:F}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=ss(z,U[0],U[1]),te=ee?null:as(m,U[0],U[1],R),ne={};return null!=O&&(ne.radius=O),null!=E&&(ne.fill=E),null!=j&&(ne.opacity=j),null!=C&&(ne.stroke=C),null!=M&&(ne.strokeWidth=M),ee||te||e.createElement(ho,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,legendPosition:Y})});Sl.displayName="RealtimeSwarmChart";const Ol=c(function(n,o){var r,i,a,s;const c=Ma(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:E,gap:j,stroke:C,strokeWidth:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,linkedHover:$,selection:I,onObservation:W,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Sa({selection:I,linkedHover:$,unwrapData:!0,onObservation:W,chartType:"RealtimeWaterfallChart",chartId:F}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=ss(z,U[0],U[1]),te=ee?null:as(m,U[0],U[1],R),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=E&&(ne.connectorWidth=E),null!=j&&(ne.gap=j),null!=C&&(ne.stroke=C),null!=M&&(ne.strokeWidth=M),ee||te||e.createElement(ho,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:H,legendPosition:Y})});Ol.displayName="RealtimeWaterfallChart";const El=c(function(n,o){var r,i,a,s;const c=Ma(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:E="count",background:j,tooltipContent:C,tooltip:M,onHover:P,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:H,linkedHover:$,selection:I,onObservation:W,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=C?C:M,Q=t(null),{customHoverBehavior:Z}=Sa({selection:I,linkedHover:$,unwrapData:!0,onObservation:W,chartType:"RealtimeHeatmap",chartId:F}),J=l(e=>{P&&P(e),Z(e)},[P,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=ss(z,U[0],U[1]),te=ee?null:as(m,U[0],U[1],R);return ee||te||e.createElement(ho,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:E,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:H,legendPosition:Y})});function jl(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}El.displayName="RealtimeHeatmap";const Cl=864e5;function Ml(e){return 10>e?"0"+e:e+""}const Pl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ll(e){let t,n=e;return(o,r,i)=>{const a=o instanceof Date?o:new Date(o);e||!i||2>i.length||i===t||(t=i,n=function(e){if(2>e.length)return"days";const t=[];for(let n=1;e.length>n;n++)t.push(e[n]-e[n-1]);t.sort((e,t)=>e-t);const n=t[Math.floor(t.length/2)];return 12e4>n?"seconds":72e5>n?"minutes":2*Cl>n?"hours":60*Cl>n?"days":400*Cl>n?"months":"years"}(i));const s=n||"days";return null!=r&&0!==r&&i&&0!==i.length?function(e,t,n){const o=e.getUTCFullYear()!==t.getUTCFullYear(),r=o||e.getUTCMonth()!==t.getUTCMonth(),i=r||e.getUTCDate()!==t.getUTCDate(),a=i||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=Pl[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Ml(e.getUTCHours()),h=Ml(e.getUTCMinutes()),g=Ml(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:i?`${l} ${c} ${d}:${h}:${g}`:a?`${d}:${h}:${g}`:s?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return o?`${l} ${c}, ${u} ${d}:00`:r?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return o?`${l} ${c}, ${u}`:r?`${l} ${c}`:""+c;case"months":return o?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(i[r-1]),s):function(e,t){const n=Pl[e.getUTCMonth()],o=e.getUTCDate(),r=e.getUTCFullYear(),i=Ml(e.getUTCHours()),a=Ml(e.getUTCMinutes()),s=Ml(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${r} ${i}:${a}:${s}`;case"minutes":case"hours":return`${n} ${o}, ${r} ${i}:${a}`;case"days":return`${n} ${o}, ${r}`;case"months":return`${n} ${r}`;case"years":return""+r}}(a,s)}}function _l(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Tl(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Bl(e,t){return gs(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Nl(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Dl(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*r,n=l.height*r,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,n),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),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),a.toBlob(n=>{n?(Dl(n,o+".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 Nl(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["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 a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Nl(o[e],r[e])}function Dl(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const Hl=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"]),$l=new Set(["data","nodes","edges"]),Il="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Wl(e,t,n){if(!Ya[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Ya).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Hl.has(e)||!o&&$l.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Il(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Fl(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Ya[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Il(e.props)}}function zl(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Rl(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 n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Gl(e){return gs(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Yl(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(n)})}function Yl(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function ql(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function Xl(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function Vl(e){return"nominal"===e||"ordinal"===e}function Ul(e){return"quantitative"===e||"temporal"===e}const Kl={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"},Ql={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"},Zl={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Jl(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f;const p=[],{type:y,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,k=v.color,w=v.size,A=v.theta,S=v.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.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 E={};e.width&&(E.width=e.width),e.height&&(E.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(E.title=j),(null==k?void 0:k.field)&&(E.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=Kl[k.scale.scheme];e&&(E.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(E.pointOpacity=S.value);const C=null==b?void 0:b.aggregate,M=null==x?void 0:x.aggregate;if(O&&(C||M)){const e=M?x:b,t=M?b:x,n=Zl[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(O,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const n of O){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}O=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(E.data=O),(null==b?void 0:b.bin)?(E.valueAccessor=b.field,(null==x?void 0:x.field)&&(E.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(E.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(E.valueAccessor=x.field,(null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(E.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(E.bins=t),tc(e,E,p)}let P;switch(y){case"bar":P=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.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",o.stackBy=n.field):g="BarChart",Vl(null==e?void 0:e.type)&&Ul(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):Ul(null==e?void 0:e.type)&&Vl(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,k,E,O,C,M);break;case"line":if(P="LineChart",ec(b,x,E,C,M),(null==k?void 0:k.field)&&(E.lineBy=k.field),m.interpolate){const e=Ql[m.interpolate];e&&(E.curve=e)}!0===m.point&&(E.showPoints=!0),O&&(E.data=O);break;case"area":if((null==k?void 0:k.field)?(P="StackedAreaChart",E.areaBy=k.field):P="AreaChart",ec(b,x,E,C,M),m.interpolate){const e=Ql[m.interpolate];e&&(E.curve=e)}void 0!==m.opacity&&(E.areaOpacity=m.opacity),O&&(E.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(P="BubbleChart",E.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(E.sizeRange=w.scale.range)):P="Scatterplot",ec(b,x,E,C,M),O&&(E.data=O);break;case"rect":P="Heatmap",(null==b?void 0:b.field)&&(E.xAccessor=b.field),(null==x?void 0:x.field)&&(E.yAccessor=x.field),(null==k?void 0:k.field)&&(E.valueAccessor=k.field,delete E.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(E.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(E.yLabel=x.axis.title),O&&(E.data=O);break;case"arc":m.innerRadius&&m.innerRadius>0?(P="DonutChart",E.innerRadius=m.innerRadius):P="PieChart",(null==A?void 0:A.field)?E.valueAccessor=A.field:(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field),(null==k?void 0:k.field)&&(E.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(E.categoryAccessor=b.field),O&&(E.data=O);break;case"tick":P="DotPlot",Vl(null==b?void 0:b.type)?(E.categoryAccessor=b.field,(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(E.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(E.valueLabel=x.axis.title)):Vl(null==x?void 0:x.type)?(E.categoryAccessor=x.field,(null==b?void 0:b.field)&&(E.valueAccessor=C?"value":b.field),E.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(E.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(E.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field)),O&&(E.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),P="Scatterplot",ec(b,x,E,C,M),O&&(E.data=O)}return tc(P,E,p)}function ec(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function tc(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}function nc(){const t=function(){const t=e.useContext(sn);return t?()=>t.setVisible(e=>!e):null}();return t?e.createElement("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:sc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"}))):null}const oc={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 rc({height:t}){return e.createElement("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 ic({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const ac=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:p},y){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),k=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),w=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S=!0===(null==a?void 0:a.dataSummary),O="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",j=e.useCallback(e=>gs(this,void 0,void 0,function*(){v.current&&(yield Bl(v.current,Object.assign(Object.assign({},O),e)))}),[O]),C=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),M=e.useCallback(e=>gs(this,void 0,void 0,function*(){s&&(yield Gl(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(y,()=>({export:j,toggleFullscreen:C,copyConfig:M,element:m.current}),[j,C,M]);const P=t||n||l||k||w||A||S||h,L=c?e.createElement(rc,{height:i}):u?e.createElement(ic,{error:u}):d?e.createElement(_a,null,o):o;return _=e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:r,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"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},P&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,k&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Export chart","aria-label":"Export chart",style:sc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),S&&e.createElement(nc,null),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:C,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:sc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>M(),title:"Copy config","aria-label":"Copy chart configuration",style:sc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("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:oc[h].bg,color:oc[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},b?{flex:1}:{height:i})},L,g))),S?e.createElement(ln,null,_):_;var _}),sc={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 lc({children:t,columns:n="auto",minCellWidth:o=300,gap:r=16,className:i,style:a}){const s="number"==typeof n?n:void 0;return e.createElement("div",{className:"semiotic-chart-grid"+(i?" "+i:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a)},e.Children.map(t,t=>e.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==s&&2>s?t:e.createElement("div",{style:{gridColumn:"span 2"}},t):t))}function cc({children:t,context:n,position:o="right",contextSize:r=250,gap:i=12,className:a,style:s}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:i,width:"100%"},s),d=l?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return e.createElement("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u},e.createElement("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0}},t),e.createElement("div",{style:d},n))}lc.displayName="ChartGrid",cc.displayName="ContextLayout";function uc({children:n,position:i="right",size:a=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:f,style:p}){const[y,m]=r(null),[v,b]=r(null),[x,k]=r(!1),[w,A]=r(!1),S=t(null),O=t(),E="click"===s?["click","click-end"]:["hover","hover-end"],{latest:j}=Ji({types:E,chartId:c,limit:1}),C=void 0!==u?u:j;o(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(O.current),O.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==C.type&&"hover-end"!==C.type||M()},[C]),o(()=>{null==g||g(x)},[x,g]);const M=l(()=>{A(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(O.current),[]),!y&&!w)return null;const P=y&&v?n(y,v):null;if(null===P&&!w)return null;const L=function(e,t,n,o){const r={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:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?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)"})}(i,a,x,w);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${i}${f?" "+f:""}`,style:Object.assign(Object.assign({},L),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:dc},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},P))}const dc={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};uc.displayName="DetailsPanel";export{vs as AreaChart,Is as BarChart,Zs as BoxPlot,ws as BubbleChart,la as CARBON_ALERT,sa as CARBON_CATEGORICAL_14,Tn as COLOR_BLIND_SAFE_CATEGORICAL,Wi as CategoryColorProvider,ac as ChartContainer,_a as ChartErrorBoundary,lc as ChartGrid,fl as ChordDiagram,vl as CirclePack,hs as ConnectedScatterplot,cc as ContextLayout,Nn as DARK_THEME,uc as DetailsPanel,il as DonutChart,ol as DotPlot,cl as ForceDirectedGraph,nl as FunnelChart,al as GaugeChart,sl as GroupedBarChart,Dn as HIGH_CONTRAST_THEME,ks as Heatmap,Js as Histogram,Se as IncrementalExtent,Bn as LIGHT_THEME,Vs as LikertChart,ms as LineChart,oa as LinkedCharts,_s as MinimapChart,$s as MultiAxisLineChart,_i as MultiLineTooltip,xl as OrbitDiagram,rl as PieChart,Ts as QuadrantChart,El as RealtimeHeatmap,Al as RealtimeHistogram,kl as RealtimeLineChart,Sl as RealtimeSwarmChart,wl as RealtimeTemporalHistogram,Ol as RealtimeWaterfallChart,tl as RidgelinePlot,Ae as RingBuffer,pl as SankeyDiagram,us as Scatterplot,Ps as ScatterplotMatrix,xs as StackedAreaChart,Fs as StackedBarChart,ji as StreamNetworkFrame,Go as StreamOrdinalFrame,ho as StreamXYFrame,Ks as SwarmPlot,ll as SwimlaneChart,ca as THEME_PRESETS,ya as ThemeProvider,Li as Tooltip,yl as TreeDiagram,ml as Treemap,el as ViolinPlot,Ll as adaptiveTimeTicks,Yl as configToJSX,Gl as copyConfig,To as createHatchPattern,_l as darkenColor,Xl as deserializeSelections,Bl as exportChart,Fl as fromConfig,Rl as fromURL,Jl as fromVegaLite,Tl as lightenColor,Ti as normalizeTooltip,ua as resolveThemePreset,ql as serializeSelections,jl as smartTickFormat,da as themeToCSS,ha as themeToTokens,Wl as toConfig,zl as toURL,Qi as useBrushSelection,Fi as useCategoryColors,Ji as useChartObserver,Zi as useFilteredData,Ki as useLinkedHover,Ui as useSelection,ma as useTheme};
1
+ import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useState as r,useSyncExternalStore as i,createContext as a,useContext as s,useCallback as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as f,brush as p}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleBand as x,scaleSequential as k}from"d3-scale";import{quadtree as w}from"d3-quadtree";import{interpolatePlasma as A,interpolateViridis as S,interpolatePurples as O,interpolateOranges as E,interpolateGreens as j,interpolateReds as C,interpolateBlues as M,schemeSet3 as P,schemeTableau10 as L,schemeCategory10 as _}from"d3-scale-chromatic";import{bin as T,quantile as B,min as N,groups as D,max as I,sum as $,mean as H,group as F}from"d3-array";import{packEnclose as z,hierarchy as W,partition as R,pack as G,treemap as Y,treemapBinary as q,cluster as X,tree as V}from"d3-hierarchy";import{area as U,curveCatmullRom as K,curveCardinal as Z,curveBasis as Q,curveStepBefore as J,curveStepAfter as ee,curveStep as te,curveMonotoneY as ne,curveMonotoneX as oe,curveLinear as re,arc as ie,line as ae,curveNatural as se,pie as le}from"d3-shape";import ce from"regression";import{interpolateNumber as ue}from"d3-interpolate";import{forceLink as de,forceSimulation as he,forceManyBody as ge,forceCenter as fe,forceX as pe,forceY as ye}from"d3-force";import{ribbon as me,chord as ve}from"d3-chord";function be(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function xe(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function ke({width:r,height:i,totalWidth:a,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:y,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const S=t(u);S.current=u;const O=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),E=t(O);E.current=O;const j=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?f():p();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(j.current)return;const o=S.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=n.selection;a=[o.x.invert(e),o.x.invert(t)],s=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;a=[o.x.invert(0),o.x.invert(r)],s=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;a=[o.x.invert(e),o.x.invert(r)],s=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=E.current;r&&r.length>0?a=function(e,t){return 0===t.length?e:[be(e[0],t),xe(e[1],t)]}(a,r):y&&y>0&&(a=[Math.floor(a[0]/y)*y,Math.ceil(a[1]/y)*y]);const i=o.x(a[0]),s=o.x(a[1]);if(j.current=!0,"x"===c)e.call(t.move,[i,s]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[s,o[1][1]]])}j.current=!1}const l={x:a,y:s};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,y,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=E.current;e&&e.length>0?o=xe(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[i,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[a,o]])}if(j.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,y]),e.createElement("svg",{ref:k,width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class we{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class Ae{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class Se{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Oe(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ce(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Me(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const Pe={category10:_,tableau10:L,set3:P,blues:M,reds:C,greens:j,oranges:E,purples:O,viridis:S,plasma:A},Le=_,_e=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=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 Ne(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Be.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Le[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%Le.length]}function De(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const i=Pe[n]||Pe.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Le;return y().domain(o).range(e).unknown("#999")}}function Ie(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function $e(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}function He(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function Fe(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function ze(e,t){return Math.min((e-t.startTime)/t.duration,1)}function We(e,t,n){return e+(t-e)*n}function Re(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ge(e,t,n){var o,r,i,a;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(a=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o,r,i){const a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function qe(e,t,n,o,r,i,a,s){const l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),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:i,datum:e,group:a}}function Xe(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function Ve(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function Ue(e,t,n,o,r,i,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Ke(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const a=e.getBounds(n),s=e.scales.x(t);if(a&&0!==a)o.push([s,e.scales.y(i+a)]),r.push([s,e.scales.y(i-a)]);else{const t=e.scales.y(i);o.push([s,t]),r.push([s,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function Ze(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Xe(a,e.scales,e.getX,i,s,o,l);c&&n.push(c)}}}const Qe={blues:M,reds:C,greens:j,viridis:S},Je=new Map;class et{constructor(e){if(this.xExtent=new Se,this.yExtent=new Se,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this.config=e,this.buffer=new Ae(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Me(e.groupAccessor),this.getCategory=Me(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Me(e.colorAccessor),this.getBounds=e.boundsAccessor?je(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.getPointId=Me(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,a,s;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,f=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:h[0],null!==(i=l.yExtent[1])&&void 0!==i?i:h[1]]:h;const p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);f=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Oe(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&f[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,n=null===(a=l.yExtent)||void 0===a?void 0:a[0],o=null===(s=l.yExtent)||void 0===s?void 0:s[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=n?f[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]);const y="streaming"===l.runtimeMode,x=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(k=l.arrowOfTime)||"down"===k?"y":"x")){const t="right"===l.arrowOfTime?[x,e.width-x]:[e.width-x,x];this.scales={x:m().domain(g).range(t),y:m().domain(f).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(f).range([x,e.width-x]),y:m().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[x,e.width-x]),y:t(l.yScaleType,f,[e.height-x,x])}}var k;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),this.config.transition&&(this.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 void(this._quadtree=null);const t=this.scene.filter(e=>"point"===e.type);this._quadtree=t.length>et.QUADTREE_THRESHOLD?w().x(e=>e.x).y(e=>e.y).addAll(t):null}get quadtree(){return this._quadtree}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=Ke(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return Ze(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=qe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(a.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Ze(e,n,o),o}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set,i=e.scales.y.domain()[0],a=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=qe(t.data,e.scales,e.getX,e.getY,i,n,t.key,a);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Ze(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,a){var s;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(s=u.get(o.key))||void 0===s?void 0:s.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[],l=new Map;for(const n of c){let r=e.get(n)||0;const a=f.get(n);i&&(r/=d.get(n));const c=a+r,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),f.set(n,c),l.set(n,c)}g.set(n.key,l);const p={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(p.curve=a),h.push(p)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),a=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Ze(e,n,a,o)}return a}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},s=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(s=i(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(r);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=Xe(r,e.scales,e.getX,e.getY,s,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),l=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",c=je(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)/a,p=(g-h||1)/s,y=a*s;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],r=e.getX(o),i=e.getY(o);if(!isFinite(r)||!isFinite(i))continue;const l=Math.min(Math.floor((r-u)/f),a-1),d=Math.min(Math.floor((i-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,E=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>n;n++){const o=t+n;if(0===m[o])continue;let r;switch(l){case"sum":r=v[o];break;case"mean":r=v[o]/m[o];break;default:r=m[o]}const i=(r-b)/k;E.push(Ue(n*w,(s-1-e)*A,w,A,`rgb(${220-(180*i+.5)|0},${220-(100*i+.5)|0},${255-(50*i+.5)|0})`,{xi:n,yi:e,value:r,count:m[o],sum:v[o]},S?{value:r,showValues:!0,valueFormat:O}:void 0))}}return E}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Ce(e.config.xAccessor,"x"),i=Ce(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.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),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],r=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Qe?e:"blues";let n=Je.get(t);if(n)return n;n=Array(256);const o=Qe[t]||M;for(let e=0;256>e;e++)n[e]=o(e/255);return Je.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),S=255/(w-k||1),O=n.width/u,E=n.height/d,j=e.config.showValues,C=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;P.push(Ue(o*O,(d-1-(n-o)/u)*E,O,E,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:C}:void 0))}return P}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Oe(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const i=[],a=e.scales,[s,l]=a.x.domain();for(const t of o.values()){const o=Math.max(t.start,s),c=Math.min(t.end,l);if(o>=c)continue;const u=a.x(o),d=a.x(c),h=Math.abs(d-u),g=h>2?1:0,f=Math.min(u,d)+g/2,p=Math.max(h-g,1);if(p>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r);i.push(Ve(f,Math.min(l,c),p,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[s])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=a.y(0),n=a.y(t.total);i.push(Ve(f,Math.min(e,n),p,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const a=[],s=e.config.swarmStyle||{},l=null!==(n=s.radius)&&void 0!==n?n:3,c=null!==(o=s.fill)&&void 0!==o?o:"#007bff",u=null!==(r=s.opacity)&&void 0!==r?r:.7,d=s.stroke,h=s.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),s=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const f={type:"point",x:r,y:s,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(f.pointId=e.getPointId(n)+""),a.push(f)}return a}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const a=[],s=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return a;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,f=null==l?void 0:l.strokeWidth;let p=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=p+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=s.x(r),b=0!==m?s.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){p=y;continue}const w=s.y(p),A=s.y(y);a.push(Ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:f},Object.assign(Object.assign({},o),{baseline:p,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),p=y}return a}(i,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const r=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(r||e.getOpen&&e.getClose))return[];const i=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=r?s:a.upColor||"#28a745",c=r?s:a.downColor||"#dc3545",u=r?s:a.wickColor||"#333",d=a.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=r?0:null!==(o=a.bodyWidth)&&void 0!==o?o:0;if(!r&&null==a.bodyWidth&&h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else r||null!=a.bodyWidth||(g=6);for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=r?o:e.getOpen(n),h=r?a:e.getClose(n);if(!r&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};r&&(p.isRange=!0),i.push(p)}return i}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?$e(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const a=new Map;for(let e=0;n.length>e;e++)a.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const s=a.get(t[n]);null!=s?(o[n]=$e(e,s,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(r[n]=$e(e,o,i),1>r[n]&&(s=!0)):r[n]=1}s&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=a.get(n);if(null!=t){const n=$e(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=$e(e,t,i);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const a="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const s=He(e,i,a);s>r&&(r=s)}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=He(e,r,a);i>0&&(n._pulseIntensity=i,n._pulseColor=s,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,a;n.clear(),o.clear();for(let s=0;t.length>s;s++){const l=t[s],c=Ge(e,l,s);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=l.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,M,P,L,_;if(0===o.size&&0===r.size)return n;const T=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let B=!1;const N=new Set,D=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=Ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(D.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];B=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];B=!0}i._targetOpacity=null!==(a=i.style.opacity)&&void 0!==a?a:1,i._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;continue}const S=o.get(A);if("point"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,S.x===e.x&&S.y===e.y&&S.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=S.x,i.y=S.y,i.r=null!==(d=S.r)&&void 0!==d?d:i.r,B=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("rect"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(f=S.w)&&void 0!==f?f:i.w,i.h=null!==(p=S.h)&&void 0!==p?p:i.h,B=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("heatcell"===i.type)if(S){N.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(b=S.w)&&void 0!==b?b:i.w,i.h=null!==(x=S.h)&&void 0!==x?x:i.h,B=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),B=!0}for(const[e,t]of r)if(!D.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}for(const[e,t]of o)if(!N.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(O=t.r)&&void 0!==O?O:3,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(j=t.w)&&void 0!==j?j:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(M=t.opacity)&&void 0!==M?M:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(P=t.w)&&void 0!==P?P:0,h:null!==(L=t.h)&&void 0!==L?L:0,fill:"#999",datum:null,style:{opacity:null!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}B=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),B&&(n.activeTransition={startTime:Re(),duration:T}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,a,s,l;if(!n.activeTransition)return!1;const c=ze(e,n.activeTransition),u=Fe(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=We(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=We(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=We(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==n.w&&(e.w=We(n.w,e._targetW,u)),void 0!==n.h&&(e.h=We(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:We(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==n.w&&(e.w=We(n.w,e._targetW,u)),void 0!==n.h&&(e.h=We(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(s=e._startOpacity)&&void 0!==s?s:0;e.style=Object.assign(Object.assign({},e.style),{opacity:We(t,e._targetOpacity,u)})}const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=We(t[o][0],n[o][0],u),e.path[o][1]=We(t[o][1],n[o][1],u)}else if("area"===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:We(t,e._targetOpacity,u)})}const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=We(t[n][0],o[n][0],u),e.topPath[n][1]=We(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=We(n[t][0],r[t][0],u),e.bottomPath[t][1]=We(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i},i}resolveLineStyle(e,t){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}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2};const r=this.resolveGroupColor(e)||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);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.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);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.buffer.forEach((e,t)=>{r.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++,i}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);void 0!==e.colorScheme&&(this._colorMapCache=null,this._groupColorMap=new Map),void 0===e.barColors&&void 0===e.colorScheme||(this._barCategoryCache=null),void 0===e.normalize&&void 0===e.extentPadding&&void 0===e.xAccessor&&void 0===e.yAccessor&&void 0===e.groupAccessor&&void 0===e.categoryAccessor&&void 0===e.chartType||(this._stackExtentCache=null);let a=!1;Object.assign(this.config,e);const s="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(s||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=s||!Ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=s||!Ee(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),a=!0)}if("groupAccessor"in e&&!Ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Me(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Me(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Me(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,a=!0),"pointIdAccessor"in e&&!Ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Me(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!Ee(e.openAccessor,i.openAccessor)||"closeAccessor"in e&&!Ee(e.closeAccessor,i.closeAccessor)||"highAccessor"in e&&!Ee(e.highAccessor,i.highAccessor)||"lowAccessor"in e&&!Ee(e.lowAccessor,i.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){a=!0;break}}a&&(this.needsFullRebuild=!0)}}function tt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ot(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function rt(e,t){const n=ot(e);if(!n)return!1;const o=ot(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function it(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function at(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=lt(e,t,n,o);r&&o>r.distance&&(i=r,a=!0)}}for(const s of e){let e=null;switch(s.type){case"point":if(r&&a)break;e=lt(s,t,n,o);break;case"line":e=ct(s,t,n,o);break;case"rect":e=dt(s,t,n);break;case"heatcell":e=ht(s,t,n);break;case"area":if(!1===s.interactive)break;e=ft(s,t,n);break;case"candlestick":e=gt(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function st(e,t,n){if(0===e.length)return null;const o=pt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function lt(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function ct(e,t,n,o=30){var r,i,a,s;if(0===e.path.length)return null;const l=pt(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const r=Math.max(0,l-1),i=Math.min(e.path.length-2,l);for(let a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=ut(t,n,r,i,s,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(s=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.lineWidth)&&void 0!==s?s:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function ut(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function dt(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ht(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function gt(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function ft(e,t,n){if(0===e.topPath.length)return null;const o=pt(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function yt(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}function mt(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}function vt(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?bt(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?bt(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function bt(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function xt(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}function kt(e,n,i){const a=t(null),[s,l]=r(null);return o(()=>{if(!n&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,i]),[a,[n&&s?s.w:e[0],i&&s?s.h:e[1]]]}function wt(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}et.QUADTREE_THRESHOLD=500;const At={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function St(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,At[n])(o(e,t)),r}function Ot(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Et(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function Ct(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[f,p]=e.useState(0),y=e.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=St(t,u,d,h),b=Et(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===a&&u===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),f})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const p=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=St(t,u,h,g),k=Et(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&y>0&&y+A>d&&(m++,y=0),p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===a&&u===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=A});let x=0,k=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),f+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${f},0)`},o.items)),f+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8})),f+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function Mt(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let f,p;return"left"===a?(f=4,p=i.top):"top"===a?(f=0,p=s?32:8):"bottom"===a?(f=0,p=r-i.bottom+50):(f=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${f}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(jt,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Ct,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function Pt(e){return"string"==typeof e?{type:e}:e}function Lt({orient:t,config:o,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=a-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),f=(o-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*f,x2:c,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-f-g:m+f,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-f-g:m+f,x2:r,y2:"top"===t?m-f:m+f+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(f+g/2),y1:c,x2:m+y*(f+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:c,x2:m+y*(f+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-f-g:m+f,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-f-g:m+f,y1:r,x2:"left"===t?m-f:m+f+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=T().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _t(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Tt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Bt(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Tt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=a?u?[a]:_t(a,c):[],y=i?u?[i]:_t(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t)))),v=p.length*f),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t))));let k=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),k)}(l,v,b,h))}function Nt(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Dt(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function It(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function $t(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Dt(e,n),c=It(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Ht(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ft={linear:re,monotoneX:oe,monotoneY:ne,step:te,stepAfter:ee,stepBefore:J,basis:Q,cardinal:Z,catmullRom:K};function zt(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,M,P,L,_,T,B,N,D,I,$,H,F,W,R,G,Y,q,X,V,K,Z,Q,J;switch(t.type){case"label":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ht(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ht(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Dt(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=It(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=z(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Dt(n,o),s=It(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Dt(t,o),i=It(t,o);return e.createElement(Nt,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",f=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!y)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?ce.polynomial(f,{order:t.order||2}):ce.linear(f)).points;const b=v.map(([e,t])=>`${p(e)},${y(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:p(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(f=null==r?void 0:r(t.y0))&&void 0!==f?f:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(m=null===(y=o.scales)||void 0===y?void 0:y.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Ft[o.curve||"linear"]||re,g=U().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:f,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==S?S:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(j=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==j?j:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",v=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,b=s(c+h*d),x=s(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},f&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const r=Dt(t,o),i=It(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(T=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(D=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==D?D:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!l)return null;const c=r.map(e=>[e[i],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>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=ce.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),y=null!==($=t.confidence)&&void 0!==$?$:.95,m=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(H=t.steps)&&void 0!==H?H:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(b)},${l(u(b))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(F=t.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:E,strokeWidth:null!==(W=t.strokeWidth)&&void 0!==W?W:2,strokeDasharray:null!==(R=t.strokeDasharray)&&void 0!==R?R:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=$t(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ht(r,i,o))return null;const a=null!==(G=t.dx)&&void 0!==G?G:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(q=t.width)&&void 0!==q?q:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(V=t.content)&&void 0!==V?V:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(K=o.scales)||void 0===K?void 0:K.o,a=null===(Z=o.scales)||void 0===Z?void 0:Z.x,s=null===(Q=o.scales)||void 0===Q?void 0:Q.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(J=t.opacity)&&void 0!==J?J:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===a)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}}}let Wt={positions:new Map};const Rt=new Set;function Gt(){for(const e of Rt)e()}function Yt(e,t){const n=Wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}function qt(e,t){const n=Wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}function Xt(){return Wt}function Vt(e){return Rt.add(e),()=>Rt.delete(e)}const Ut={positions:new Map};function Kt(){return()=>{}}function Zt(){return Ut}function Qt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Jt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function en(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,f=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||tn,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,a)})),c=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);return nn(s,Math.max(55,c+8))},[l,u,h,o]),p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),y=d&&l,m=c&&l;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&(()=>{var t,n;const i=Qt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),a=Qt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},f.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i})),p.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:Jt("bottom",o,r),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:Jt("left",o,r),fill:"none",stroke:S,strokeWidth:1})))}function tn(e,t,n){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 n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function on(r){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:M,marginalGraphics:P,xValues:L,yValues:_,annotations:T,svgAnnotationRules:B,xAccessor:N,yAccessor:D,annotationData:I,pointNodes:$,curve:H,underlayRendered:F,linkedCrosshairName:z,linkedCrosshairSourceId:W,children:R}=r,G=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),s=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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=nn(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[f,g,p,b,l]),Y=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[f,g,p,x,c]),q=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tn,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[f,g,p,x,c]),X=t(new Map),V=t(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),U=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;V.current!==U&&(V.current=U,X.current=new Map);const K=n(()=>{if(!T||0===T.length)return null;const e=zt(),t={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:l,height:c,data:I,frameType:"xy",pointNodes:$,curve:H,stickyPositionCache:X.current};return T.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[T,B,l,c,N,D,I,g,$,H]),Z=function(e){var t;const n=i(e?Vt:Kt,e?Xt:Zt,e?Xt:Zt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(z);return o(()=>{if(!(null==Z?void 0:Z.locked)||!z)return;const e=e=>{"Escape"===e.key&&qt(z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,z]),f||w||A||M||P||K&&K.length>0||k||R||Z?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${h.left},${h.top})`},k&&g&&!F&&(()=>{var t,n;const o=Qt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Qt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},G.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),Y.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r})))})(),f&&g&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,s=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",f="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=l/Math.max(G.length-1,1),t=G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!F&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!F&&a&&e.createElement("path",{d:Jt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):rt(t.value,n>0?G[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),y&&e.createElement("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},y),!F&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!F&&i&&e.createElement("path",{d:Jt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):rt(t.value,n>0?Y[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:l,y1:0,x2:l,y2:c,stroke:d,strokeWidth:1}),q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):rt(t.value,o>0?q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${l},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:l+h.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),K,P&&g&&L&&_&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"top",config:Pt(P.top),values:L,scale:g.x,size:h.top,length:l})),P.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Lt,{orient:"bottom",config:Pt(P.bottom),values:L,scale:g.x,size:h.bottom,length:l})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"left",config:Pt(P.left),values:_,scale:g.y,size:h.left,length:c})),P.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Lt,{orient:"right",config:Pt(P.right),values:_,scale:g.y,size:h.right,length:c}))),M,Z&&Z.sourceId!==W&&(null==g?void 0:g.x)&&(()=>{const t=g.x(Z.xValue);if(null==t||0>t||t>l)return null;const n=Z.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),R),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),Mt({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j})):null}function rn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const an="undefined"==typeof window||"undefined"==typeof document,sn=e.createContext(null);function ln({children:t}){const[n,o]=e.useState(!1),r=e.useMemo(()=>({visible:n,setVisible:o}),[n]);return e.createElement(sn.Provider,{value:r},t)}function cn(){return e.useContext(sn)}const un={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function dn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function hn(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},fn={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"},pn={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},yn={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"},vn={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)"},bn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},xn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function kn({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=cn(),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{a||c||s(!0)},[a,c]),f=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:un}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:un,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const p=function(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const E=[];if(!Array.isArray(e))return E;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":E.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 n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.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 n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.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:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=j.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=j.datum)||void 0===s?void 0:s.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":E.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":E.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":E.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 E}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gn(e.min)} to ${gn(e.max)}, mean ${gn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),v=p.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:fn,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:mn},e.createElement("caption",{style:xn},"First ",v.length," of ",p.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"type"),x.map(t=>e.createElement("th",{key:t,style:vn},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.label),x.map(n=>{return e.createElement("td",{key:n,style:bn},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":gn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function wn({nodes:t,edges:n,chartType:o,tableId:r,chartTitle:i}){var a,s,l,c,u,d,h,g,f,p,y,m,v,b;const[x,k]=e.useState(!1),w=cn(),A=null!==(a=null==w?void 0:w.visible)&&void 0!==a&&a,S=x||A,O=i?"Data summary for "+i:r?`Data summary for ${o} ${r}`:"Data summary for "+o,E=e.useRef(null),j=e.useCallback(()=>{x||A||k(!0)},[x,A]),C=e.useCallback(e=>{var t;A||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[A]);if(!t||0===t.length)return r?e.createElement("span",{id:r,tabIndex:-1,style:un}):null;if(!S)return e.createElement("div",{id:r,tabIndex:-1,onFocus:j,style:un,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",n.length," edges)"));const M=Array.isArray(t)?t:[],P=Array.isArray(n)?n:[],L=new Map,_=new Map,T=new Map,B=new Map;for(const e of P){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";_.set(e,(null!==(u=_.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+r)}if(null!=o&&""!==o){const e=o+"";L.set(e,(null!==(h=L.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(g=T.get(e))&&void 0!==g?g:0)+r)}}const N=[];for(let e=0;M.length>e;e++){const t=M[e];if(!t||"object"!=typeof t)continue;const n=null!==(p=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==p?p:t.id,o=null!=n?n+"":"node-"+e,r=null!==(y=L.get(o))&&void 0!==y?y:0,i=null!==(m=_.get(o))&&void 0!==m?m:0,a=null!==(v=T.get(o))&&void 0!==v?v:0,s=null!==(b=B.get(o))&&void 0!==b?b:0;N.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}N.sort((e,t)=>t.degree-e.degree);let D=0,I=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>I&&(I=t.degree);D=e/N.length}const $=P.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),H=[`${N.length} nodes, ${P.length} edges.`];N.length>0&&H.push(`Mean degree: ${gn(D)}, max degree: ${I}.`);const F=N.slice(0,5);return e.createElement("div",{ref:E,id:r,tabIndex:-1,onBlur:C,style:fn,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>{A&&w&&w.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},H.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+o,style:mn},e.createElement("caption",{style:xn},"Top ",F.length," of ",N.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"id"),e.createElement("th",{style:vn},"degree"),e.createElement("th",{style:vn},"in"),e.createElement("th",{style:vn},"out"),$&&e.createElement("th",{style:vn},"w. degree"),$&&e.createElement("th",{style:vn},"w. in"),$&&e.createElement("th",{style:vn},"w. out"))),e.createElement("tbody",null,F.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.id),e.createElement("td",{style:bn},t.degree),e.createElement("td",{style:bn},t.inDeg),e.createElement("td",{style:bn},t.outDeg),$&&e.createElement("td",{style:bn},gn(t.wDegree)),$&&e.createElement("td",{style:bn},gn(t.wInDeg)),$&&e.createElement("td",{style:bn},gn(t.wOutDeg)))))))}function An({summary:t}){return t?e.createElement("div",{role:"note",style:un},t):null}function Sn({tableId:t}){return e.createElement("a",{href:"#"+t,style:un,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,un)}},"Skip to data table")}function On({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:un},n)}const En="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:En,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Cn({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,s,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Mn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Pn(){const[e,t]=r(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Mn(e,e=>t(e.matches))},[]),e}function Ln(o){const r=a(null),c=_n(o);return[function({children:t}){const i=n(()=>_n(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=s(r))&&void 0!==n?n:c,a=t(e);a.current=e;const u=l(()=>a.current(o.getState()),[o]),d=l(()=>a.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function _n(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Tn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Bn={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Nn={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Dn={mode:"light",colors:{primary:"#0000cc",categorical:Tn,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},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"},[In,$n]=Ln(e=>({theme:Bn,setTheme(t){e(e=>{if("light"===t)return{theme:Bn};if("dark"===t)return{theme:Nn};if("high-contrast"===t)return{theme:Dn};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Nn:Bn;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function Hn(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Fn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}const zn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Wn=new WeakMap;function Rn(e,t){var n,o;if(!t)return t;const r=zn.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;let a=Wn.get(i);if(a||(a=new Map,Wn.set(i,a)),a.has(t))return a.get(t);const s=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.set(t,s),s}function Gn(e){Wn.delete(e)}function Yn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Z;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Q;case"natural":return se;default:return null}}function qn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Xn(e,t,n,o,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Vn=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const p=null!==(r=s.style.opacity)&&void 0!==r?r:1;Xn(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Yn(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,f=s._decayOpacities;if(f&&f.length===s.path.length&&!g){e.strokeStyle=l;const y=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(f[m]+f[m+1])*y,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.path[m+1][1]),e.stroke()}else if(g){let v=null,b=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function S(){w&&(e.stroke(),w=!1)}for(let O=0;s.path.length>O;O++){const[E,j]=s.path[O],C=d[O],M=qn(C,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(E,j);else{const P=[];for(const L of u){const _=L.value;(x>_||_>C)&&(_>x||C>_)||x===_||C===_||P.push({t:(_-x)/(C-x)})}P.sort((e,t)=>e.t-t.t);for(const T of P){const B=v+(E-v)*T.t,N=b+(j-b)*T.t,D=qn(x+(C-x)*Math.min(T.t+1e-4,1),u,l);e.lineTo(B,N),S(),A(D,B,N)}e.lineTo(E,j)}v=E,b=j,x=C,k=M}else A(M,E,j),v=E,b=j,x=C,k=M}S()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=l;else{const I=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const $ of s.strokeGradient.colorStops)I.addColorStop(Math.max(0,Math.min(1,$.offset)),$.color);e.strokeStyle=I}if(h)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[H,F]=s.path[0];e.moveTo(H,F);for(let z=1;s.path.length>z;z++)e.lineTo(s.path[z][0],s.path[z][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=("string"==typeof s.style.fill?Rn(e,s.style.fill):s.style.fill)||s.style.fill,h&&!g)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[R,G]=s.path[0];e.moveTo(R,G);for(let Y=1;s.path.length>Y;Y++)e.lineTo(s.path[Y][0],s.path[Y][1])}const W=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(W,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Un(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Kn(e,t,n=.3){Un(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Zn(e,t,n=.6){var o,r,i,a,s;if(!Un(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Qn(e,t,n,o=.35){Un(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Jn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Z;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Q;case"natural":return se;default:return null}}function eo(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function to(e,t){const n=Jn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=U().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const no=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;const n=t.style.fill||"#4e79a7",o=t._decayOpacities;if(o&&o.length===t.topPath.length){const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=n;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1])*i,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=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const s=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(to(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 r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=e.createLinearGradient(0,o,0,r);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const e=eo("string"==typeof n?n:"#4e79a7");i.addColorStop(0,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=s}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*s,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(to(e,t),Qn(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=s,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Jn(t.curve);if(e.beginPath(),n)ae().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}e.globalAlpha=1}},oo=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Rn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Zn(e,t),e.globalAlpha=1}}finally{e.restore()}}},ro=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)io(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:a}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o,r+a);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+a-n),e.arcTo(o,r+a,o+n,r+a,n),e.lineTo(o+i,r+a);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o+n,r+a),e.arcTo(o,r+a,o,r+a-n,n);break;default:e.moveTo(o,r+a),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+a)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));Kn(e,t),e.globalAlpha=1}};function io(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}function ao(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function so(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function lo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const co=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function uo(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${co[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${co[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const ho={line:[no,Vn,oo],area:[no,oo],stackedarea:[no,oo],scatter:[oo],bubble:[oo],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Kn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):lo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=so(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[ro],swarm:[oo],waterfall:[(e,t,n,o)=>{var r,i,a;ro(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;if(null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke(),t.isRange){const n=Math.max(2*t.wickWidth,4);e.fillStyle=t.wickColor,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}e.restore()}}],mixed:[no,Vn,oo]},go={top:20,right:20,bottom:30,left:40},fo={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"},po={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 yo({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:po},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const mo=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:S,xAccessor:O,yAccessor:E,colorAccessor:j,sizeAccessor:C,groupAccessor:M,lineDataAccessor:P,curve:L,normalize:_,binSize:T,valueAccessor:B,arrowOfTime:N="right",windowMode:D="sliding",windowSize:I=200,timeAccessor:$,xExtent:H,yExtent:F,extentPadding:z=.1,scalePadding:W,sizeRange:R,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:U,lineStyle:K,pointStyle:Z,areaStyle:Q,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:ne,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:ae,lineGradient:se,areaGroups:le,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,showAxes:fe=!0,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:be,yFormat:xe,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,customClickBehavior:Ce,enableHover:Me,hoverRadius:Pe=30,tooltipMode:Le,annotations:_e,svgAnnotationRules:Te,showGrid:Be,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Fe,backgroundGraphics:ze,foregroundGraphics:We,canvasPreRenderers:Re,svgPreRenderers:Ge,title:Ye,categoryAccessor:qe,brush:Xe,onBrush:Ve,decay:Ue,pulse:Ke,transition:Ze,staleness:Qe,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,marginalGraphics:it,pointIdAccessor:lt,xScaleType:ct,yScaleType:ut,accessibleTable:dt=!0,description:ht,summary:gt,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}=i,At=Pn(),St=t(At);St.current=At;const[Ot,Et]=kt(G,Y,q),jt=Object.assign(Object.assign({},go),X);if(it){const e=60;it.top&&e>jt.top&&(jt.top=e),it.bottom&&e>jt.bottom&&(jt.bottom=e),it.left&&e>jt.left&&(jt.left=e),it.right&&e>jt.right&&(jt.right=e)}const Ct=Et[0]-jt.left-jt.right,Mt=Et[1]-jt.top-jt.bottom,Pt="function"==typeof We?We({size:Et,margin:jt}):We,Lt="function"==typeof ze?ze({size:Et,margin:jt}):ze,_t=null!=Oe?Oe:Me,Tt=t(null),Bt=t(null),Nt=t(0),Dt=t(!1),It=$n(e=>e.theme),[$t,Ht]=r(0),[Ft,zt]=r(null),Wt=t(null),Rt=t(null),[Gt,Yt]=r(null),[qt,Xt]=r(!1),[Vt,Ut]=r([]),[Kt,Zt]=r([]),Qt=t(()=>{}),Jt="streaming"===k||["bar","swarm","waterfall"].includes(x),tn=n(()=>({chartType:x,runtimeMode:Jt?"streaming":"bounded",windowSize:I,windowMode:D,arrowOfTime:Jt?N:"right",extentPadding:z,scalePadding:W,xAccessor:Jt?void 0:O,yAccessor:Jt?void 0:E,timeAccessor:Jt?$:void 0,valueAccessor:B,colorAccessor:j,sizeAccessor:C,groupAccessor:M||(P?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:P,xScaleType:ct,yScaleType:ut,xExtent:H,yExtent:F,sizeRange:R,binSize:T,normalize:_,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:!0===ae?{topOpacity:.8,bottomOpacity:.05}:!1===ae?void 0:ae,areaGroups:le?new Set(le):void 0,lineGradient:se,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,lineStyle:K,pointStyle:Z,areaStyle:Q,swarmStyle:ee,waterfallStyle:J,colorScheme:ne,barColors:te,annotations:_e,decay:Ue,pulse:Ke,transition:Ze,staleness:Qe,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,pointIdAccessor:lt,curve:L}),[x,I,D,N,z,W,O,E,$,B,ct,ut,j,C,M,qe,P,H,F,R,T,_,oe,re,ie,ae,se,le,ce,ue,de,he,ge,K,Z,Q,ee,J,ne,te,_e,Ue,Ke,Ze,Qe,Je,tt,nt,ot,rt,Jt,lt,L]),nn=t(null);nn.current||(nn.current=new et(tn));const sn=l(()=>{Nt.current||(Nt.current=requestAnimationFrame(()=>Qt.current()))},[]);o(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),Dt.current=!0,sn()},[tn,sn]),o(()=>{Tt.current&&Gn(Tt.current),Dt.current=!0,sn()},[It,sn]);const ln=t(null);ln.current||(ln.current=new we(e=>{const t=nn.current;t&&t.ingest(e)&&(Dt.current=!0,sn())},{chunkThreshold:A,chunkSize:S})),o(()=>{var e;null===(e=ln.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:S})},[A,S]);const cn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.push(e)},[]),un=l(e=>{var t;null===(t=ln.current)||void 0===t||t.pushMany(e)},[]),hn=l(()=>{var e,t;null===(e=ln.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),Dt.current=!0,sn()},[sn]);u(a,()=>({push:cn,pushMany:un,remove:e=>{var t,n,o;null===(t=ln.current)||void 0===t||t.flush();const r=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(Wt.current&&r.some(e=>{var t;return e===(null===(t=Wt.current)||void 0===t?void 0:t.data)})&&(Wt.current=null,Yt(null)),Dt.current=!0,sn()),r},update:(e,t)=>{var n,o,r;null===(n=ln.current)||void 0===n||n.flush();const i=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(Dt.current=!0,sn()),i},clear:hn,getData:()=>{var e,t,n;return null===(e=ln.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[cn,un,hn,sn]),o(()=>{var e,t;if(w){if(P&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof P?P:"coordinates";if(Array.isArray(w[0][t])){const n=[];for(const e of w){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=ln.current)||void 0===e||e.setBoundedData(n))}}null===(t=ln.current)||void 0===t||t.setBoundedData(w)}},[w,P]);const gn=t(()=>{}),fn=t(()=>{});gn.current=e=>{if(!_t)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Mt)return void(Wt.current&&(Wt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn()));const i=nn.current;if(!i||0===i.scene.length)return;const a=at(i.scene,o,r,Pe,i.quadtree);if(!a)return void(Wt.current&&(Wt.current=null,Rt.current=null,Yt(null),je&&je(null),sn()));const s=ao(a.datum||{},a.x,a.y);if("multi"===Le&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=st(e.path,t,n);if(null===i)continue;const a=pt(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=st(e.topPath,t,n);if(null===i)continue;const a=pt(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.topPath[a][0],y:i,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,a.x,Pe),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(a.x):a.x;s.xValue=o,s.xPx=a.x,s.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}Wt.current=s,Rt.current=a.node,Yt(s),je&&(je(s),Dt.current=!0),sn()},fn.current=()=>{Wt.current&&(Wt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn())},l(e=>gn.current(e),[]);const pn=l(()=>fn.current(),[]),yn=t(()=>{});yn.current=e=>{if(!Ce)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Mt)return void Ce(null);const i=nn.current;if(!i||0===i.scene.length)return void Ce(null);const a=at(i.scene,o,r,Pe,i.quadtree);Ce(a?ao(a.datum||{},a.x,a.y):null)};const mn=l(e=>yn.current(e),[]),vn=t(-1),bn=t(null),xn=t(null),wn=l(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(xn.current&&xn.current.version===n)o=xn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)switch(a.type){case"point":i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(t=a.group)&&void 0!==t?t:"_default"});break;case"line":{const e=a,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=a,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:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(r=a.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=yt(e),xn.current={version:n,graph:o}}const r=vn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),vn.current=0;const t=o.flat[0];bn.current={shape:t.shape,w:t.w,h:t.h};const n=xt(t);return Wt.current=n,Yt(n),je&&je(n),void sn()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return vn.current=-1,bn.current=null,Wt.current=null,Rt.current=null,Yt(null),je&&je(null),void sn();vn.current=a;const s=o.flat[a];bn.current={shape:s.shape,w:s.w,h:s.h};const l=xt(s);Wt.current=l,Yt(l),je&&je(l),sn()},[je,sn]),En=l(e=>{vn.current=-1,bn.current=null,gn.current(e)},[]);Qt.current=()=>{var e,t;Nt.current=0;const n=Tt.current,o=Bt.current;if(!n||!o)return;const r=nn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(St.current?i+1e6:i),s=!St.current&&a,l=Dt.current||a;l&&!s&&r.computeScene({width:Ct,height:Mt});const c=Fn(),u=function(e){if(!e)return fo;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||fo.axisStroke,tickText:i||fo.tickText,crosshair:i?i+"66":fo.crosshair,hoverFill:l?l+"4D":fo.hoverFill,hoverStroke:i?i+"99":fo.hoverStroke,pointRing:l||fo.pointRing}:fo}(n),d=null!==(e=null==Qe?void 0:Qe.threshold)&&void 0!==e?e:5e3,h=Qe&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=Hn(n,Et,jt,c);if(e){e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),h&&(e.globalAlpha=null!==(t=null==Qe?void 0:Qe.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=U||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-jt.left,-jt.top,Et[0],Et[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ct,Mt),e.clip()),Re&&r.scales)for(const t of Re)e.save(),t(e,r.scene,r.scales,{width:Ct,height:Mt}),e.restore();const a=ho[x];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:Ct,height:Mt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Hn(o,Et,jt,c);if(e&&(e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),_t&&Wt.current&&r.scales&&function(e,t,n,o,r,i,a){var s,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||a.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(u?d:t.x,0),e.lineTo(u?d:t.x,o),e.stroke(),u||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),u){e.lineWidth=2,e.strokeStyle=a.pointRing;for(const t of c)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||"#007bff",e.fill(),e.stroke())}else{let n="";try{(null===(l=e.canvas)||void 0===l?void 0:l.parentElement)&&(n=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||n||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,Wt.current,Ct,Mt,"object"==typeof _t?_t:{},Rt.current,u),Rt.current&&Array.isArray(Oe))){const t=Oe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Rt.current,t)}}l&&n&&n.setAttribute("aria-label",dn(r.scene,x+" chart"));const g=Dt.current;if(Dt.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Ft||e(Ft.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Ft.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Ft.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Ft.y.domain()[1])!==e(r.scales.y.domain()[1])||Ft.x.range()[0]!==r.scales.x.range()[0]||Ft.x.range()[1]!==r.scales.x.range()[1]||Ft.y.range()[0]!==r.scales.y.range()[0]||Ft.y.range()[1]!==r.scales.y.range()[1])&&zt(r.scales),it){const e=r.getData(),t="function"==typeof O?O:e=>e[O||"x"],n="function"==typeof E?E:e=>e[E||"y"];Ut(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Zt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&_e&&_e.length>0&&Ht(e=>e+1),(null==Qe?void 0:Qe.showBadge)&&Xt(!!h),(s||r.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Qt.current()))},o(()=>(sn(),()=>{Nt.current&&(cancelAnimationFrame(Nt.current),Nt.current=0)}),[sn]),o(()=>{Dt.current=!0,sn()},[x,Ct,Mt,fe,U,K,Re,sn]),wt(Qe,nn,Dt,sn,qt,Xt);const Mn=n(()=>{if(be||Ae)return;const e=nn.current;return(null==e?void 0:e.xIsDate)&&Ft?uo(Ft.x.domain()):void 0},[be,Ae,Ft]),Ln=be||Ae||Mn,_n=_t&&Gt?Ee?Ee(Gt):e.createElement(yo,{hover:Gt}):null,Tn=_n?e.createElement(Cn,{x:Gt.x,y:Gt.y,containerWidth:Ct,containerHeight:Mt,margin:jt,className:"stream-frame-tooltip"},_n):null,Bn=bn.current,Nn=e.createElement(jn,{active:vn.current>=0,hoverPoint:Gt,margin:jt,size:Et,shape:null==Bn?void 0:Bn.shape,width:null==Bn?void 0:Bn.w,height:null==Bn?void 0:Bn.h}),Dn=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},In=Dn(O,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),zn=Dn(E,B,"__semiotic_resolvedY","__semiotic_resolvedValue"),Wn=In.key,Rn=zn.key,Yn=_e&&_e.length>0,qn=e=>{if(!e||!Yn||!In.fn&&!zn.fn)return e;let t=!1;const n=e.map(e=>{const n=In.fn&&In.key&&!(In.key in e),o=zn.fn&&zn.key&&!(zn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[In.key]=In.fn(e)),o&&(r[zn.key]=zn.fn(e)),r});return t?n:e};if(an){const t=nn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Ct,height:Mt}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=Ln||(()=>{if((null==t?void 0:t.xIsDate)&&o)return uo(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:Et[0],height:Et[1]}},e.createElement(An,{summary:gt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Et[0],height:Et[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt),e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},U&&e.createElement("rect",{x:0,y:0,width:Ct,height:Mt,fill:U}),Ge&&o&&Ge.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Ct,height:Mt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const a=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),s=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${a}L${s}Z`,fill:rn(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:rn(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,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]}(o.fill),s=.299*r+.587*i+.114*a>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),a=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:a,stroke:a,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(on,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:o,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:r,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Fe,foregroundGraphics:Pt,marginalGraphics:it,xValues:[],yValues:[],annotations:_e,svgAnnotationRules:Te,annotationFrame:0,xAccessor:Wn,yAccessor:Rn,annotationData:qn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}))}const Xn="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ot,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Et[0],height:q?"100%":Et[1],overflow:"visible"},onKeyDown:wn},dt&&e.createElement(Sn,{tableId:Xn}),dt&&e.createElement(kn,{scene:null!==(h=null===(d=nn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:Xn,chartTitle:"string"==typeof Ye?Ye:void 0}),e.createElement(An,{summary:gt}),e.createElement("div",{role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?En:void 0,onMouseLeave:_t?pn:void 0,onClick:Ce?mn:void 0},Lt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Et[0],height:Et[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt)),e.createElement(en,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Ft,showAxes:fe,axes:pe,showGrid:Be,xFormat:Ln,yFormat:xe||Se}),e.createElement("canvas",{ref:Tt,"aria-label":dn(null!==(f=null===(g=nn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(On,{hoverPoint:Gt}),e.createElement(on,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Ft,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:Ln,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Fe,foregroundGraphics:Pt,marginalGraphics:it,xValues:Vt,yValues:Kt,annotations:_e,svgAnnotationRules:Te,annotationFrame:$t,xAccessor:Wn,yAccessor:Rn,annotationData:qn(null===(p=nn.current)||void 0===p?void 0:p.getData()),pointNodes:null===(y=nn.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,underlayRendered:!0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}),(Xe||Ve)&&e.createElement(ke,{width:Ct,height:Mt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,dimension:null!==(m=null==Xe?void 0:Xe.dimension)&&void 0!==m?m:"xy",scales:Ft,onBrush:null!=Ve?Ve:()=>{},binSize:T,snap:null==Xe?void 0:Xe.snap,binBoundaries:null!==(v=null==Xe?void 0:Xe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=nn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Xe?void 0:Xe.snapDuring,streaming:"streaming"===k}),(null==Qe?void 0:Qe.showBadge)&&e.createElement("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}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qt?"#dc3545":"#28a745",color:"white"})},qt?"STALE":"LIVE"),Nn,Tn))});function vo(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function bo(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=B(e,.25))&&void 0!==t?t:i,median:null!==(n=B(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=B(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}mo.displayName="StreamXYFrame";const xo={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,getStack:s,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,f=i.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=a(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of p){const a=t.get(i);if(!a)continue;let u=a.total;f&&n>0&&(u/=n);const p=l(a.pieces[0],s?i:e.name),y=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(Ve(e.x,t,e.width,Math.abs(n),p,y,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(Ve(t,e.x,Math.abs(n),e.width,p,y,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),g=s(r,h[a]);if(d){const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(i,Math.min(s,d),o,Math.abs(s-d),g,r,h[a]))}else{const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(Math.min(s,d),i,Math.abs(d-s),o,g,r,h[a]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:vo,donut:vo,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,f=[],p="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=B(t,.25))&&void 0!==n?n:s,g=null!==(o=B(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=B(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,w=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,A=d(e.pieceData[0],e.name),S=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(w),stats:{n:t.length,min:k,q1:c,median:g,q3:m,max:w,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:S}),y)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){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 i=t[0],a=t[t.length-1],s=(a-i)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;f>t;t++){const n=u(i+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(i+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=B(t,.25))&&void 0!==n?n:i,l=null!==(o=B(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=B(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:bo(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,p=Math.max(...i,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/p)*e.width*.9,a=l(n+t*r),s=l(n+(t+1)*r);c.push(Ve(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/f*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:bo(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Ve(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Ve(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,a,s,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,g=[],f=t.width/2,p=!1!==e.config.showLabels,y=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===y.length)return g;const v=[],b=new Set;for(const e of y)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let w=0;for(const e of y){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}k.push({col:e,groups:t,stepTotal:n}),x||n>w&&(w=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>w&&(w=o)}if(0===w)return g;const A=new Map;for(const e of v){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,O=x?.95*f:.9*t.width,E=m().domain([0,w]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let e=0;k.length>e;e++){const t=k[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,y=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=f,i=f;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const k=h(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,S=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:S,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=f,O.__funnelStepLabelY=d,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+m/2,O.__funnelValueLabelY=d,O.__funnelBarW=m),g.push(Ve(x,d,m,u,k,O,l)),y.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,a=E(e),s=f-a/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});p&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=f,w.__funnelStepLabelY=d,w.__funnelRowWidth=a,w.__funnelValueLabelX=f,w.__funnelValueLabelY=d,w.__funnelBarW=a),g.push(Ve(s,d,a,u,x,w,b)),y.set(l,{x:s,y:d,w:a,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=y.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),a={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:j},datum:null!==(l=null===(s=t.groups.get(o))||void 0===s?void 0:s.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};g.push(a)}}C=y}return g},"bar-funnel":function(e,t){var n,o,r,i;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[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 n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=s(o);r.total+=i,r.pieces.push(o),n+=i}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-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!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(i=null==k?void 0:k.total)&&void 0!==i?i:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),E=v(0)-O,j=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ve(S,O,u,E,j,C,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),r=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ve(S,e,u,t,o,r,p?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=a(n,l);if(u){const r=s(t),i=s(t+o);c.push(Ve(r,e.x,i-r,e.width,d,n,l))}else{const r=s(t+o),i=s(t);c.push(Ve(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class ko{constructor(e){this.rExtent=new Se,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.version=0,this.config=e,this.buffer=new Ae(e.windowSize),this.getO=Me(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new Se)):(this.getR=je(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Me(e.stackBy),this.getGroup=Me(e.groupBy),this.getColor=Me(e.colorAccessor),this.getConnector=Me(e.connectorAccessor),this.getDataId=Me(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),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.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=x().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(a).range([o,n])}else s?(c=x().domain(i).range([0,e.height]).padding(l),u=m().domain(a).range([0,e.width])):(c=x().domain(i).range([0,e.width]).padding(l),u=m().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const a=this.rExtents[r];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)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"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}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){if(!this.scales)return[];const n=this.getSceneContext(),o=xo[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}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 n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}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 n=this.config.decay;return n&&t>1?$e(n,e,t):1}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._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(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=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 g=!1;const f=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(f.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(f.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)f.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:Re(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=ze(e,this.activeTransition),i=Fe(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 o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=We(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=We(o.x,e._targetX,i),e.y=We(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=We(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=We(n.x,e._targetX,i),e.y=We(n.y,e._targetY,i),void 0!==n.w&&(e.w=We(n.w,e._targetW,i),e.h=We(n.h,e._targetH,i))}}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)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}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}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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!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.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(Ee(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Me(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!Ee(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Se)):(this.getR=je(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ee(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Me(this.config.stackBy):void 0),"groupBy"in e&&!Ee(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Me(this.config.groupBy):void 0),"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Me(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ee(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Me(this.config.connectorAccessor):void 0)}}function wo(e,t,n){const o=tt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Ao(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function So(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))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 Oo(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>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 r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Eo(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function jo(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Co)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.createElement("svg",{width:i,height:a,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&e.createElement("g",{className:"ordinal-grid"},p.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:o,y2:f?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,f?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Co(e){return Math.round(100*e)/100+""}function Mo(o){var r,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:f,rLabel:p,oFormat:y,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",foregroundGraphics:E,annotations:j,svgAnnotationRules:C,xAccessor:M,yAccessor:P,annotationData:L,underlayRendered:_,children:T}=o,B="radial"===(null==d?void 0:d.projection),N="horizontal"===(null==d?void 0:d.projection),D=!1!==g,I=n(()=>h&&D&&d&&!B?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:y?y(e,t):e}}):[],[h,D,d,y,B]),$=o.rTickValues,H=o.tickLabelEdgeAlign,F=n(()=>h&&d&&!B?($||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Co)(e)})):[],[h,d,m,B,$]),z=t(new Map),W=t(null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0),R=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;W.current!==R&&(W.current=R,z.current=new Map);const G=n(()=>{if(!j||0===j.length)return null;const e=zt(),t="horizontal"===(null==d?void 0:d.projection),n=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,o={scales:d?{x:t?d.r:n||d.r,y:t&&n||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:M,yAccessor:P,width:a,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:z.current};return j.map((t,n)=>{if(C){const r=C(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[j,C,a,s,d,M,P,L]);return h||b||x||E||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!B&&!_&&e.createElement("g",{className:"ordinal-grid"},F.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:N?t.pixel:0,y1:N?0:t.pixel,x2:N?t.pixel:a,y2:N?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!B&&e.createElement("g",{className:"ordinal-axes"},N?e.createElement(e.Fragment,null,!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&a-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),F.map((t,n)=>{const o=H?0===n?"start":n===F.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p)):e.createElement(e.Fragment,null,!_&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):s,n=0>t||t>s?s:t;return e.createElement("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))),G,E,T),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),Mt({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:O,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}function Po({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,onBrush:c}){const u=t(null),d=t(null),p=t(c);p.current=c;const y=t(l);y.current=l;const m=t(!1),v=t(null),b="horizontal"===(null==l?void 0:l.projection),x=t(b);return x.current=b,o(()=>{if(!u.current)return;const e=h(u.current).select(".brush-g"),t=b?g():f();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(m.current)return;const t=y.current;if(!t)return;if(!e.selection)return v.current=null,void p.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};v.current=i,p.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,b]),o(()=>{if(!l||!d.current||!v.current)return;if(!u.current)return;const e=v.current,t=h(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(m.current=!0,t.call(d.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(d.current.move,[o,n]),m.current=!1)},[l,b]),e.createElement("svg",{ref:u,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}}))}function Lo(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 _o(e,t){const n=ie().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const To=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),_o(e,t)):(Lo(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Lo(e,t),Qn(e,t)),e.globalAlpha=1},Bo=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},No=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=Rn(e,n.style.stroke)||("string"==typeof n.style.fill?Rn(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}};function Do(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 Io(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let $o=null;function Ho(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):($o||($o=document.createElement("canvas")),$o.width=e,$o.height=e,$o)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Fo=new Map;function zo(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Fo.get(n);if(void 0!==o)return o;const r=Ho({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Fo.set(n,r),r}function Wo(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Ro(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 Go(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Yo=e=>[No,...e],qo={bar:Yo([ro]),clusterbar:Yo([ro]),point:Yo([oo]),swarm:Yo([oo]),pie:[To],donut:[To],boxplot:Yo([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(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(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},oo]),violin:Yo([Bo]),histogram:Yo([ro]),ridgeline:Yo([Bo]),timeline:Yo([ro]),funnel:[ro,(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Do(r):null!=i?`${Do(r)} (${Io(i)})`:Do(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Do(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s: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":[ro,(e,t,n,o)=>{var r,i;const a=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 a){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=zo(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,a=i?Go(r):"",s=Ro(o);e.font="bold 13px sans-serif";const l=i?e.measureText(a).width:0;e.font="11px sans-serif";const c=e.measureText(s).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,f=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Wo(e,g,f,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Wo(e,g,f,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(a,h,f+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(s,h,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(s,h,f+3))}e.lineWidth=1}}],swimlane:Yo([ro])},Xo={top:50,right:40,bottom:60,left:70},Vo={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 Uo({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:Vo},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Vo},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Vo},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Vo},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Vo},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Vo},f&&e.createElement("div",{style:{fontWeight:"bold"}},f+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Ko=c(function(i,a){var s,c,d,h,g,f,p,y,m,v;const{chartType:b,runtimeMode:x,data:k,oAccessor:w="category",rAccessor:A="value",colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:C,valueAccessor:M,categoryAccessor:P,projection:L="vertical",size:_=[600,400],responsiveWidth:T,responsiveHeight:B,margin:N,barPadding:D,roundedTop:I,baselinePadding:$,innerRadius:H,cornerRadius:F,normalize:z,startAngle:W,sweepAngle:R,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Z,connectorStyle:Q,dataIdAccessor:J,rExtent:ee,oExtent:te,extentPadding:ne=.05,oSort:oe,windowMode:re="sliding",windowSize:ae=200,pieceStyle:se,summaryStyle:le,colorScheme:ce,barColors:ue,showAxes:de=!0,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,rTickValues:me,tickLabelEdgeAlign:ve,enableHover:be=!0,hoverAnnotation:xe,tooltipContent:ke,customHoverBehavior:Ae,annotations:Se,svgAnnotationRules:Oe,showGrid:Ee=!1,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,legendPosition:_e,backgroundGraphics:Te,foregroundGraphics:Be,title:Ne,className:De,background:Ie,centerContent:$e,decay:He,pulse:Fe,transition:ze,staleness:We,brush:Re,onBrush:Ge,accessibleTable:Ye=!0,description:qe,summary:Xe}=i,Ve=Pn(),Ue=t(Ve);Ue.current=Ve;const[Ke,Ze]=kt(_,T,B),Qe=n(()=>Object.assign(Object.assign({},Xo),N),[N]),Je=Ze[0]-Qe.left-Qe.right,et=Ze[1]-Qe.top-Qe.bottom,tt="function"==typeof Be?Be({size:Ze,margin:Qe}):Be,nt=t(null),ot=t(!0),rt=$n(e=>e.theme),it=t(0),at=t(null),st=t(()=>{}),[lt,ct]=r(null),[ut,dt]=r(null),[ht,gt]=r(0),[ft,pt]=r(!1),bt=be||xe,At="streaming"===x,St=n(()=>({chartType:b,runtimeMode:At?"streaming":"bounded",windowSize:ae,windowMode:re,extentPadding:ne,projection:L,oAccessor:At?void 0:w,rAccessor:At?void 0:A,colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:At?C:void 0,valueAccessor:At?M||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:At?P||w:void 0,rExtent:ee,oExtent:te,barPadding:D,roundedTop:I,baselinePadding:$,innerRadius:H,cornerRadius:F,normalize:z,startAngle:W,sweepAngle:R,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Z,connectorStyle:Q,dataIdAccessor:J,oSort:oe,pieceStyle:se,summaryStyle:le,colorScheme:ce,barColors:ue,decay:He,pulse:Fe,transition:ze,staleness:We}),[b,ae,re,ne,L,w,A,S,O,E,j,C,M,P,ee,te,D,I,$,H,F,z,W,R,G,Y,q,X,V,U,K,Z,Q,J,oe,se,le,ce,ue,He,Fe,ze,We,At]),Ot=t(null);Ot.current||(Ot.current=new ko(St));const Et=l(()=>{it.current||(it.current=requestAnimationFrame(()=>st.current()))},[]);o(()=>{var e;null===(e=Ot.current)||void 0===e||e.updateConfig(St),ot.current=!0,Et()},[St,Et]),o(()=>{nt.current&&Gn(nt.current),ot.current=!0,Et()},[rt,Et]);const jt=t(null);jt.current||(jt.current=new we(e=>{const t=Ot.current;t&&t.ingest(e)&&(ot.current=!0,Et())}));const Ct=l(e=>{var t;null===(t=jt.current)||void 0===t||t.push(e)},[]),Mt=l(e=>{var t;null===(t=jt.current)||void 0===t||t.pushMany(e)},[]),Pt=l(()=>{var e,t;null===(e=jt.current)||void 0===e||e.clear(),null===(t=Ot.current)||void 0===t||t.clear(),ot.current=!0,Et()},[Et]);u(a,()=>({push:Ct,pushMany:Mt,remove:e=>{var t,n,o,r;null===(t=jt.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Ot.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=at.current)||void 0===r?void 0:r.data;!!at.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(at.current=null,ct(null)),ot.current=!0,Et()}return i},update:(e,t)=>{var n,o,r;null===(n=jt.current)||void 0===n||n.flush();const i=null!==(r=null===(o=Ot.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(ot.current=!0,Et()),i},clear:Pt,getData:()=>{var e,t,n;return null===(e=jt.current)||void 0===e||e.flush(),null!==(n=null===(t=Ot.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ot.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Ct,Mt,Pt,Et]),o(()=>{var e;k&&(null===(e=jt.current)||void 0===e||e.setBoundedData(k))},[k]);const Lt=t(()=>{}),_t=t(()=>{});Lt.current=e=>{if(!bt)return;const t=nt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Qe.left,r=e.clientY-n.top-Qe.top;if(0>o||o>Je||0>r||r>et)return void(at.current&&(at.current=null,ct(null),Ae&&Ae(null),Et()));const i=Ot.current;if(!i||0===i.scene.length)return;const a="radial"===L,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=wo(i,t,n);break;case"point":e=Ao(i,t,n,o);break;case"wedge":e=So(i,t,n);break;case"boxplot":e=Oo(i,t,n);break;case"violin":e=Eo(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Je/2:o,a?r-et/2:r);if(!s)return void(at.current&&(at.current=null,ct(null),Ae&&Ae(null),Et()));const l=ao(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b}));at.current=l,ct(l),Ae&&(Ae(l),ot.current=!0),Et()},_t.current=()=>{at.current&&(at.current=null,ct(null),Ae&&(Ae(null),ot.current=!0),Et())},l(e=>Lt.current(e),[]);const Tt=l(()=>_t.current(),[]),Bt=t(-1),Nt=t(null),Dt=t(null),It=l(e=>{const t=Ot.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Dt.current&&Dt.current.version===n)o=Dt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)if("rect"===a.type&&null!=a.x){const e=null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=a.group)&&void 0!==o?o:e})}else if("point"===a.type)i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(r=a.group)&&void 0!==r?r:"_default"});else if("wedge"===a.type&&null!=a.cx){const e=((a.startAngle||0)+(a.endAngle||0))/2,t=((a.innerRadius||0)+(a.outerRadius||50))/2;i.push({x:a.cx+Math.cos(e)*t,y:a.cy+Math.sin(e)*t,datum:a.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;o=yt(e),Dt.current={version:n,graph:o}}const r=Bt.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Bt.current=0;const t=o.flat[0];Nt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},xt(t)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return at.current=n,ct(n),Ae&&Ae(n),void Et()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return Bt.current=-1,Nt.current=null,at.current=null,ct(null),Ae&&Ae(null),void Et();Bt.current=a;const s=o.flat[a];Nt.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},xt(s)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});at.current=l,ct(l),Ae&&Ae(l),Et()},[Ae,Et]),$t=l(e=>{Bt.current=-1,Nt.current=null,Lt.current(e)},[]);st.current=()=>{var e,t;it.current=0;const n=nt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Ot.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(Ue.current?i+1e6:i),s=!Ue.current&&a,l=ot.current;l&&!a&&(r.computeScene({width:Je,height:et}),ot.current=!1),(l||s)&&n.setAttribute("aria-label",dn(r.scene,b+" chart"));const c=Fn(),u=Ze[0]*c,d=Ze[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ze[0]+"px",n.style.height=Ze[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ze[0],Ze[1]);const h=null!==(e=null==We?void 0:We.threshold)&&void 0!==e?e:5e3,g=We&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==We?void 0:We.dimOpacity)&&void 0!==t?t:.5);const f=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=Ie||(f&&"transparent"!==f?f:null);p&&(o.fillStyle=p,o.fillRect(0,0,Ze[0],Ze[1]));const y="radial"===L;o.save(),o.beginPath(),o.rect(Qe.left,Qe.top,Je,et),o.clip(),y?(o.save(),o.translate(Qe.left+Je/2,Qe.top+et/2)):o.translate(Qe.left,Qe.top);const m=qo[b]||[],v={width:Je,height:et};for(const e of m)e(o,r.scene,r.scales,v);y&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(dt(r.scales),gt(e=>e+1)),(null==We?void 0:We.showBadge)&&pt(!!g),(s||r.hasActivePulses)&&(it.current=requestAnimationFrame(()=>st.current()))},o(()=>(Et(),()=>{it.current&&(cancelAnimationFrame(it.current),it.current=0)}),[Et]),o(()=>{ot.current=!0,Et()},[b,Je,et,de,Ie,Et]),wt(We,Ot,ot,Et,ft,pt);const Ht=bt&&lt?ke?ke(lt):e.createElement(Uo,{hover:lt}):null,Ft="radial"===L,zt=Ht?e.createElement(Cn,{x:lt?Ft?lt.x+Je/2:lt.x:0,y:lt?Ft?lt.y+et/2:lt.y:0,containerWidth:Je,containerHeight:et,margin:Qe,className:"stream-ordinal-tooltip"},Ht):null;if(an){const t=Ot.current;t&&k&&(t.ingest({inserts:k,bounded:!0}),t.computeScene({width:Je,height:et}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===L,i=r?Qe.left+Je/2:Qe.left,a=r?Qe.top+et/2:Qe.top;return e.createElement("div",{className:"stream-ordinal-frame"+(De?" "+De:""),role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:Ze[0],height:Ze[1]}},e.createElement(An,{summary:Xe}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ze[0],height:Ze[1],style:{position:"absolute",left:0,top:0}},Te&&e.createElement("g",{transform:`translate(${Qe.left},${Qe.top})`},Te),e.createElement("g",{transform:`translate(${i},${a})`},Ie&&e.createElement("rect",{x:0,y:0,width:Je,height:et,fill:Ie}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:a}=n;let s;switch(n.roundedEdge){case"right":s=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o},${r+a} Z`;break;case"left":s=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+a-t} A${t},${t} 0 0 0 ${o+t},${r+a} L${o+i},${r+a} Z`;break;case"bottom":s=`M${o},${r} L${o+i},${r} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o+t},${r+a} A${t},${t} 0 0 1 ${o},${r+a-t} Z`;break;default:s=`M${o},${r+a} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a} Z`}return e.createElement("path",{key:u,d:s,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:rn(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=ie().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:rn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:rn(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:rn(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:rn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:rn(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Mo,{width:Je,height:et,totalWidth:Ze[0],totalHeight:Ze[1],margin:Qe,scales:o,showAxes:de,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,rTickValues:me,tickLabelEdgeAlign:ve,showGrid:Ee,title:Ne,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,legendPosition:_e,foregroundGraphics:tt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:0,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),$e&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Qe.left+Je/2,top:Qe.top+et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},$e))}const Wt="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ke,className:"stream-ordinal-frame"+(De?" "+De:""),role:"group","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Ze[0],height:B?"100%":Ze[1],overflow:"visible"},onKeyDown:It},Ye&&e.createElement(Sn,{tableId:Wt}),Ye&&e.createElement(kn,{scene:null!==(h=null===(d=Ot.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Wt,chartTitle:"string"==typeof Ne?Ne:void 0}),e.createElement(An,{summary:Xe}),e.createElement("div",{role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:bt?$t:void 0,onMouseLeave:bt?Tt:void 0},Te&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ze[0],height:Ze[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Qe.left},${Qe.top})`},Te)),e.createElement(jo,{width:Je,height:et,totalWidth:Ze[0],totalHeight:Ze[1],margin:Qe,scales:ut,showAxes:de,showGrid:Ee,rFormat:ye,rTickValues:me}),e.createElement("canvas",{ref:nt,"aria-label":dn(null!==(f=null===(g=Ot.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:Ze[0],height:Ze[1]}}),e.createElement(On,{hoverPoint:lt}),e.createElement(Mo,{width:Je,height:et,totalWidth:Ze[0],totalHeight:Ze[1],margin:Qe,scales:ut,showAxes:de,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,showGrid:Ee,title:Ne,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,legendPosition:_e,foregroundGraphics:tt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:ht,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(p=Ot.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),(Re||Ge)&&"radial"!==L&&e.createElement(Po,{width:Je,height:et,totalWidth:Ze[0],totalHeight:Ze[1],margin:Qe,scales:ut,onBrush:Ge||(()=>{})}),$e&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Qe.left+Je/2,top:Qe.top+et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},$e),(null==We?void 0:We.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===We.badgePosition?{top:4,left:4}:"bottom-left"===We.badgePosition?{bottom:4,left:4}:"bottom-right"===We.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ft?"#dc3545":"#28a745",color:"white"})},ft?"STALE":"LIVE"),e.createElement(jn,{active:Bt.current>=0,hoverPoint:lt,margin:Qe,size:Ze,shape:null===(y=Nt.current)||void 0===y?void 0:y.shape,width:null===(m=Nt.current)||void 0===m?void 0:m.w,height:null===(v=Nt.current)||void 0===v?void 0:v.h}),zt))});Ko.displayName="StreamOrdinalFrame";const Zo={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Qo={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Jo{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=er(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function er(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=tr(l,c,u,d,s),g=d.x-l.x,f=d.y-l.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;h.x+=-f/p*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=tr(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function tr(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function nr(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function or(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var f=i[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}i[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(r[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[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),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];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:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];i[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function rr(e){return e.y0-e.y1>0?"up":"down"}function ir(e,t){return t(e.source)==t(e.target)}function ar(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function sr(e){return e.target.x0-e.source.x1}function lr(e,t){var n=ur(e),o=sr(t)/Math.tan(n);return"up"==rr(e)?e.y1-o:e.y1+o}function cr(e,t){var n=ur(e),o=sr(t)/Math.tan(n);return"up"==rr(e)?e.y1+o:e.y1-o}function ur(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function dr(e,t){return t(e)}function hr(e){return fr(e.source)}function gr(e){return fr(e.target)}function fr(e){return(e.y0+e.y1)/2}function pr(e){return e.virtual?0:e.value}function yr(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!ir(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!ir(e,t)?o+1:o}),n+o}function mr(e){return e.target.depth}function vr(e,t){return e.sourceLinks.length?e.depth:t-1}function br(e,t){return e.y0-t.y0}function xr(e,t){return t.y0-e.y0}function kr(e,t){return e.y1-t.y1}function wr(e,t){return t.y1-e.y1}function Ar(e,t){return Or(e.source,t.source)||e.index-t.index}function Sr(e,t){return Or(e.target,t.target)||e.index-t.index}function Or(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Er(e,t){return jr(e)==jr(t)?"bottom"==e.circularLinkType?xr(e,t):br(e,t):jr(t)-jr(e)}function jr(e){return e.target.column-e.source.column}function Cr(e,t){return Mr(e)==Mr(t)}function Mr(e){return e.y0-e.y1>0?"up":"down"}function Pr(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=N(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.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}),Lr(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Lr(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,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,ir(e,t)&&ar(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+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-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?xr:br);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?wr:kr),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-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,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function Lr(e,t,n){e.sort(Er);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(ir(e,t)&&ar(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&_r(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function _r(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Tr(e){return function(){return e}}function Br(e){return e.index}function Nr(e){return e.nodes}function Dr(e){return e.links}function Ir(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=fr(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=fr(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=o.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(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?yr(t,n)-yr(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==yr(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function $r(e,t,n,o,r,i){var a=D(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 s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&yr(r,n)>0){var l=H(r.sourceLinks,gr),c=H(r.targetLinks,hr),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-fr(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=H(r.sourceLinks,gr),g=H(r.targetLinks,hr),f=((h&&g?(h+g)/2:h||g)-fr(r))*t;r.y0+=f,r.y1+=f}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Or),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function Hr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Sr),e.targetLinks.sort(Ar)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function Fr(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=Br,l=vr,c=void 0,u=32,d=2,h=Nr,g=Dr;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=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return F(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=nr(n,o)),"object"!=typeof r&&(r=e.target=nr(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=or(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){dr(e,t)!=dr(r.source,t)&&dr(e,t)!=dr(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),ir(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max($(e.sourceLinks,pr),$(e.targetLinks,pr)),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,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var f=D(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=I(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=D(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 r=N(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/$(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=I(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),Ir(h,c,s),$r(h,c,s,g,g,u),Hr(h),Pr(h,s,d,10,8),Ir(h,c,s),$r(h,c,s,g,g,u),Hr(h),Pr(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return dr(n.source,t)==dr(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Cr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=lr(t,e);return e.y1-n}if(t.target.column>e.target.column)return lr(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 i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return dr(n.target,t)==dr(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Cr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=cr(t,e);return e.y0-n}if(t.source.column>e.source.column)return cr(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 i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=N(t,function(e){return e.y0}),a=I(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Pr(h,s,d,10,8)}(f),f}return f.update=function(e){return Hr(e),Pr(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(r=+e,f):r},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Tr(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:Tr(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Tr(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Tr(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(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],f):[[e,t],[n,o]]},f.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],f):[n-e,o-t]},f}const zr=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ue(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=ue(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function Wr(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const Rr=new Set,Gr=new WeakMap;function Yr(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=Gr.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,Gr.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;Rr.has(e)||(Rr.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const qr={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(mr))-1:0},justify:vr},Xr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,f=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=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 v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=Fr().extent(v).links(m).nodes(y).nodeAlign(qr[h]||vr).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.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 m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=k.get(e._edgeKey?e._edgeKey:`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:_,f=new Map;e.forEach((e,t)=>{f.set(e.id,g[t%g.length])});const p=[],y=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(Yr(t,"nodeStyle")):{},r={fill:o.fill||f.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};v.set(t.id,("string"==typeof r.fill?r.fill:null)||f.get(t.id)||"#4d430c"),p.push("down"===l?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const b=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of b){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 o="#999";o="function"==typeof h?h(e)||o:"target"===h?v.get(n.id)||f.get(n.id)||o:v.get(t.id)||f.get(t.id)||o;const r=u?u(Yr(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?Wr(e):zr(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};y.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:y,labels:m}}},Vr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__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),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=Ur(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const r=Kr(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=Kr(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const g=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=Zr(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=de().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),o=he().force("charge",ge().strength(e=>-25*y(e))).force("center",fe(s,l).strength(.8)).force("x",pe(s).strength(.15)).force("y",ye(l).strength(.15));if(o.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}));o.force("link",n),o.force("link").links(e)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.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(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=Zr(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:_,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],f=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(Yr(t,"nodeSize")),n=s?s(Yr(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(Yr(e,"edgeStyle")):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(Yr(n,"nodeSize"));f.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:g,labels:f}}};function Ur(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function Kr(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Zr(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=N(a))&&void 0!==o?o:0,l=null!==(r=I(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=m().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const Qr=_,Jr={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.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,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const y=ve().padAngle(r);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=ie().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.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,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}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 m){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:Qr,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=me().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(Yr(n,"nodeStyle")).fill||y.get(n.id)||p[t%p.length]:y.get(n.id)||p[t%p.length];const a=h?h(Yr(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=ei(n,u,d);let r="#999";if(g)r=g(Yr(e,"edgeStyle")).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===f&&n?r=y.get(n.id)||r:t&&(r=y.get(t.id)||r)}const a=g?g(Yr(e,"edgeStyle")):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function ei(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const ti=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function ni(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}function oi(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function ri(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function ii(e){return Array.isArray(e.colorScheme)?e.colorScheme:ti}function ai(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:"#4d430c"}function si(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const li={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>{var t;return null!==(t=e[l])&&void 0!==t?t:0}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0},u=W(i,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=V();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=X();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=Y().size([n,o]).tile(q).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;R().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,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 o=g[t],i={id:oi(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?ci(i,o,n):"treemap"===a||"partition"===a?ui(i,o):"circlepack"===a&&di(i,o),i.__hierarchyNode=o,e.push(i),f.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],f=n.treeOrientation||"vertical",p="radial"===f,y=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;p&&(e+=y,o+=m);const i=r(Yr(t,"nodeStyle"));let s=i.fill||ai(n);if(n.colorByDepth&&void 0!==t.depth){const e=ii(n);s=e[t.depth%e.length]}const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=n.edgeOpacity)&&void 0!==s?s:.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 o=t.x,r=t.y,a=n.x,s=n.y;p&&(o+=y,r+=m,a+=y,s+=m);const u=si(o,r,a,s,f),d=i(Yr(e,"edgeStyle")),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=ri(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(p&&(a+=y,s+=m),p){const e=a-y,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===f?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(Yr(n,"nodeStyle"));let l=s.fill||ai(t);if(t.colorByDepth&&void 0!==n.depth){const e=ii(t);l=e[n.depth%e.length]}const c={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:c,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=ri(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,c=l.y1-l.y0;if(0>=e||0>=c)continue;const u=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===r&&!u)continue;if("parent"===r&&u)continue}const d=n?n(l):l.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>c)continue;let h=o(Yr(l,"nodeStyle")).fill||ai(t);if(t.colorByDepth&&void 0!==l.depth){const e=ii(t);h=e[l.depth%e.length]}const g=ni(h);s.push(u?{x:l.x0+e/2,y:l.y0+c/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(Yr(n,"nodeStyle"));let l=s.fill||ai(t);if(t.colorByDepth&&void 0!==n.depth){const e=ii(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=ri(t.nodeLabel);for(const r of e){const e=null!==(s=r.__radius)&&void 0!==s?s:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=r.data)||void 0===l?void 0:l.children)&&r.data.children.length>0);let c=o(Yr(r,"nodeStyle")).fill||ai(t);if(t.colorByDepth&&void 0!==r.depth){const e=ii(t);c=e[r.depth%e.length]}if(a){const t=ni(c);u.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:r.x,y:r.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function ci(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(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 ui(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 di(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function hi(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const gi={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=hi(n);f.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,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,n,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,E=le().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=E(k),C=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=i+O*Math.sin(s),g=a+O*Math.cos(s)*C;o.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:s,depth:d,parentId:n,eccentricity:C}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l;const c=n.nodeStyle,u=n.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],g=[],f=[];if(!1!==n.orbitShowRings){const t=hi(n),o=new Map;for(const t of e)o.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;g.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(Yr(t,"nodeSize")),n=c?c(Yr(t,"nodeStyle")):{},o={fill:n.fill||"#6366f1",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=d(Yr(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(l=null===(s=n.data)||void 0===s?void 0:s[t])&&void 0!==l?l:n.id;f.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:f}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=hi(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o: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 n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},fi={sankey:Xr,force:Vr,chord:Jr,tree:li,cluster:li,treemap:li,circlepack:li,partition:li,orbit:gi};function pi(e){return fi[e]}class yi{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=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({},Zo),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Jo(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({},Zo),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Jo(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},mi(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=Number(u(n))||1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},mi(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},mi(r)),{data:n}));const a=`${o}\0${r}\0${e}`;this.edges.set(a,{source:o,target:r,value:i,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:a})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,mi(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,mi(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=pi(this.config.chartType);if(!s)return;let l=Array.from(this.nodes.values()),c=Array.from(this.edges.values());if(0===l.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of l)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(l,c,this.config,e),this.config.__previousPositions=void 0,s.hierarchical&&l.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of l)this.nodes.set(e.id,e);for(let e=0;c.length>e;e++){const t=c[e],n=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=n,this.edges.set(n,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),l.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.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=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=pi(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=pi(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=pi(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),r=Array.from(this.edges.values());return n.tick(o,r,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=ze(e,this.transition),n=Fe(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=We(e._prevX0,e._targetX0,n),e.x1=We(e._prevX1,e._targetX1,n),e.y0=We(e._prevY0,e._targetY0,n),e.y1=We(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=We(e._prevY0,e._targetY0,n),e.y1=We(e._prevY1,e._targetY1,n),e.sankeyWidth=We(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}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);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,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,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const r=this._decaySortedNodes,i=new Map;for(let e=0;r.length>e;e++)i.set(r[e][0],e);for(const r of this.sceneNodes){const a=r.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const l=$e(n,s,o),c=null!==(t=null===(e=r.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;r.style=Object.assign(Object.assign({},r.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),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,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(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 n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const r=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,r}updateEdge(e,t,n){var o;const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,a=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){a.push(r.data?Object.assign({},r.data):{}),r.data=n(null!==(o=r.data)&&void 0!==o?o:{});const e=i(r.data);null!=e&&(r.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];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 o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,r]of this.edges)o(r.data)===e&&n.push(t)}else for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.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.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function mi(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 vi(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=bi(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=Ai(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function bi(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=tt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let xi=null,ki=null;function wi(){return ki||(xi=document.createElement("canvas"),xi.width=1,xi.height=1,ki=xi.getContext("2d")),ki}function Ai(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=wi();if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}const s=a.lineWidth;a.lineWidth=10;const l=a.isPointInStroke(i,t,n);if(a.lineWidth=s,l)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=wi();if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Si(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",foregroundGraphics:p,sceneNodes:y,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof l?l:"Network Chart"),e.createElement("desc",null,"string"==typeof l?l+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,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"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,r)=>{if(v){const i=v(t,r,{width:n,height:o,sceneNodes:y});if(i)return e.createElement(e.Fragment,{key:"annotation-"+r},i)}return null}),p),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,Mt({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:f,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&y).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=y.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const f=a.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=a.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),m=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,b=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.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+n,style:{position:"absolute",left:f+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function Oi(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s: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 Ei(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n: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!==(o=t.style.strokeWidth)&&void 0!==o?o: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 ji(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function Ci(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Si.displayName="NetworkSVGOverlay";const Mi={top:20,right:80,bottom:20,left:80},Pi={top:40,right:40,bottom:40,left:40},Li=new Set(["chord","force","circlepack","orbit"]),_i=[800,600],Ti={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 Bi({data:t}){var n,o,r,i,a,s;if("edge"===t.nodeOrEdge){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:Ti},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:Ti},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:Ti},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const Ni=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b,x,k,w;const{chartType:A,nodes:S,edges:O,data:E,initialEdges:j,nodeIDAccessor:C="id",sourceAccessor:M="source",targetAccessor:P="target",valueAccessor:L="value",edgeIdAccessor:_,childrenAccessor:T,hierarchySum:B,orientation:N="horizontal",nodeAlign:D="justify",nodePaddingRatio:I=.05,nodeWidth:$=15,iterations:H=300,forceStrength:F=.1,padAngle:z=.01,groupWidth:W=20,sortGroups:R,edgeSort:G,treeOrientation:Y="vertical",edgeType:q="curve",padding:X,paddingTop:V,tensionConfig:U,showParticles:K=!1,particleStyle:Z,nodeStyle:Q,edgeStyle:J,colorBy:ee,colorScheme:te="category10",edgeColorBy:ne="source",edgeOpacity:oe=.5,colorByDepth:re=!1,nodeSize:ae=8,nodeSizeRange:se=[5,20],nodeLabel:le,showLabels:ce=!0,labelMode:ue,size:de=_i,responsiveWidth:he,responsiveHeight:ge,margin:fe,className:pe,background:ye,enableHover:me=!0,tooltipContent:ve,customHoverBehavior:be,customClickBehavior:xe,onObservation:ke,chartId:we,onTopologyChange:Ae,annotations:Se,svgAnnotationRules:Oe,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:_e,title:Te,foregroundGraphics:Be,backgroundGraphics:Ne,decay:De,pulse:Ie,staleness:$e,thresholds:He,accessibleTable:Fe=!0,description:ze,summary:We,orbitMode:Re,orbitSize:Ge,orbitSpeed:Ye,orbitRevolution:qe,orbitRevolutionStyle:Xe,orbitEccentricity:Ve,orbitShowRings:Ue,orbitAnimated:Ke}=i,Ze=Pn(),Qe=t(Ze);Qe.current=Ze;const Je="semiotic-table-"+e.useId(),et=Li.has(A)?Pi:Mi,[tt,nt]=kt(de,he,ge),ot=Object.assign(Object.assign({},et),fe),rt=nt[0]-ot.left-ot.right,it=nt[1]-ot.top-ot.bottom,at="function"==typeof Be?Be({size:nt,margin:ot}):Be,st=n(()=>Object.assign(Object.assign({},Zo),U),[U]),lt=n(()=>Object.assign(Object.assign({},Qo),Z),[Z]),ct=n(()=>({chartType:A,nodeIDAccessor:C,sourceAccessor:M,targetAccessor:P,valueAccessor:L,edgeIdAccessor:_,childrenAccessor:T,hierarchySum:B,orientation:N,nodeAlign:D,nodePaddingRatio:I,nodeWidth:$,iterations:H,forceStrength:F,padAngle:z,groupWidth:W,sortGroups:R,edgeSort:G,treeOrientation:Y,edgeType:q,padding:X,paddingTop:V,tensionConfig:st,showParticles:K,particleStyle:lt,nodeStyle:Q,edgeStyle:J,nodeLabel:le,showLabels:ce,labelMode:ue,colorBy:ee,colorScheme:te,edgeColorBy:ne,edgeOpacity:oe,colorByDepth:re,nodeSize:ae,nodeSizeRange:se,decay:De,pulse:Ie,staleness:$e,thresholds:He,orbitMode:Re,orbitSize:Ge,orbitSpeed:Ye,orbitRevolution:qe,orbitRevolutionStyle:Xe,orbitEccentricity:Ve,orbitShowRings:Ue,orbitAnimated:Ke}),[A,C,M,P,L,T,B,N,D,I,$,H,F,z,W,R,G,Y,q,X,V,st,K,lt,Q,J,le,ce,ue,ee,te,ne,oe,re,ae,se,De,Ie,$e,He,Re,Ge,Ye,qe,Xe,Ve,Ue,Ke]),ut=t(null),dt=t(0),ht=t(0),gt=t(!0),ft=$n(e=>e.theme),pt=t(()=>{}),bt=t(null);bt.current||(bt.current=new yi(ct));const[xt,At]=r(null),[St,Ot]=r(0),[Et,jt]=r(0),[Ct,Mt]=r(!1),Pt=t(null),Lt=t(new Map),_t=t(0),Tt=l(e=>{if("function"==typeof ee)return ee(e)+"";if("string"==typeof ee&&e.data){const t=e.data[ee];if(void 0!==t){if(!Lt.current.has(t+"")){const e=Array.isArray(te)?te:Le;Lt.current.set(t+"",e[_t.current++%e.length])}return Lt.current.get(t+"")}}if(Lt.current.has(e.id))return Lt.current.get(e.id);const t=Array.isArray(te)?te:Le,n=ee?t[_t.current++%t.length]:t[0];return Lt.current.set(e.id,n),n},[ee,te]),Bt=l(e=>{if("function"==typeof ne)return ne(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===ne&&n?Tt(n):t?Tt(t):"#999"},[ne,Tt]),Nt=l(e=>{if(!(null==Z?void 0:Z.colorBy))return Bt(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===lt.colorBy&&n?Tt(n):t?Tt(t):"#999"},[null==Z?void 0:Z.colorBy,lt.colorBy,Tt,Bt]),Dt="sankey"===A&&K||!!Ie||null!==(c=null===(s=bt.current)||void 0===s?void 0:s.isAnimating)&&void 0!==c&&c,It=l(()=>{dt.current&&!Dt||dt.current||(dt.current=requestAnimationFrame(()=>pt.current()))},[Dt]);o(()=>{var e;null===(e=bt.current)||void 0===e||e.updateConfig(ct),gt.current=!0,It()},[ct,It]),o(()=>{gt.current=!0,It()},[ft,It]);const $t=l(()=>{var e;const t=bt.current;if(!t)return;t.runLayout([rt,it]),t.buildScene([rt,it]),gt.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Lt.current.set(n.id,n.style.fill);const n=Array.isArray(te)?te:Le,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Lt.current.has(t.id)||Lt.current.set(t.id,n[e%n.length])}if(_t.current=o.length,Ot(t.layoutVersion),Ae){const{nodes:e,edges:n}=t.getLayoutData();Ae(e,n)}},[rt,it,Ae,te]),Ht=l(e=>{const t=bt.current;t&&(t.ingestEdge(e)&&$t(),It())},[$t,It]),Ft=l(e=>{const t=bt.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&$t(),It()},[$t,It]),zt=l(()=>{var e;null===(e=bt.current)||void 0===e||e.clear(),Lt.current.clear(),_t.current=0,Ot(0),At(null),Pt.current=null,gt.current=!0,It()},[It]),Wt=l(()=>{const e=bt.current;e&&(e.tension+=999,$t(),It())},[$t,It]);u(a,()=>({push:Ht,pushMany:Ft,removeNode:e=>{var t,n,o;const r=null!==(n=null===(t=bt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(r){const t=(null===(o=Pt.current)||void 0===o?void 0:o.data)?"function"==typeof C?C(Pt.current.data):Pt.current.data[C]:void 0;Pt.current&&"node"===Pt.current.nodeOrEdge&&t===e&&(Pt.current=null,At(null)),Lt.current.delete(e),$t(),gt.current=!0,It()}return r},removeEdge:(e,t)=>{var n,o;const r=null!==(o=null===(n=bt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(r){if(Pt.current&&"edge"===Pt.current.nodeOrEdge){const n=Pt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!_||!n||("function"==typeof _?_:e=>null==e?void 0:e[_])(n)===e,o&&(Pt.current=null,At(null))}$t(),gt.current=!0,It()}return r},updateNode:(e,t)=>{var n,o;const r=null!==(o=null===(n=bt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return r&&(gt.current=!0,It()),r},updateEdge:(e,t,n)=>{var o,r;const i=null!==(r=null===(o=bt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==r?r:[];return i.length>0&&($t(),gt.current=!0,It()),i},clear:zt,getTopology:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=bt.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:Wt,getTension:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Ht,Ft,zt,Wt,$t,It]);const Rt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),Gt=Rt?E||(Array.isArray(O)?void 0:O):void 0;o(()=>{var e;const t=bt.current;if(t)if(Rt&&Gt)t.ingestHierarchy(Gt,[rt,it]),t.buildScene([rt,it]),gt.current=!0,It();else{const n=S||[],o=Array.isArray(O)?O:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[rt,it]),t.buildScene([rt,it]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Lt.current.set(n.id,n.style.fill+"");const r=Array.isArray(te)?te:Le,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Lt.current.has(t.id)||Lt.current.set(t.id,r[e%r.length])}_t.current=i.length,gt.current=!0,It()}},[S,O,E,Gt,Rt,rt,it,ct,It,te]),o(()=>{j&&j.length>0&&Ft(j)},[]);const Yt=l(e=>{if(be&&be(e),ke){const t=Date.now();ke(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[be,ke,we]),qt=l(e=>{if(xe&&xe(e),ke){const t=Date.now();ke(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[xe,ke,we]),Xt=t(()=>{}),Vt=t(()=>{});Xt.current=e=>{if(!me)return;const t=ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;if(0>o||o>rt||0>r||r>it)return void(Pt.current&&(Pt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It()));const i=bt.current;if(!i)return;const a=vi(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(Pt.current&&(Pt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It()));const s=ao(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Pt.current=s,At(s),Yt&&(Yt(s),gt.current=!0),It()},Vt.current=()=>{Pt.current&&(Pt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It())};const Ut=t(()=>{});Ut.current=e=>{if(!xe&&!ke)return;const t=ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;if(0>o||o>rt||0>r||r>it)return;const i=bt.current;if(!i)return;const a=vi(i.sceneNodes,i.sceneEdges,o,r);qt(a?ao(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)},l(e=>Xt.current(e),[]);const Kt=l(()=>Vt.current(),[]),Zt=l(e=>Ut.current(e),[]),Qt=t(-1),Jt=t(null),en=t(-1),tn=l(e=>{var t;const n=bt.current;if(!n)return;const o=function(e){var t,n,o,r,i,a;const s=[];for(const l of e)"circle"===l.type&&null!=l.cx?s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"}):"rect"===l.type&&null!=l.x?s.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!==(r=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"}):"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(i=l.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const r=yt(o),i=Qt.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Qt.current=0,en.current=-1;const t=r.flat[0];Jt.current={shape:t.shape,w:t.w,h:t.h};const n=ao(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Pt.current=n,At(n),Yt&&(Yt(n),gt.current=!0),void It()}const a=mt(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return vt(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n,o,r;const i=e+"",a=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,s="object"==typeof t.source?null===(o=t.source)||void 0===o?void 0:o.id:t.source,l="object"==typeof t.target?null===(r=t.target)||void 0===r?void 0:r.id:t.target,c=null!=s,u=null!=l;c&&s+""===i&&u?a.push(l+""):u&&l+""===i&&c&&a.push(s+"")}return a}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=vt(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],en);if(null===s)return;if(e.preventDefault(),0>s)return Qt.current=-1,Jt.current=null,en.current=-1,Pt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),void It();Qt.current=s;const l=r.flat[s];Jt.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{data:c,x:l.x,y:l.y,time:l.x,value:l.y,nodeOrEdge:"node"});Pt.current=u,At(u),Yt&&(Yt(u),gt.current=!0),It()},[Yt,It]),nn=l(e=>{Qt.current=-1,Jt.current=null,Xt.current(e)},[]);pt.current=()=>{var e,t,n,o,r,i,a;dt.current=0;const s=ut.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=bt.current;if(!c)return;const u=performance.now(),d=ht.current?Math.min((u-ht.current)/1e3,.1):.016;ht.current=u;const h=c.advanceTransition(Qe.current?u+1e6:u),g=!Qe.current&&h,f=!Qe.current&&c.tickAnimation([rt,it],d);(h||gt.current||f)&&c.buildScene([rt,it]);const p=Fn();if(!Hn(s,nt,ot,p))return;l.clearRect(-ot.left,-ot.top,nt[0],nt[1]),ye&&(l.fillStyle=ye,l.fillRect(0,0,rt,it)),De&&c.applyDecay(),Ie&&c.applyPulse(u),He&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==$e?void 0:$e.threshold)&&void 0!==e?e:5e3,m=$e&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==$e?void 0:$e.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Oi(e,n);break;case"line":Ei(e,n);break;case"ribbon":ji(e,n);break;case"curved":Ci(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),Kn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;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=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),Zn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;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=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),K&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:Qo.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:Qo.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,lt);const t=.5*(null!==(n=lt.speedMultiplier)&&void 0!==n?n:1);let o;if(lt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:Qo.radius,l=null!==(a=o.opacity)&&void 0!==a?a:Qo.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,lt,Nt)}}m&&(l.globalAlpha=1);const v=gt.current;if(gt.current=!1,v||g||f){const e=ut.current;e&&e.setAttribute("aria-label",hn(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||g||f)&&jt(e=>e+1),(Dt||g||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(dt.current=requestAnimationFrame(()=>pt.current()))},o(()=>(It(),()=>{dt.current&&(cancelAnimationFrame(dt.current),dt.current=0)}),[It]),o(()=>{gt.current=!0,It()},[A,rt,it,ye,It]),wt($e,bt,gt,It,Ct,Mt);const on=me&&xt?e.createElement(Cn,{x:xt.x,y:xt.y,containerWidth:rt,containerHeight:it,margin:ot,className:"stream-network-tooltip",zIndex:2},ve?ve(xt):e.createElement(Bi,{data:xt})):null;if(an){const t=bt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),n=e?E||(Array.isArray(O)?void 0:O):void 0;if(e&&n)t.ingestHierarchy(n,[rt,it]),t.buildScene([rt,it]);else{const e=S||[],n=Array.isArray(O)?O:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[rt,it]),t.buildScene([rt,it]))}}const n=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],o=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],r=null!==(g=null==t?void 0:t.labels)&&void 0!==g?g:[];return e.createElement("div",{className:"stream-network-frame"+(pe?" "+pe:""),role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:nt[0],height:nt[1]}},e.createElement(An,{summary:We}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:nt[0],height:nt[1],style:{position:"absolute",left:0,top:0}},Ne&&e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},Ne),e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},ye&&e.createElement("rect",{x:0,y:0,width:rt,height:it,fill:ye}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+n,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});case"bezier":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"ribbon":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"curved":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.createElement("circle",{key:"net-circle-"+n,cx:o.cx,cy:o.cy,r:o.r,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"rect":{const o=t;return e.createElement("rect",{key:"net-rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"arc":{const o=t,r=ie().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)({})||"";return e.createElement("path",{key:"net-arc-"+n,d:r,transform:`translate(${o.cx},${o.cy})`,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e.createElement("text",{key:"net-label-"+n,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},t.text)}(t,n)).filter(Boolean))),e.createElement(Si,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,labels:r,sceneNodes:n,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:_e,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Oe,annotationFrame:0}))}const sn=bt.current;return e.createElement("div",{ref:tt,className:"stream-network-frame"+(pe?" "+pe:""),role:"group","aria-label":ze||("string"==typeof Te?Te:"Network chart"),tabIndex:0,style:{position:"relative",width:he?"100%":nt[0],height:ge?"100%":nt[1],overflow:"visible"},onKeyDown:tn},Fe&&e.createElement(Sn,{tableId:Je}),Fe&&e.createElement(wn,{nodes:null!==(f=null==sn?void 0:sn.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==sn?void 0:sn.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:Je,chartTitle:"string"==typeof Te?Te:void 0}),e.createElement(An,{summary:We}),e.createElement("div",{role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:me?nn:void 0,onMouseLeave:me?Kt:void 0,onClick:xe||ke?Zt:void 0},Ne&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:nt[0],height:nt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},Ne)),e.createElement("canvas",{ref:ut,"aria-label":hn(null!==(m=null===(y=null==sn?void 0:sn.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==sn?void 0:sn.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(On,{hoverPoint:xt}),e.createElement(Si,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,labels:(null==sn?void 0:sn.labels)||[],sceneNodes:null==sn?void 0:sn.sceneNodes,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Me,legendHighlightedCategory:Pe,legendIsolatedCategories:_e,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Oe,annotationFrame:Et}),e.createElement(jn,{active:Qt.current>=0,hoverPoint:xt,margin:ot,size:nt,shape:null===(x=Jt.current)||void 0===x?void 0:x.shape,width:null===(k=Jt.current)||void 0===k?void 0:k.w,height:null===(w=Jt.current)||void 0===w?void 0:w.h}),on,(null==$e?void 0:$e.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===$e.badgePosition?{top:4,left:4}:"bottom-left"===$e.badgePosition?{bottom:4,left:4}:"bottom-right"===$e.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Ct?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Ct?"STALE":"LIVE")))});Ni.displayName="StreamNetworkFrame";const Di={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 Ii(e,t){return"function"==typeof t?t(e):e[t]}function $i(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 Hi(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=Ii(t,o);s=$i(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Ii(t,o);l.push({label:n,value:$i(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=$i(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=$i(t[e[0]],r))}}const c=Object.assign(Object.assign({},Di),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Fi(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Ii(t,o);c.push({value:$i(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=$i(Ii(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:$i(t[e],r)})});const u=Object.assign(Object.assign({},Di),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function zi(t){if(!0===t)return Hi();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:Di},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Hi(t):Hi())}function Wi(e){return"string"==typeof e?e:"value"}function Ri(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Gi(e,t){return"function"==typeof t?t(e):e[t]}function Yi(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?Ri(Gi(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Di},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=Ri(Gi(r,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function qi({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=Gi(l,t),u=Gi(l,n),d=o?Gi(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Di},e.createElement("div",{style:{fontWeight:"bold"}},Ri(c)),e.createElement("div",{style:{marginTop:4}},Ri(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Wi(o),": ",Ri(d)))}}const Xi=a(null);function Vi({colors:t,categories:o,colorScheme:r="category10",children:i}){const a=n(()=>{if(t)return t;if(o){const e=Array.isArray(r)?r:Pe[r]||Le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,r]);return e.createElement(Xi.Provider,{value:a},i)}function Ui(){return s(Xi)}function Ki(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Zi(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ki(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Qi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Vi.displayName="CategoryColorProvider";const[Ji,ea]=Ln(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Qi(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Qi(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[ta,na]=Ln(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function oa(e){const t=d(),o=e.clientId||t,{name:r}=e,i=ea(e=>e.selections.get(r)),a=ea(e=>e.setClause),s=ea(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?Zi(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:l(()=>{s(r,o)},[s,r,o]),clientId:o}}function ra(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=oa({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}function ia(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=oa({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&s(t)},[u,o,r,s,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function aa(e,t,o){const r=ea(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=Zi(r,o);return e.filter(t)},[e,r,o])}function sa(e={}){const{limit:t=50,types:o,chartId:r}=e,i=na(e=>e.version),a=na(e=>e.observations),s=na(e=>e.clearObservations),l=n(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[a,o,r,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const la=a(!1);function ca({selections:e}){const t=ea(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function ua({categoryColors:n,interaction:i,selectionName:a,field:s}){const c=Object.entries(n);if(0===c.length)return null;const u=c.map(([e])=>e),d=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],h=ra({name:a,fields:[s]}),g=oa({name:a,clientId:"__linked-legend-isolate__"}),[f,p]=r(new Set),[y,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(f.size>0?v.current({[s]:Array.from(f)}):b.current())},[i,f,s]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[s]:e.label})):(m(null),h.onHover(null)))},[i,s,h]),k=l(e=>{"isolate"===i&&p(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[i,u.length]);return e.createElement("svg",{width:"100%",height:30,style:{display:"block",overflow:"visible"}},e.createElement(Ct,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:y,isolatedCategories:f}))}function da({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=Ui(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(Ji,null,e.createElement(ta,null,n&&e.createElement(ca,{selections:n}),e.createElement(la.Provider,{value:c},c&&"top"===r&&l&&e.createElement(ua,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(ua,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function ha({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_e[i%_e.length];return{label:r+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:s,label:""}]}}function ga(e){return e?"string"==typeof e?{name:e}:e:null}function fa(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const pa=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],ya={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},ma={light:Bn,dark:Nn,"high-contrast":Dn,pastels:{mode:"light",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc"},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",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc"},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",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#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",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6"},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",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000"},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",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333"},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",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000"},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",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050"},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",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050"},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",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b"},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",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6"},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",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa"},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",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe"},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",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#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 va(e){return ma[e]}function ba(e,t=":root"){var n,o,r,i,a;const s=[];return s.push(` --semiotic-bg: ${e.colors.background};`),s.push(` --semiotic-text: ${e.colors.text};`),s.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),s.push(` --semiotic-grid: ${e.colors.grid};`),s.push(` --semiotic-border: ${e.colors.border};`),s.push(` --semiotic-primary: ${e.colors.primary};`),s.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&s.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&s.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&s.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&s.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&s.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&s.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(r=e.tooltip)||void 0===r?void 0:r.borderRadius)&&s.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)&&s.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(a=e.tooltip)||void 0===a?void 0:a.shadow)&&s.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&s.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&s.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&s.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&s.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&s.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),`${t} {\n${s.join("\n")}\n}`}function xa(e){var t,n,o,r,i,a;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.text)||e.colors.text,$type:"color"},radius:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(a=e.colors.selectionOpacity)&&void 0!==a?a:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{})}}const ka=e.createContext(void 0);function wa({theme:t}){const n=$n(e=>e.setTheme),o=$n(e=>e.theme),r=e.useRef(o);r.current=o;const i=e.useRef(null);return e.useEffect(()=>{if(void 0!==t)return;if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(forced-colors: active)");return e.matches&&(i.current=r.current,n(Dn)),Mn(e,e=>{var t;e.matches?(i.current=r.current,n(Dn)):(n(null!==(t=i.current)&&void 0!==t?t:Bn),i.current=null)})},[t,n]),e.useEffect(()=>{if(void 0!==t)if("string"==typeof t){const e=va(t);n(e||t)}else n(t)},[t,n]),null}function Aa({children:t}){var n,o,r,i,a;const s=$n(e=>e.theme),l=Object.assign(Object.assign(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":s.colors.background,"--semiotic-text":s.colors.text,"--semiotic-text-secondary":s.colors.textSecondary,"--semiotic-grid":s.colors.grid,"--semiotic-border":s.colors.border,"--semiotic-primary":s.colors.primary,"--semiotic-font-family":s.typography.fontFamily},s.colors.focus?{"--semiotic-focus":s.colors.focus}:{}),(null===(n=s.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":s.tooltip.background}:{}),(null===(o=s.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":s.tooltip.text}:{}),(null===(r=s.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":s.tooltip.borderRadius}:{}),(null===(i=s.tooltip)||void 0===i?void 0:i.fontSize)?{"--semiotic-tooltip-font-size":s.tooltip.fontSize}:{}),(null===(a=s.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":s.tooltip.shadow}:{}),s.borderRadius?{"--semiotic-border-radius":s.borderRadius}:{}),s.colors.selection?{"--semiotic-selection-color":s.colors.selection}:{}),null!=s.colors.selectionOpacity?{"--semiotic-selection-opacity":s.colors.selectionOpacity+""}:{}),s.colors.diverging?{"--semiotic-diverging":s.colors.diverging}:{}),s.colors.annotation?{"--semiotic-annotation-color":s.colors.annotation}:{}),null!=s.typography.legendSize?{"--semiotic-legend-font-size":s.typography.legendSize+"px"}:{}),null!=s.typography.titleFontSize?{"--semiotic-title-font-size":s.typography.titleFontSize+"px"}:{}),null!=s.typography.tickFontFamily?{"--semiotic-tick-font-family":s.typography.tickFontFamily}:{}),c=e.useContext(ka),u={};return c&&(u["data-semiotic-theme"]=c),e.createElement("div",Object.assign({style:l},u),t)}function Sa({theme:t,children:n}){const o="string"==typeof t&&va(t)?t:void 0;return e.createElement(In,null,e.createElement(ka.Provider,{value:o},e.createElement(wa,{theme:t}),e.createElement(Aa,null,n)))}function Oa(){return $n(e=>e.theme)}const Ea="#007bff";function ja(){var e;const t=Oa(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Ca(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Pe[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:Ea}function Ma(e){return"function"==typeof e?e:t=>t[e]}function Pa(e,t,o){const r=Ui(),i=ja();return n(()=>{var n;if(!t)return;const a=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=De(n.map(e=>({_cat:e})),"_cat",a);return t=>r[t]||e(t)}return De(n.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const n=De(e,t,a);return e=>r[e]||n(e)}return De(e,t,a)}if(r&&Object.keys(r).length>0){const e=De([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[e,t,o,r,i])}function La(e,t,o){return n(()=>{if(!t)return e;const n=[...e];if("function"==typeof t)return n.sort(t);const r=Ma(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function _a({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:a=!1,onObservation:s,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:f}){const p=d(),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,i),m=oa({name:(null==e?void 0:e.name)||"__unused__"}),v=ra({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||i||[]}),b=na(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=r(null),A=f||i[0],S=n(()=>{if(!g||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,k,A]),O=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n})},Gt())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Yt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(g&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,y,p,s,c,u,b,g,A]),E=l(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Wt.positions);return t.delete(e),Wt={positions:t},Gt(),!1}Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(y.name||"hover",Number(n),p)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[h,s,b,c,u,y,p]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{qt(e,p),Yt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:p}}function Ta(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Ba({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(la),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return ha({data:e,colorBy:t,colorScale:o,getColor:Ne,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,i]);return{legend:h,margin:g,legendPosition:i}}function Na(e,t,o){const[i,a]=r(null),[s,c]=r(new Set),u=l(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&c(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=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const Da={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 Ia(e,t,n){var o,r,i,a,s,l,c;const u=Da[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!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:$a(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function $a(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Ha({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("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}},o)))}class Fa extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Ha,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function za(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Wa(e,t,n=3){let o,r=n+1;for(const n of t){const t=za(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Ra(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ga(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Wa(e,t,3))&&void 0!==n?n:null)}function Ya({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Ra(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Ga(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function qa({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Xa({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Ra(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=Ga(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Va={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"}},Ua={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ka={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Za=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Qa=["vertical","horizontal"],Ja={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Va),Ua),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Za},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({},Va),Ua),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Za},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Va),Ua),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Za},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({},Va),Ua),{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({},Va),Ua),{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({},Va),Ua),{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({},Va),Ua),{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({},Va),Ua),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Va),Ua),{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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},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({},Va),Ka),{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:Qa},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Va),Ka),{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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},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({},Va),Ka),{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({},Va),Ka),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Qa},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Va),{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({},Va),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Va),{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({},Va),Ka),{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({},Va),Ka),{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({},Va),{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({},Va),{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:Qa},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({},Va),{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({},Va),{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({},Va),{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({},Va),{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({},Va),{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({},Va),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Va),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Va),{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({},Va),{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({},Va),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Va),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function es(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ts=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ns=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),os=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),rs=new Set(["LineChart","AreaChart","StackedAreaChart"]),is=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function as(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function ss(e,t){const n=as(e),o=as(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const ls=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];var cs;const us="undefined"!=typeof process&&"production"!==(null===(cs=process.env)||void 0===cs?void 0:cs.NODE_ENV);function ds({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Fa,{fallback:i=>{let a="";if(us&&r)try{const e=function(e,t){const n=[],o=function(e,t){const n=[],o=Ja[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Ja).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!es(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Wa(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=Ya({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=qa({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=Xa({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Ja[e]?(function(e,t,n){const o=Ja[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Ja[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ts.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){ns.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Ja[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!os.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!rs.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Ja[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!is.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=ss(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=ss(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of ls)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Ha,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const hs={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"},gs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function fs(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},hs),{width:n,height:o})},r||"No data available"):null}function ps(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},gs),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function ys(e,t,n,o){if(!us)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function ms(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:j,customClickBehavior:C,crosshairSourceId:M}=_a({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:S}),P=Ta(c,M),L=Pa(t,r,i),_=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),T=Na(a,r,_),B=n(()=>E||(T.legendSelectionHook?T.legendSelectionHook:O),[E,T.legendSelectionHook,O]),{legend:N,margin:D,legendPosition:I}=Ba({data:t,colorBy:r,colorScale:L,showLegend:p,legendPosition:s,userMargin:y,defaults:m}),$=n(()=>{const e={};return N&&(e.legend=N,e.legendPosition=I),a&&"none"!==a&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),e},[N,I,a,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories]),H=ps(x,w,A),F=H?null:fs(o,w,A,k);return{colorScale:L,allCategories:_,legendState:T,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:C,legend:N,margin:D,legendPosition:I,earlyReturn:H||F||null,legendBehaviorProps:$,crosshairProps:P}}const vs=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:E={},selection:j,linkedHover:C,linkedBrush:M,onObservation:P,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:$}=o,H=a.width,F=a.height,z=a.enableHover,W=a.showGrid,R=a.title,G=a.description,Y=a.summary,q=a.accessibleTable,X=a.xLabel,V=a.yLabel,U=s||[],K=ms({data:U,rawData:s,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:_,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:B,emptyContent:N,width:H,height:F}),Z=ga(M),Q=ia({name:(null==Z?void 0:Z.name)||"__unused_brush__",xField:(null==Z?void 0:Z.xField)||("string"==typeof f?f:void 0),yField:(null==Z?void 0:Z.yField)||("string"==typeof p?p:void 0)}),J=Z?"xyBrush"===Q.brushInteraction.brush?"xy":"xBrush"===Q.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(Q.brushInteraction);ee.current=Q.brushInteraction;const te=l(e=>{const t=ee.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(K.earlyReturn)return K.earlyReturn;ys("Scatterplot",U,"xAccessor",f),ys("Scatterplot",U,"yAccessor",p);const ne=n(()=>{if(!v||0===U.length)return;const e=U.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[U,v]),oe=n(()=>e=>{const t={fillOpacity:k};return y?K.colorScale&&(t.fill=Ne(e,y,K.colorScale)):t.fill=$||Ea,t.r=v?Ie(e,v,b,ne):x,t},[y,K.colorScale,v,b,ne,x,k,$]),re=n(()=>fa(oe,K.effectiveSelectionHook,j),[oe,K.effectiveSelectionHook,j]),ie=n(()=>Yi([{label:X||Wi(f),accessor:f,role:"x"},{label:V||Wi(p),accessor:p,role:"y"},...y?[{label:Wi(y),accessor:y,role:"color"}]:[],...v?[{label:Wi(v),accessor:v,role:"size"}]:[]]),[f,p,X,V,y,v]),ae=Ya({componentName:"Scatterplot",data:s,accessors:{xAccessor:f,yAccessor:p}});if(ae)return e.createElement(Ha,{componentName:"Scatterplot",message:ae,width:H,height:F});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({chartType:"scatter"},null!=s&&{data:U}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,showAxes:a.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:z,showGrid:W}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),{tooltipContent:!1===w?()=>null:zi(w)||ie}),(C||P||L||_)&&{customHoverBehavior:K.customHoverBehavior}),(P||L||C)&&{customClickBehavior:K.customClickBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),Z&&{brush:{dimension:J},onBrush:te}),K.crosshairProps),E);return e.createElement(ds,{componentName:"Scatterplot",width:H,height:F},e.createElement(mo,Object.assign({ref:i},se)))});function bs(e,t){return S(1===t?.5:e/(t-1))}vs.displayName="Scatterplot";const xs=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:f,orderLabel:p,pointRadius:y=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:M}=o,P=a.width,L=a.height,_=a.enableHover,T=a.showGrid,B=a.title,N=a.description,D=a.summary,I=a.accessibleTable,$=a.xLabel,H=a.yLabel,F=s||[],{safeData:z,orderMap:W}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=F;if(f&&F.length>0){const e="function"==typeof f?f:e=>e[f];n=[...F].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[F,f,h,g]);ys("ConnectedScatterplot",z,"xAccessor",h),ys("ConnectedScatterplot",z,"yAccessor",g);const{activeSelectionHook:R,hoverSelectionHook:G,customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:X}=_a({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:S,chartType:"ConnectedScatterplot",chartId:E,hoverHighlight:O,colorByField:void 0}),V=Ta(w,X),U=Na(M,void 0,[]),K=n(()=>G||(U.legendSelectionHook?U.legendSelectionHook:R),[G,U.legendSelectionHook,R]),Z=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==K?void 0:K.isActive,a=null==K?void 0:K.predicate,s=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=bs(t,l),h=!i||!a||a(null!==(n=c.datum)&&void 0!==n?n:c)||a(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;s&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=y+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=y,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[y,K]),Q=n(()=>[Z],[Z]),J=n(()=>(t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const s=a.length,l=100>s,c=[];for(let t=0;s-1>t;t++){const n=a[t],o=a[t+1],u=bs(t,s),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:y+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:y,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[y]),ee=n(()=>[J],[J]),te=n(()=>e=>{var t,n;const o=W.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?bs(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:y,fillOpacity:1}},[y,W]),ne=n(()=>fa(te,K,k),[te,K,k]),oe=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),re=p||("string"==typeof f?f:"Order"),ie=n(()=>Yi([{label:$||Wi(h),accessor:h,role:"x"},{label:H||Wi(g),accessor:g,role:"y"},...f?[{label:re,accessor:f,role:"group"}]:[]]),[h,g,$,H,f,re]),ae=Ya({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),se=ps(j,P,L),le=se?null:fs(s,P,L,C),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:"scatter"},null!=s&&{data:z}),{xAccessor:h,yAccessor:g,pointStyle:ne,size:[P,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,showAxes:a.showAxes,xLabel:$,yLabel:H,xFormat:c,yFormat:d,enableHover:_,showGrid:T}),B&&{title:B}),N&&{description:N}),D&&{summary:D}),void 0!==I&&{accessibleTable:I}),l&&{className:l}),{tooltipContent:!1===m?()=>null:zi(m)||ie}),(w||A||S||O)&&{customHoverBehavior:Y}),(A||S||w)&&{customClickBehavior:q}),v&&{pointIdAccessor:v}),{canvasPreRenderers:Q,svgPreRenderers:ee}),b&&b.length>0&&{annotations:b}),V),x);return se||le||(ae?e.createElement(Ha,{componentName:"ConnectedScatterplot",message:ae,width:P,height:L}):e.createElement(ds,{componentName:"ConnectedScatterplot",width:P,height:L},e.createElement(mo,Object.assign({ref:i},ce))))});function ks(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}xs.displayName="ConnectedScatterplot","function"==typeof SuppressedError&&SuppressedError;const ws="__forecastSegment";let As=null;function Ss(){return ks(this,void 0,void 0,function*(){return As||(As=yield import("./semiotic-statisticalOverlays-DGX_WWc5.js")),As})}const Os=c(function(i,a){var s,c;const d=t(null);u(a,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=d.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=d.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const h=Ia(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,description:i.description,summary:i.summary,accessibleTable:i.accessibleTable,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:f,className:p,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:E=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:_,annotations:T,directLabel:B,gapStrategy:N="break",anomaly:D,forecast:I,frameProps:$={},selection:H,linkedHover:F,onObservation:z,onClick:W,hoverHighlight:R,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:K,yScaleType:Z,color:Q}=i,J=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,ae=h.summary,se=h.accessibleTable,le=h.xLabel,ce=h.yLabel,ue=ps(q,J,ee),de=ue?null:fs(g,J,ee,X),he=g||[];ys("LineChart",he,"xAccessor",v),ys("LineChart",he,"yAccessor",b);const ge="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[pe,ye]=r(null),[me,ve]=r([]),be=n(()=>{if(!I&&!D)return he;const e="function"==typeof v,t="function"==typeof b;return e||t?he.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):he},[he,I,D,v,b]),xe=t(I),ke=t(D);o(()=>{if(!I&&!D)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=I,ke.current=D));let e=!1;const t=I!==xe.current||D!==ke.current;if(xe.current=I,ke.current=D,t&&(ye(null),ve([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return ks(this,void 0,void 0,function*(){return(yield Ss()).buildForecast(...e)})})(be,ge,fe,t,D).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else D&&function(...e){return ks(this,void 0,void 0,function*(){return(yield Ss()).buildAnomalyAnnotations(...e)})}(D).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,I,D,ge,fe]);const we=pe?pe.processedData:he,Ae="__compoundGroup",Se=!(!I||!x),Oe=Se?Ae:I?ws:x,Ee=n(()=>{if(!Se)return we;const e="function"==typeof x?x:e=>e[x];return we.map(t=>{const n=Object.assign({},t);return n[Ae]=`${e(t)}__${t[ws]||"observed"}`,n})},[we,Se,x]),je=Se?Ee:we,Ce=n(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const a=pe?pe.processedData:he;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[I,pe,he,b]),{activeSelectionHook:Me,hoverSelectionHook:Pe,customHoverBehavior:Le,customClickBehavior:_e,crosshairSourceId:Te}=_a({selection:H,linkedHover:F,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:z,onClick:W,chartType:"LineChart",chartId:Y,hoverHighlight:R,colorByField:"string"==typeof w?w:void 0}),Be=Ta(F,Te),De=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Ie=void 0!==(null===(s=je[0])||void 0===s?void 0:s[k]),$e=n(()=>{if(Ie)return je;if(Oe){const e=je.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[k]:[]};"string"==typeof Oe&&(o[Oe]=n),Se&&(o[ws]=t[ws],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:je}]},[je,Oe,k,Ie]),{gapProcessedLineData:He,hasGaps:Fe}=n(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of $e){const o=(n[k]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of $e){const o=n[k]||[];let r=[],i=0;const a=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const s of o)if(De(s))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of $e){const r=o[k]||[],i=[];for(const n of r)De(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:$e,hasGaps:!1}},[$e,N,k,De,Oe,b]),ze=Pa(we,w,A),We=n(()=>{if(!w)return[];const e=new Set;for(const t of we){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[we,w]),Re=Na(V,w,We),Ge=n(()=>Pe||(Re.legendSelectionHook?Re.legendSelectionHook:Me),[Pe,Re.legendSelectionHook,Me]),Ye=n(()=>(e,t)=>{const n={strokeWidth:M},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return w?ze&&(n.stroke=Ne(e,w,ze),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=Q||Ea,o&&(n.fill=Q||Ea,n.fillOpacity=C)),n},[w,ze,M,j,C,Q]),[qe,Xe]=r(null);o(()=>{if(!I)return void Xe(null);let e=!1;return function(...e){return ks(this,void 0,void 0,function*(){return(yield Ss()).createSegmentLineStyle(...e)})}(Ye,I).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,I]);const Ve=qe||Ye,Ue=n(()=>fa(Ve,Ge,H),[Ve,Ge,H]),Ke=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return w?ze&&(t.fill=Ne(e.parentLine||e,w,ze)):t.fill=Q||Ea,t}},[O,E,w,ze,Q]),Ze=Array.isArray(j)?"mixed":j?"area":"line",Qe="object"==typeof B?B:{},Je=Qe.position||"end",et=Qe.fontSize||11,tt=n(()=>{var e,t;if(!B||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of He){const o=n[k]||[];if(0===o.length)continue;const a="end"===Je?o[o.length-1]:o[0],s=null!==(t=null!==(e=r(a))&&void 0!==e?e:r(n))&&void 0!==t?t:"";s&&!i.has(s+"")&&i.set(s+"",a)}const a=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===Je?6:-6,dy:0,color:ze?ze(e):Ea,fontSize:et}));a.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;a.length>e;e++){const t="string"==typeof b?b:"y",n=a[e-1],o=a[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return a},[B,w,ze,He,k,v,b,Je,et]),nt=(!B||void 0!==oe)&&oe,ot=n(()=>{if(!B)return h.marginDefaults;const e=tt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*et);return Math.max(e,o)},0),t=e+10,n="end"===Je?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[B,tt,et,Je,h.marginDefaults]),{legend:rt,margin:it,legendPosition:at}=Ba({data:He,colorBy:w,colorScale:ze,showLegend:nt,legendPosition:U,userMargin:f,defaults:ot}),st=x||w,lt=n(()=>Yi([{label:le||Wi(v),accessor:v,role:"x"},{label:ce||Wi(b),accessor:b,role:"y"},...st?[{label:Wi(st),accessor:st,role:"group"}]:[]]),[v,b,le,ce,st]),ct=Ya({componentName:"LineChart",data:Ie?(null===(c=we[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),ut=n(()=>Ie||Oe||Fe?He.flatMap(e=>{const t=e[k]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):je,[He,k,Ie,Oe,je,Fe]),dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Ze},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=G&&{hoverRadius:G}),null!=g&&{data:ut}),{xAccessor:v,yAccessor:b,xScaleType:K,yScaleType:Z}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===N&&Fe?"_gapSegment":Oe||void 0,curve:S,lineStyle:Ue}),O&&{pointStyle:Ke}),{size:[J,ee],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:it,showAxes:h.showAxes,xLabel:le,yLabel:ce,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),rt&&{legend:rt,legendPosition:at}),V&&"none"!==V&&{legendHoverBehavior:Re.onLegendHover,legendClickBehavior:Re.onLegendClick,legendHighlightedCategory:Re.highlightedCategory,legendIsolatedCategories:Re.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),ae&&{summary:ae}),void 0!==se&&{accessibleTable:se}),p&&{className:p}),{tooltipContent:!1===L?()=>null:"multi"===L?t=>{var n,o,r,i,a,s,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const s=null!==(a=null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(r=t.data)||void 0===r?void 0:r.y)&&void 0!==i?i:t.value)&&void 0!==a?a:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:Di},e.createElement("div",null,$i(s)))}const g=null!==(d=null!==(c=null!==(s=t.xValue)&&void 0!==s?s:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.createElement("div",{className:"semiotic-tooltip",style:Di},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},$i(g)),h.map((t,n)=>e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"}},e.createElement("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.createElement("span",{style:{flex:1,fontSize:"0.85em"}},t.group),e.createElement("span",{style:{fontWeight:500,fontSize:"0.85em"}},$i(t.value)))))}:zi(L)||lt}),"multi"===L&&{tooltipMode:"multi"}),(F||z||W||R)&&{customHoverBehavior:Le}),(z||W||F)&&{customClickBehavior:_e}),_&&{pointIdAccessor:_}),((null==T?void 0:T.length)||me.length||tt.length)&&{annotations:[...T||[],...me,...tt]}),Be),$);return ue||de||(ct?e.createElement(Ha,{componentName:"LineChart",message:ct,width:J,height:ee}):e.createElement(ds,{componentName:"LineChart",width:J,height:ee},e.createElement(mo,Object.assign({ref:d},dt))))});Os.displayName="LineChart";const Es=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:E=2,showPoints:j=!1,pointRadius:C=3,tooltip:M,annotations:P,frameProps:L={},selection:_,linkedHover:T,onObservation:B,onClick:N,hoverHighlight:D,chartId:I,loading:$,emptyContent:H,legendInteraction:F,legendPosition:z,color:W}=o,R=s.width,G=s.height,Y=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,K=s.summary,Z=s.accessibleTable,Q=s.xLabel,J=s.yLabel,ee=ps($,R,G),te=ee?null:fs(l,R,G,H),ne=l||[];ys("AreaChart",ne,"xAccessor",f),ys("AreaChart",ne,"yAccessor",p);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:ae,crosshairSourceId:se}=_a({selection:_,linkedHover:T,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:B,onClick:N,chartType:"AreaChart",chartId:I,hoverHighlight:D,colorByField:"string"==typeof x?x:void 0}),le=Ta(T,se),ce=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),ue=n(()=>{if(ce)return ne;if(y){const e=ne.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:ne}]},[ne,y,b,ce]),de=Pa(ne,x,k),he=n(()=>{if(!x)return[];const e=new Set;for(const t of ne){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[ne,x]),ge=Na(F,x,he),fe=n(()=>re||(ge.legendSelectionHook?ge.legendSelectionHook:oe),[re,ge.legendSelectionHook,oe]),pe=n(()=>e=>{const t={};if(x){if(de){const n=Ne(e,x,de);t.fill=n,O?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else{const e=W||Ea;t.fill=e,O?(t.stroke=e,t.strokeWidth=E):t.stroke="none"}return t.fillOpacity=A,t},[x,de,W,A,O,E]),ye=n(()=>fa(pe,fe,_),[pe,fe,_]),me=n(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return x?de&&(t.fill=Ne(e.parentLine||e,x,de)):t.fill=Ea,t}},[j,C,x,de]),{legend:ve,margin:be,legendPosition:xe}=Ba({data:ue,colorBy:x,colorScale:de,showLegend:X,legendPosition:z,userMargin:c,defaults:s.marginDefaults}),ke=y||x,we=n(()=>Yi([{label:Q||Wi(f),accessor:f,role:"x"},{label:J||Wi(p),accessor:p,role:"y"},...ke?[{label:Wi(ke),accessor:ke,role:"group"}]:[]]),[f,p,Q,J,ke]),Ae=Ya({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Se=n(()=>ce||y?ue.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[ue,b,ce,y,ne]),Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Se}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),S&&{lineGradient:S}),{curve:w,lineStyle:ye}),j&&me&&{pointStyle:me}),{size:[R,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:s.showAxes,xLabel:Q,yLabel:J,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),ve&&{legend:ve,legendPosition:xe}),F&&"none"!==F&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Z&&{accessibleTable:Z}),d&&{className:d}),{tooltipContent:!1===M?()=>null:zi(M)||we}),(T||B||N||D)&&{customHoverBehavior:ie}),(B||N||T)&&{customClickBehavior:ae}),P&&P.length>0&&{annotations:P}),le),L);return ee||te||(Ae?e.createElement(Ha,{componentName:"AreaChart",message:Ae,width:R,height:G}):e.createElement(ds,{componentName:"AreaChart",width:R,height:G},e.createElement(mo,Object.assign({ref:a},Oe))))});function js({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:s="right"}){const c=t(new Set),u=t([]),[d,h]=r(0),g=l(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),f=l(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),p=l(e=>t=>{f([t]),e(t)},[f]),y=l(e=>t=>{f(t),e(t)},[f]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:_e,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return ha({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Ne})},[e,o,a,i,d]),b=n(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}Es.displayName="AreaChart";const Cs=c(function(o,r){var i;const a=t(null),s=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:E=3,normalize:j=!1,tooltip:C,annotations:M,frameProps:P={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:$,legendInteraction:H,legendPosition:F,color:z}=o,W=s.width,R=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,K=s.accessibleTable,Z=s.xLabel,Q=s.yLabel,J=ps(I,W,R),ee=J?null:fs(c,W,R,$),te=c||[],ne=js({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:F}),oe=l(ne.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=l(ne.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[ne.wrapPushMany]);u(r,()=>({push:oe,pushMany:re,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ne.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:[]}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:ae,customHoverBehavior:se,customClickBehavior:le,crosshairSourceId:ce}=_a({selection:L,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"StackedAreaChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ue=Ta(_,ce),de=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),he=n(()=>{if(de)return te;if(m){const e=te.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:te}]},[te,m,v,de]),ge=Pa(te,b,x),fe=n(()=>{if(!b)return[];const e=new Set;for(const t of te){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[te,b]),pe=Na(H,b,fe),ye=n(()=>ae||(pe.legendSelectionHook?pe.legendSelectionHook:ie),[ae,pe.legendSelectionHook,ie]),me=n(()=>e=>{const t={};if(b&&ge){const n=Ne(e,b,ge);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=z||Ea;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,ge,w,A,S,z]),ve=n(()=>fa(me,ye,L),[me,ye,L]),be=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return b?ge&&(t.fill=Ne(e.parentLine||e,b,ge)):t.fill=z||Ea,t}},[O,E,b,ge,z]),{legend:xe,margin:ke,legendPosition:we}=Ba({data:he,colorBy:b,colorScale:ge,showLegend:q,legendPosition:F,userMargin:d,defaults:s.marginDefaults}),Ae=ne.streamingLegend||xe,Se=F||we,Oe=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},ke);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return ke},[ke,ne.streamingMarginAdjust]),Ee=m||b,je=n(()=>Yi([{label:Z||Wi(p),accessor:p,role:"x"},{label:Q||Wi(y),accessor:y,role:"y"},...Ee?[{label:Wi(Ee),accessor:Ee,role:"group"}]:[]]),[p,y,Z,Q,Ee]),Ce=Ya({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Me=n(()=>de||m?he.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[he,v,de,m,te]),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(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:Me}),{xAccessor:p,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:j,lineStyle:ve}),O&&be&&{pointStyle:be}),{size:[W,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Oe,showAxes:s.showAxes,xLabel:Z,yLabel:Q,xFormat:g,yFormat:f,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Ae&&{legend:Ae,legendPosition:Se}),H&&"none"!==H&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),{tooltipContent:!1===C?()=>null:zi(C)||je}),(_||T||B||N)&&{customHoverBehavior:se}),(T||B||_)&&{customClickBehavior:le}),M&&M.length>0&&{annotations:M}),ue),P);return J||ee||(Ce?e.createElement(Ha,{componentName:"StackedAreaChart",message:Ce,width:W,height:R}):e.createElement(ds,{componentName:"StackedAreaChart",width:W,height:R},e.createElement(mo,Object.assign({ref:a},Pe))))});Cs.displayName="StackedAreaChart";const Ms=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ia(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:x="#fff",cellBorderWidth:w=1,tooltip:A,annotations:O,frameProps:E={},selection:P,linkedHover:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,showLegend:$,legendPosition:H,legendInteraction:F}=o,z=a.width,W=a.height,R=a.enableHover,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,K=ps(D,z,W),Z=K?null:fs(s,z,W,I),Q=s||[],J=null!=$&&$,ee=null!=H?H:"right",{margin:te}=Ba({data:Q,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=_a({selection:P,linkedHover:L,fallbackFields:[],onObservation:_,onClick:T,chartType:"Heatmap",chartId:N,hoverHighlight:B,colorByField:void 0}),se=Ta(L,ae),le=Na(F,void 0,[]),ce=n(()=>oe||(le.legendSelectionHook?le.legendSelectionHook:ne),[oe,le.legendSelectionHook,ne]),ue=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),de=n(()=>{const e=Q.map(ue);return[Math.min(...e),Math.max(...e)]},[Q,ue]),he=n(()=>"custom"===y&&m?m:k({blues:M,reds:C,greens:j,viridis:S}[y]||M).domain(de),[y,m,de]);n(()=>{const e=Ma(d),t=Ma(h);return{xBinCount:new Set(Q.map(e)).size,yBinCount:new Set(Q.map(t)).size}},[Q,d,h]),n(()=>({coordinates:Q}),[Q]);const ge=n(()=>e=>{const t=ue(e);return{fill:he(t),stroke:x,strokeWidth:w}},[ue,he,x,w]);n(()=>fa(ge,ce,P),[ge,ce,P]);const fe=n(()=>Yi([{label:V||Wi(d),accessor:d,role:"x"},{label:U||Wi(h),accessor:h,role:"y"},{label:Wi(g),accessor:g,role:"value"}]),[d,h,V,U,g]),pe=Ya({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ye=n(()=>{if(J)return{gradient:{colorFn:e=>he(e),domain:de,label:"string"==typeof g?g:"value",format:b}}},[J,he,de,g,b]),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:"heatmap"},null!=s&&{data:Q}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[z,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:f,yFormat:p,enableHover:R}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),ye&&{legend:ye,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===A?()=>null:zi(A)||fe}),(L||_||T||B)&&{customHoverBehavior:re}),(_||T||L)&&{customClickBehavior:ie}),O&&O.length>0&&{annotations:O}),se),E);return K||Z||(pe?e.createElement(Ha,{componentName:"Heatmap",message:pe,width:z,height:W}):e.createElement(ds,{componentName:"Heatmap",width:z,height:W},e.createElement(mo,Object.assign({ref:i},me))))});Ms.displayName="Heatmap";const Ps=c(function(o,i){const a=t(null),s=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:E,annotations:j,frameProps:C={},selection:M,linkedHover:P,linkedBrush:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,legendInteraction:$,legendPosition:H,color:F}=o,z=s.width,W=s.height,R=s.enableHover,G=s.showGrid,Y=s.showLegend,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,K=s.xLabel,Z=s.yLabel,Q=ps(D,z,W),J=Q?null:fs(c,z,W,I),ee=c||[],te=void 0===c,ne=t(null),[oe,re]=r(0),ie=l(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];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,m]),ae=js({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:H}),se=l(ae.wrapPush(e=>{var t;ie([e]),null===(t=a.current)||void 0===t||t.push(e)}),[ae.wrapPush,ie]),le=l(ae.wrapPushMany(e=>{var t;ie(e),null===(t=a.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,ie]);u(i,()=>({push:se,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.resetCategories(),ne.current=null,re(e=>e+1),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:[]}}),[se,le,ae.resetCategories]);const{activeSelectionHook:ce,hoverSelectionHook:ue,customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=_a({selection:M,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:_,onClick:T,chartType:"BubbleChart",chartId:N,hoverHighlight:B,colorByField:"string"==typeof b?b:void 0}),fe=Ta(P,ge),pe=ga(L);ia({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof p?p:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof y?y:void 0)});const ye=Pa(ee,b,x),me=n(()=>{if(!b)return[];const e=new Set;for(const t of ee){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ee,b]),ve=Na($,b,me),be=n(()=>ue||(ve.legendSelectionHook?ve.legendSelectionHook:ce),[ue,ve.legendSelectionHook,ce]),xe=n(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m,te,oe]),ke=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ye&&(t.fill=Ne(e,b,ye)):t.fill=F||Ea,t.r=Ie(e,m,v,xe),t},[b,ye,m,v,xe,k,w,A,F]),we=n(()=>fa(ke,be,M),[ke,be,M]),{legend:Ae,margin:Se,legendPosition:Oe}=Ba({data:ee,colorBy:b,colorScale:ye,showLegend:Y,legendPosition:H,userMargin:d,defaults:s.marginDefaults}),Ee=ae.streamingLegend||Ae,je=H||Oe,Ce=n(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Se);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Se},[Se,ae.streamingMarginAdjust]),Me=n(()=>Yi([{label:K||Wi(p),accessor:p,role:"x"},{label:Z||Wi(y),accessor:y,role:"y"},{label:Wi(m),accessor:m,role:"size"},...b?[{label:Wi(b),accessor:b,role:"color"}]:[]]),[p,y,K,Z,m,b]),Pe=Ya({componentName:"BubbleChart",data:c,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:m}});if(Pe)return e.createElement(Ha,{componentName:"BubbleChart",message:Pe,width:z,height:W});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:we,colorScheme:x,size:[z,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:s.showAxes,xLabel:K,yLabel:Z,xFormat:g,yFormat:f,enableHover:R,showGrid:G}),Ee&&{legend:Ee,legendPosition:je}),$&&"none"!==$&&{legendHoverBehavior:ve.onLegendHover,legendClickBehavior:ve.onLegendClick,legendHighlightedCategory:ve.highlightedCategory,legendIsolatedCategories:ve.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),{tooltipContent:!1===S?()=>null:zi(S)||Me}),(P||_||T||B)&&{customHoverBehavior:de}),(_||T||P)&&{customClickBehavior:he}),O&&{marginalGraphics:O}),E&&{pointIdAccessor:E}),j&&j.length>0&&{annotations:j}),fe),C);return Q||J||e.createElement(ds,{componentName:"BubbleChart",width:z,height:W},e.createElement(mo,Object.assign({ref:a},Le)))});Ps.displayName="BubbleChart";const Ls="__splomIdx",_s={top:4,bottom:4,left:4,right:4};function Ts({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-_s.left-_s.right,l=r-_s.top-_s.bottom;return o(()=>{if(!a.current)return;const e=h(a.current).select(".brush-g"),t=p().extent([[0,0],[s,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,a],[s,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(a)],[o.x.invert(s),o.y.invert(l)]];i(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,l,n,i]),e.createElement("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${_s.left},${_s.top})`}))}function Bs({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:s,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:f,onPointHover:p}){const y=t(null),m=oa({name:d,clientId:`splom-${o}-${r}`}),v=ia({name:d,xField:o,yField:r}),b=oa({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=l(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=l(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[Ls];void 0!==n&&(x({[Ls]:[n]}),null==p||p(t,e.x+_s.left,e.y+_s.top))},[x,p]),A=l(e=>{const t={opacity:s,r:a};return t.fill=c?Ne(e,c,u):Ea,"hover"===f?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*s):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,s,a,f,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(mo,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:_s,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?w:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.createElement(Ts,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function Ns({data:t,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=oa({name:c,clientId:"splom-diag-"+o}),g=oa({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/a||1,l="string"==typeof s?s:null,c=l?[...new Set(t.map(e=>e[l]).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 t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),a-1);if(d[i]++,p&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!y(e)||f[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})});return{bars:d.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,a,i,p,y,s]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ea,opacity:p?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ea,opacity:p?.3:.6})),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ea,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ea,opacity:.7}))))}function Ds({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Is(t){const{data:o,fields:i,fieldLabels:a={},colorBy:s,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:f="histogram",histogramBins:p=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:O}=t,E="splom",j="splom-hover",C=m?"hover":y?"brush":"hover",M=ea(e=>e.clearSelection),[P,L]=r(null),_=l(()=>{M(j),L(null)},[M,j]),T=n(()=>(o||[]).map((e,t)=>void 0!==e[Ls]?e:Object.assign(Object.assign({},e),{[Ls]:t})),[o]),B=Pa(T,s,c),N=void 0!==k?k:!!s,D=n(()=>{if(!N||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):Ea})):null},[N,s,T,B]),I=n(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>u+"px").join(" "),gridTemplateRows:i.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[i,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},D&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},D.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:I,onMouseLeave:"hover"===C?_:void 0},i.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t),i.map((o,r)=>n===r?"label"===f?e.createElement(Ds,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(Ns,{key:"diag-"+t,data:T,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,mode:C}):e.createElement(Bs,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,a)=>{e?(L({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O})):(L(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O}))}:void 0})))),e.createElement("div",null)," ",i.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t))),P&&"hover"===C&&(()=>{const t=P.datum,n=a[P.xField]||P.xField,o=a[P.yField]||P.yField,r=s?"function"==typeof s?s(t):t[s]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[Ls];return e.createElement("div",{style:{position:"absolute",left:40+P.colIndex*(u+d)+P.px,top:P.rowIndex*(u+d)+P.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[P.xField]?Number(t[P.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[P.yField]?Number(t[P.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",r+""))})())}function $s(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(da,{selections:r},e.createElement(Is,Object.assign({},t)))}function Hs({width:n,height:r,margin:i,scales:a,brushDirection:s,extent:l,onBrush:c}){const u=t(null),d=t(null),p=t(!1),y=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!a)return;const e=h(u.current).select(".brush-group"),t="x"===s?g().extent([[0,0],[n,r]]):f().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(p.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?a.x:a.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,n,r,s,c]),o(()=>{if(!d.current||!a||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===s?a.x:a.y;if(p.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);p.current=!1},[l,a,s]),e.createElement("svg",{ref:u,width:y,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function Fs(i){var a,s;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:f,description:p,summary:y,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:S="coordinates",colorBy:O,colorScheme:E,curve:j="linear",lineWidth:C=2,fillArea:M=!1,areaOpacity:P=.3,showPoints:L=!1,pointRadius:_=3,enableHover:T=!0,showGrid:B=!1,showLegend:N,legendPosition:D,tooltip:I,minimap:$={},renderBefore:H=!1,onBrush:F,brushExtent:z,frameProps:W={},loading:R,emptyContent:G}=i,Y=ps(R,u,d),q=Y?null:fs(c,u,d,G),X=c||[],[V,U]=r(null),K=null!=z?z:V,Z=l(e=>{z||U(e),null==F||F(e)},[z,F]),Q=t(null),[J,ee]=r(null);o(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=Q.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?ee(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const te=void 0!==(null===(a=X[0])||void 0===a?void 0:a[S]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[S]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:X}]},[X,A,S,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[S]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,S,te,A,X]),re=Pa(X,O,E),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=O?Ne(e,O,re):Ea,M&&(t.fill=t.stroke,t.fillOpacity=P),t},[O,re,C,M,P]),ae=n(()=>$.lineStyle?$.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=O?Ne(e,O,re):Ea,t},[O,re,$.lineStyle]),se=n(()=>{if(L)return e=>{const t={r:_,fillOpacity:1};return t.fill=O?Ne(e.parentLine||e,O,re):Ea,t}},[L,_,O,re]),{legend:le,margin:ce,legendPosition:ue}=Ba({data:ne,colorBy:O,colorScale:re,showLegend:N,legendPosition:D,userMargin:h}),de=$.height||60,he=n(()=>{var e,t,n,o,r,i,a,s;return{top:null!==(t=null===(e=$.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=$.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=$.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ce.left,right:null!==(s=null===(a=$.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:ce.right}},[$.margin,ce]),ge=$.brushDirection||"x",fe=Ya({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(fe)return e.createElement(Ha,{componentName:"MinimapChart",message:fe,width:u,height:d});const pe=M?"area":"line",ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ie},L&&{pointStyle:se}),{size:[u,d],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:ce,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:T,showGrid:B}),le&&{legend:le,legendPosition:ue}),f&&{title:f}),p&&{description:p}),y&&{summary:y}),I&&{tooltipContent:zi(I)||void 0}),K&&{xExtent:K}),W),me={chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ae,size:[u,de+he.top+he.bottom],margin:he,showAxes:null!==(s=$.showAxes)&&void 0!==s&&s,background:$.background,enableHover:!1},ve=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(mo,Object.assign({ref:Q},me)),e.createElement(Hs,{width:u-he.left-he.right,height:de,margin:he,scales:J,brushDirection:ge,extent:K,onBrush:Z})),be=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(mo,Object.assign({},ye)));return Y||q||e.createElement(ds,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},H?ve:be,H?be:ve))}$s.displayName="ScatterplotMatrix",Fs.displayName="MinimapChart";const zs=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",xCenter:p,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:S=[3,15],pointRadius:O=5,pointOpacity:E=.8,tooltip:j,pointIdAccessor:C,annotations:M,frameProps:P={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:$,legendInteraction:H,legendPosition:F,color:z}=o,W=a.width,R=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Z=a.xLabel,Q=a.yLabel,J=ps(I,W,R),ee=J?null:fs(s,W,R,$),te=s||[];ys("QuadrantChart",te,"xAccessor",g),ys("QuadrantChart",te,"yAccessor",f);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=_a({selection:L,linkedHover:_,fallbackFields:"string"==typeof k?[k]:[],onObservation:T,onClick:B,chartType:"QuadrantChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof k?k:void 0}),se=Ta(_,ae),le=Pa(te,k,w),ce=n(()=>{if(!k)return[];const e=new Set;for(const t of te){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[te,k]),ue=Na(H,k,ce),de=n(()=>oe||(ue.legendSelectionHook?ue.legendSelectionHook:ne),[oe,ue.legendSelectionHook,ne]),he=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof f?f:e=>+e[f];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const a of te){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=p&&isFinite(p)&&(n>p&&(n=p),p>o&&(o=p)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(i-r)||1;return{xExtent:[n-a,o+a],yExtent:[r-s,i+s]}},[te,g,f,p,y]),ge=n(()=>{if(!A||0===te.length)return;const e=te.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,A]),fe=n(()=>"function"==typeof g?g:e=>+e[g],[g]),pe=n(()=>"function"==typeof f?f:e=>+e[f],[f]),ye=n(()=>e=>{const t={fillOpacity:E};if(k)le&&(t.fill=Ne(e,k,le));else{const n=fe(e),o=pe(e),r=null!=p?n>=p:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?z||Ea:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?Ie(e,A,S,ge):O,t},[k,le,A,S,ge,O,E,fe,pe,p,y,m,z]),me=n(()=>fa(ye,de,L),[ye,de,L]),{legend:ve,margin:be,legendPosition:xe}=Ba({data:te,colorBy:k,colorScale:le,showLegend:q,legendPosition:F,userMargin:l,defaults:a.marginDefaults}),ke=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof f&&e.add(f),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,g,f,k,A]),we=n(()=>Yi([...ke?[{label:ke,accessor:ke,role:"title"}]:[],{label:Z||Wi(g),accessor:g,role:"x"},{label:Q||Wi(f),accessor:f,role:"y"},...k?[{label:Wi(k),accessor:k,role:"color"}]:[],...A?[{label:Wi(A),accessor:A,role:"size"}]:[]]),[ke,g,f,Z,Q,k,A]),Ae=Ya({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:f}}),Se=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=r.width,s=r.height,l=null!=p?o.x(p):a/2,c=null!=y?o.y(y):s/2;if(null!=p&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:a-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:s-d},{config:m.bottomRight,x:u,y:d,w:a-u,h:s-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[p,y,m,v]),Oe=n(()=>b?[...Se,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,a=null!=p?n.x(p):r/2,s=null!=y?n.y(y):i/2;(null==p||isFinite(a))&&(null==y||isFinite(s))&&(e.font=`600 ${x}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,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:Se,[Se,b,x,m,p,y]),Ee=n(()=>{const e=P.canvasPreRenderers||[];return[...Oe,...e]},[Oe,P.canvasPreRenderers]),je=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,a=r.height,s=null!=p?o.x(p):i/2,l=null!=y?o.y(y):a/2;if(null!=p&&!isFinite(s))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:a-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:a-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:a,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:a-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:a-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[p,y,m,v,b,x]),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:g,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:S,pointStyle:me,colorScheme:w,size:[W,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:a.showAxes,xLabel:Z,yLabel:Q,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),he&&{xExtent:he.xExtent,yExtent:he.yExtent}),ve&&{legend:ve,legendPosition:xe}),H&&"none"!==H&&{legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:ue.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?we:zi(j)||we}),(_||T||B||N)&&{customHoverBehavior:re}),(T||B||_)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:Ee}),se),P),Ee.length>0&&{canvasPreRenderers:Ee}),{svgPreRenderers:je});return J||ee||(Ae?e.createElement(Ha,{componentName:"QuadrantChart",message:Ae,width:W,height:R}):e.createElement(ds,{componentName:"QuadrantChart",width:W,height:R},e.createElement(mo,Object.assign({ref:i},Ce))))});zs.displayName="QuadrantChart";const Ws="__ma_unitized",Rs="__ma_series";function Gs(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Ys(e,t){return t[0]+e*(t[1]-t[0])}const qs=c(function(o,r){var i,a;const s=t(null),l=t([]);u(r,()=>({push:e=>{if(!s.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&s.current.push(Object.assign(Object.assign({},t),{[Ws]:Gs(i,r),[Rs]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const a=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=a&&isFinite(a)&&t.push(Object.assign(Object.assign({},n),{[Ws]:Gs(a,i),[Rs]:r.label||"Series "+(e+1)}))}s.current.pushMany(t)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const c=Ia(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:g,xFormat:f,xAccessor:p="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_}=o,T=c.width,B=c.height,N=c.enableHover,D=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,$=c.title,H=c.description,F=c.summary,z=c.accessibleTable,W=c.xLabel,R=2===y.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||R||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${y.length}. Rendering as a standard multi-line chart.`);const G=ps(M,T,B),Y=G?null:fs(d,T,B,P),q=d||[],X=ja(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=Pe[m];e=Array.isArray(t)?t:Le}return y.map((t,n)=>t.color||e[n%e.length])},[y,m,X]),U=n(()=>y.map((e,t)=>e.label||"Series "+(t+1)),[y]),{unitizedData:K,extents:Z}=n(()=>{if(0===q.length){const e=y.map(e=>e.extent||null).filter(Boolean);return e.length===y.length&&(l.current=e),{unitizedData:[],extents:e.length===y.length?e:[]}}const e=y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(q,e.yAccessor));if(l.current=e,!R){const t=[];for(const e of q)for(let n=0;y.length>n;n++){const o=y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[Ws]:r,[Rs]:U[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of q)for(let o=0;2>o;o++){const r=y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[Ws]:Gs(i,e[o]),[Rs]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,R,U]),Q=n(()=>{if(R&&Z.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=Ys(e,Z[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=Ys(e,Z[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[R,Z,y,U]),J=ms({data:n(()=>K.length>0?K:U.map(e=>({[Rs]:e})),[K,U]),rawData:d,colorBy:Rs,colorScheme:V,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:[Rs],unwrapData:!1,onObservation:O,onClick:E,hoverHighlight:j,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:R?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:M,emptyContent:P,width:T,height:B});if(J.earlyReturn)return J.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[Rs])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>fa(ee,J.effectiveSelectionHook,A),[ee,J.effectiveSelectionHook,A]),ne=n(()=>{if(!1===x)return()=>null;return zi(x)||(t=>{var n;const o=t.data||t,r=o[Rs],i=U.indexOf(r),a=o[Ws],s=R&&i>=0&&Z[i]?Ys(a,Z[i]):a,l=i>=0&&(null===(n=y[i])||void 0===n?void 0:n.format)?y[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof p?p(o):o[p];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:V[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof p?p:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(s)}`))})},[x,U,V,Z,R,y,p]),oe=Ya({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:p}}),re=R?[0,1]:void 0,ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:K}),{xAccessor:p,yAccessor:Ws,groupAccessor:Rs,lineStyle:te,colorScheme:V,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),Q&&{axes:Q}),{xLabel:W}),R?{}:{yLabel:U[0]}),{xFormat:f}),R&&re&&{yExtent:re}),{enableHover:N}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:D,curve:v}),J.legendBehaviorProps),$&&{title:$}),H&&{description:H}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),g&&{className:g}),{tooltipContent:ne}),k&&{annotations:k}),(S||O||E||j)&&{customHoverBehavior:J.customHoverBehavior}),(O||E||S)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return G||Y||(oe?e.createElement(Ha,{componentName:"MultiAxisLineChart",message:oe,width:T,height:B}):e.createElement(ds,{componentName:"MultiAxisLineChart",width:T,height:B},e.createElement(mo,Object.assign({ref:s},ie))))});qs.displayName="MultiAxisLineChart";const Xs=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,showCategoryTicks:N,categoryFormat:D,dataIdAccessor:I}=o,$=i.width,H=i.height,F=i.enableHover,z=i.showGrid,W=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=ms({data:V,rawData:s,colorBy:p,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"BarChart",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:$,height:H});if(U.earlyReturn)return U.earlyReturn;ys("BarChart",V,"categoryAccessor",d),ys("BarChart",V,"valueAccessor",h);const K=La(V,m,h),Z=ja(),Q=n(()=>new Map,[V]),J=n(()=>(e,t)=>{const n={};return n.fill=p?Ne(e,p,U.colorScale):Ca(B,Z,y,void 0,Q),n},[p,U.colorScale,B,Z,y,Q]),ee=n(()=>{const e=null==A?void 0:A.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},J(t,n)),e(t,n)||{}):J},[J,A]),te=n(()=>fa(ee,U.effectiveSelectionHook,S),[ee,U.effectiveSelectionHook,S]),ne=n(()=>qi({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),oe=Ya({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ha,{componentName:"BarChart",message:oe,width:$,height:H});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[$,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v}),null!=b&&{roundedTop:b}),I&&{dataIdAccessor:I}),{baselinePadding:x,enableHover:F,showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:N,oSort:m}),U.legendBehaviorProps),W&&{title:W}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===k?()=>null:zi(k)||ne}),(O||E||j||C)&&{customHoverBehavior:U.customHoverBehavior}),(E||j||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"BarChart",width:$,height:H},e.createElement(Ko,Object.assign({ref:a},re)))});function Vs({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s,setup:c}){const d=js({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s}),h=l(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=l(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:s||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,s]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}Xs.displayName="BarChart";const Us=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,categoryFormat:D}=o,I=i.width,$=i.height,H=i.enableHover,F=i.showGrid,z=i.showLegend,W=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=p||d,K=void 0===s,Z=ms({data:V,rawData:s,colorBy:U,colorScheme:y,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"StackedBarChart",chartId:P,showLegend:z,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:I,height:$});if(Z.earlyReturn)return Z.earlyReturn;const Q=ja(),J=n(()=>new Map,[V]),ee=n(()=>(e,t)=>U?Z.colorScale?{fill:Ne(e,U,Z.colorScale)}:{}:{fill:Ca(N,Q,y,t,J)},[U,Z.colorScale,N,Q,y,J]),te=n(()=>{const e=null==S?void 0:S.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=ee(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:ee},[ee,S]),ne=n(()=>fa(te,Z.effectiveSelectionHook,O),[te,Z.effectiveSelectionHook,O]),oe=n(()=>qi({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),re=Ya({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:ie,effectiveMargin:ae}=Vs({ref:r,frameRef:a,isPushMode:K,colorBy:U,colorScheme:y,showLegend:z,legendPosition:B,setup:Z}),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!=s&&{data:V}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),D&&{oFormat:D}),{showGrid:F}),ie),W&&{title:W}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===w?()=>null:zi(w)||oe}),(E||j||C||M)&&{customHoverBehavior:Z.customHoverBehavior}),(j||C||E)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e.createElement(Ha,{componentName:"StackedBarChart",message:re,width:I,height:$}):e.createElement(ds,{componentName:"StackedBarChart",width:I,height:$},e.createElement(Ko,Object.assign({ref:a},se)))});Us.displayName="StackedBarChart";const Ks="__likert_neutral_neg",Zs="__likert_neutral_pos";function Qs(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Js(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(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 n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function el(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:Ks,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:Zs,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function tl(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===Ks?i=n:n.__likertLevel===Zs?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const nl=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null),{data:s,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:f,countAccessor:p="count",levels:y,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,valueFormat:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,$=i.showGrid,H=i.showLegend,F=i.title,z=i.description,W=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q="horizontal"===m,X=void 0===s,V=!f,U=n(()=>v&&Array.isArray(v)&&v.length>=y.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&a.push(o);for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return a}(y.length),[v,y.length]),K=n(()=>{const e=new Map;for(let t=0;y.length>t;t++)e.set(y[t],U[t]||"#888");return e},[y,U]),{processedData:Z,reAggregate:Q,accumulatorRef:J}=function({data:e,levels:o,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>Qs(r,"question"),[r]),g=n(()=>d?Qs(i,"score"):null,[d,i]),f=n(()=>d?null:Qs(a,"level"),[d,a]),p=n(()=>d?null:Qs(s,"count"),[d,s]),y=e||[],m=t([]),v=n(()=>{if(0===y.length)return[];let e=Js(y,o,h,g,f,p);return c&&(e=el(e,o),e=tl(e,o)),e},[y,o,h,g,f,p,c]),b=l(e=>{var t,n;let r=Js(e,o,h,g,f,p);c&&(r=el(r,o),r=tl(r,o)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(n=u.current)||void 0===n||n.pushMany(r))},[o,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:s,levels:y,categoryAccessor:h,valueAccessor:g,levelAccessor:f,countAccessor:p,isDiverging:q,frameRef:a}),ee="__likertLevelLabel",te=js({isPushMode:X,colorBy:ee,colorScheme:U,showLegend:H,legendPosition:T}),ne=l(te.wrapPush(e=>{J.current.push(e),Q(J.current)}),[te.wrapPush,Q,J]),oe=l(te.wrapPushMany(e=>{J.current.push(...e),Q(J.current)}),[te.wrapPushMany,Q,J]);u(r,()=>({push:ne,pushMany:oe,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;J.current=[],te.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:[]}}),[ne,oe,te.resetCategories,J]);const re=ms({data:Z,rawData:s,colorBy:ee,colorScheme:U,legendInteraction:_,legendPosition:T,selection:A,linkedHover:S,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"LikertChart",chartId:C,showLegend:H,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:D});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=y.length;return e%2!=0&&K.get(y[Math.floor(e/2)])||"#888"},[y,K]),ae=n(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===Ks||r===Zs)return{fill:ie};const i=o||r;return i&&K.has(i)?{fill:K.get(i)}:{fill:"#888"}},[K,ie]),se=n(()=>fa(ae,re.effectiveSelectionHook,A),[ae,re.effectiveSelectionHook,A]),le=n(()=>{const e=y.length;return e%2!=0?y[Math.floor(e/2)]:""},[y]),ce=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===Ks||o===Zs?le:o,i=n.__likertCategory||"",a=Math.abs(n.__likertPct||0),s=o===Ks||o===Zs?2*a:a,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:Di},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${l})`))},[le]),ue=n(()=>{if(!y||2>y.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&f)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(f&&!p)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:h};return V?g&&(e.valueAccessor=g):(f&&(e.levelAccessor=f),p&&(e.countAccessor=p)),Ya({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:y}})},[s,h,g,f,p,y,V]),de=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:y.map(e=>({label:e})),label:""}],[y,K]),he=n(()=>!1!==H?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:de},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,H,de]),ge=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==H){const t=T||"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(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return q&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,q,X,H,T]),fe=n(()=>M||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,M]),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:"bar"},null!=s&&{data:Z}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:se,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge,barPadding:b,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y||(q?void 0:"Percentage"),rFormat:fe}),B&&{oFormat:B}),{showGrid:$}),he),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?ce:zi(x)||ce}),(S||O||E||j)&&{customHoverBehavior:re.customHoverBehavior}),(O||E||S)&&{customClickBehavior:re.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ue?e.createElement(Ha,{componentName:"LikertChart",message:ue,width:N,height:D}):e.createElement(ds,{componentName:"LikertChart",width:N,height:D},e.createElement(Ko,Object.assign({ref:a},pe)))});function ol({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=ga("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),a=ia({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),s=t(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(i){s.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}nl.displayName="LikertChart";const rl=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:E,frameProps:j={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:$,showCategoryTicks:H,categoryFormat:F}=o,z=i.width,W=i.height,R=i.enableHover,G=i.showGrid,Y=i.title,q=i.description,X=i.summary,V=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Z=s||[],Q=ms({data:Z,rawData:s,colorBy:p,colorScheme:y,legendInteraction:D,legendPosition:I,selection:C,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:_,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:N,width:z,height:W}),J=ol({brushProp:S,onBrushProp:O,linkedBrush:E,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const ee=n(()=>{if(!m)return;const e=Z.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[Z,m]),te=ja(),ne=n(()=>new Map,[Z]),oe=n(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=p?Ne(e,p,Q.colorScale):Ca($,te,y,void 0,ne),n.r=m?Ie(e,m,v,ee):b,n},[p,Q.colorScale,m,v,ee,b,x,$,te,y,ne]),re=n(()=>fa(oe,Q.effectiveSelectionHook,C),[oe,Q.effectiveSelectionHook,C]),ie=n(()=>qi({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),ae=Ya({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ae)return e.createElement(Ha,{componentName:"SwarmPlot",message:ae,width:z,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({chartType:"swarm"},null!=s&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,barPadding:k,enableHover:R}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:H}),Q.legendBehaviorProps),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===w?()=>null:zi(w)||ie}),(M||P||L||_)&&{customHoverBehavior:Q.customHoverBehavior}),(P||L||M)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),J.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"SwarmPlot",width:z,height:W},e.createElement(Ko,Object.assign({ref:a},se)))});function il(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:Di},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=i.length,s=a>0?a%2!=0?i[Math.floor(a/2)]:(i[a/2-1]+i[a/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:Di},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:Di},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}rl.displayName="SwarmPlot";const al=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_,showCategoryTicks:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,$=i.showGrid,H=i.title,F=i.description,z=i.summary,W=i.accessibleTable,R=i.categoryLabel,G=i.valueLabel,Y=s||[],q=ms({data:Y,rawData:s,colorBy:p,colorScheme:y,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:M,width:N,height:D});if(q.earlyReturn)return q.earlyReturn;const X=ja(),V=n(()=>new Map,[Y]),U=n(()=>e=>{const t=p?Ne(e,p,q.colorScale):Ca(_,X,y,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[p,q.colorScale,_,X,y,V]),K=n(()=>fa(U,q.effectiveSelectionHook,w),[U,q.effectiveSelectionHook,w]),Z=n(()=>il(),[]),Q=Ya({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(Q)return e.createElement(Ha,{componentName:"BoxPlot",message:Q,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:q.margin,barPadding:v,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:R,rLabel:G,rFormat:f}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T}),q.legendBehaviorProps),H&&{title:H}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),{tooltipContent:!1===b?()=>null:zi(b)||Z}),(A||S||O||E)&&{customHoverBehavior:q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"BoxPlot",width:N,height:D},e.createElement(Ko,Object.assign({ref:a},J)))});al.displayName="BoxPlot";const sl=c(function(o,r){const i=Ia(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=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,showCategoryTicks:D,categoryFormat:I}=o,$=i.width,H=i.height,F=i.enableHover,z=i.showGrid,W=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=ms({data:V,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"Histogram",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:$,height:H}),K=ol({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(U.earlyReturn)return U.earlyReturn;const Z=n(()=>{if(0===V.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,h]),Q=ja(),J=n(()=>new Map,[V]),ee=n(()=>e=>{const t=y?Ne(e,y,U.colorScale):Ca(N,Q,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[y,U.colorScale,N,Q,m,J]),te=n(()=>fa(ee,U.effectiveSelectionHook,O),[ee,U.effectiveSelectionHook,O]),ne=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:Di},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=Ya({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ha,{componentName:"Histogram",message:oe,width:$,height:H});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:f}),Z&&{rExtent:Z}),{size:[$,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:p}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:D}),U.legendBehaviorProps),W&&{title:W}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===b?()=>null:zi(b)||ne}),(E||j||C||M)&&{customHoverBehavior:U.customHoverBehavior}),(j||C||E)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"Histogram",width:$,height:H},e.createElement(Ko,Object.assign({ref:a},re)))});sl.displayName="Histogram";const ll=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:E,linkedHover:j,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:_,emptyContent:T,legendInteraction:B,legendPosition:N,color:D,showCategoryTicks:I,categoryFormat:$}=o,H=i.width,F=i.height,z=i.enableHover,W=i.showGrid,R=i.title,G=i.description,Y=i.summary,q=i.accessibleTable,X=i.categoryLabel,V=i.valueLabel,U=s||[],K=ms({data:U,rawData:s,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:N,selection:E,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:T,width:H,height:F}),Z=ol({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Q=ja(),J=n(()=>new Map,[U]),ee=n(()=>e=>{const t=m?Ne(e,m,K.colorScale):Ca(D,Q,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,D,Q,v,J]),te=n(()=>fa(ee,K.effectiveSelectionHook,E),[ee,K.effectiveSelectionHook,E]),ne=n(()=>il({valueAccessor:h}),[h]),oe=Ya({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ha,{componentName:"ViolinPlot",message:oe,width:H,height:F});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:f,showIQR:p,size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V,rFormat:y}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:I}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===x?()=>null:zi(x)||ne}),(j||C||M||P)&&{customHoverBehavior:K.customHoverBehavior}),(C||M||j)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Z.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"ViolinPlot",width:H,height:F},e.createElement(Ko,Object.assign({ref:a},re)))});ll.displayName="ViolinPlot";const cl=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N}=o,D=i.width,I=i.height,$=i.enableHover,H=i.showGrid,F=i.title,z=i.description,W=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=ms({data:q,rawData:s,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"RidgelinePlot",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:P,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=ja(),U=n(()=>new Map,[q]),K=n(()=>e=>{const t=m?Ne(e,m,X.colorScale):Ca(T,V,v,void 0,U);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,V,v,U]),Z=n(()=>fa(K,X.effectiveSelectionHook,A),[K,X.effectiveSelectionHook,A]),Q=n(()=>il(),[]),J=Ya({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(Ha,{componentName:"RidgelinePlot",message:J,width:D,height:I});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=s&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Z,bins:f,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:b,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:y}),N&&{oFormat:N}),{showGrid:H,showCategoryTicks:B,oSort:!1,amplitude:p}),X.legendBehaviorProps),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===x?()=>null:zi(x)||Q}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"RidgelinePlot",width:D,height:I},e.createElement(Ko,Object.assign({ref:a},ee)))});cl.displayName="RidgelinePlot";const ul=c(function(o,r){const i=Ia(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=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:_,categoryFormat:T}=o,B="vertical"===y,N=i.width,D=i.height,I=i.enableHover,$=i.title,H=i.description,F=i.summary,z=i.accessibleTable,W=s||[],R=f||g,G=!R,Y=ms({data:W,rawData:s,colorBy:R,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"FunnelChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:$?60:40,right:20,bottom:60,left:60}:{top:$?40:10,right:10,bottom:10,left:10},loading:C,emptyContent:M,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;ys("FunnelChart",W,"stepAccessor",d),ys("FunnelChart",W,"valueAccessor",h);const q=ja(),X=n(()=>new Map,[W]),V=n(()=>{if(G)return _||((null==q?void 0:q[0])?q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[G,_,q,p]),U=n(()=>(e,t)=>{const n={};return n.fill=V||(R?Ne(e,R,Y.colorScale):Ca(_,q,p,t,X)),n},[V,R,Y.colorScale,_,q,p,X]),K=n(()=>fa(U,Y.effectiveSelectionHook,w),[U,Y.effectiveSelectionHook,w]),Z=n(()=>t=>{var n,o,r,i,a,s;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(a=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==a?a:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(s=null==l?void 0:l.__barFunnelCategory)&&void 0!==s?s:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:Di},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),f&&f!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},f+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",p))},[]),Q=Ya({componentName:"FunnelChart",data:s,accessors:{stepAccessor:d,valueAccessor:h}});if(Q)return e.createElement(Ha,{componentName:"FunnelChart",message:Q,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),Y.legendBehaviorProps),$&&{title:$}),H&&{description:H}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Z:zi(b)||Z}),(A||S||O||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"FunnelChart",width:N,height:D},e.createElement(Ko,Object.assign({ref:a},J)))});ul.displayName="FunnelChart";const dl=c(function(o,r){var i;const a=Ia(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,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:o.orientation}),s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=a.width,I=a.height,$=a.enableHover,H=a.showGrid,F=a.title,z=a.description,W=a.summary,R=a.accessibleTable,G=a.categoryLabel,Y=a.valueLabel,q=l||[],X=ms({data:q,rawData:l,colorBy:y,colorScheme:m,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:P,emptyContent:L,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=La(q,v,g),U=ja(),K=n(()=>new Map,[q]),Z=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=y?Ne(e,y,X.colorScale):Ca(B,U,m,void 0,K),n},[y,X.colorScale,b,B,U,m,K]),Q=n(()=>fa(Z,X.effectiveSelectionHook,S),[Z,X.effectiveSelectionHook,S]),J=n(()=>qi({categoryAccessor:h,valueAccessor:g}),[h,g]),ee=Ya({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ee)return e.createElement(Ha,{componentName:"DotPlot",message:ee,width:D,height:I});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:V}),{oAccessor:h,rAccessor:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:Q,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:x,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:a.showAxes,oLabel:G,rLabel:Y,rFormat:p}),N&&{oFormat:N}),{showGrid:H,oSort:v}),X.legendBehaviorProps),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===k?()=>null:zi(k)||J}),(O||E||j||C)&&{customHoverBehavior:X.customHoverBehavior}),(E||j||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ds,{componentName:"DotPlot",width:D,height:I},e.createElement(Ko,Object.assign({ref:s},te)))});dl.displayName="DotPlot";const hl=c(function(o,r){var i,a;const s=Ia(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:M,legendPosition:P,color:L}=o,_=s.width,T=s.height,B=s.enableHover,N=s.showLegend,D=s.title,I=s.description,$=s.summary,H=s.accessibleTable,F=c||[],z=f||h,W=void 0===c,R=ms({data:F,rawData:c,colorBy:z,colorScheme:p,legendInteraction:M,legendPosition:P,selection:k,linkedHover:w,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:E,showLegend:N,userMargin:u,marginDefaults:s.marginDefaults,loading:j,emptyContent:C,width:_,height:T});if(R.earlyReturn)return R.earlyReturn;const G=ja(),Y=n(()=>new Map,[F]),q=n(()=>(e,t)=>z?R.colorScale?{fill:Ne(e,z,R.colorScale)}:{}:{fill:Ca(L,G,p,t,Y)},[z,R.colorScale,L,G,p,Y]),X=n(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},q(t,n)),e(t,n)||{}):q},[q,x]),V=n(()=>fa(X,R.effectiveSelectionHook,k),[X,R.effectiveSelectionHook,k]),U=n(()=>qi({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=Ya({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:Q}=Vs({ref:r,frameRef:l,isPushMode:W,colorBy:z,colorScheme:p,showLegend:N,legendPosition:P,setup:R}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:F}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[_,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q,enableHover:B}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Z),D&&{title:D}),I&&{description:I}),$&&{summary:$}),void 0!==H&&{accessibleTable:H}),d&&{className:d}),{tooltipContent:!1===v?()=>null:zi(v)||U}),(w||A||S||O)&&{customHoverBehavior:R.customHoverBehavior}),(A||S||w)&&{customClickBehavior:R.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(Ha,{componentName:"PieChart",message:K,width:_,height:T}):e.createElement(ds,{componentName:"PieChart",width:_,height:T},e.createElement(Ko,Object.assign({ref:l},J)))});hl.displayName="PieChart";const gl=c(function(o,r){var i,a;const s=Ia(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:f=60,centerContent:p,colorBy:y,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:_,color:T}=o,B=s.width,N=s.height,D=s.enableHover,I=s.showLegend,$=s.title,H=s.description,F=s.summary,z=s.accessibleTable,W=c||[],R=y||h,G=void 0===c,Y=ms({data:W,rawData:c,colorBy:R,colorScheme:m,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"DonutChart",chartId:C,showLegend:I,userMargin:u,marginDefaults:s.marginDefaults,loading:M,emptyContent:P,width:B,height:N});if(Y.earlyReturn)return Y.earlyReturn;const q=ja(),X=n(()=>new Map,[W]),V=n(()=>(e,t)=>R?Y.colorScale?{fill:Ne(e,R,Y.colorScale)}:{}:{fill:Ca(T,q,m,t,X)},[R,Y.colorScale,T,q,m,X]),U=n(()=>fa(V,Y.effectiveSelectionHook,A),[V,Y.effectiveSelectionHook,A]),K=n(()=>qi({categoryAccessor:h,valueAccessor:g,groupAccessor:y&&y!==h?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[h,g,y]),Z=Ya({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:J}=Vs({ref:r,frameRef:l,isPushMode:G,colorBy:R,colorScheme:m,showLegend:I,legendPosition:_,setup:Y}),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=c&&{data:W}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,innerRadius:f,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:p,size:[B,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Q),$&&{title:$}),H&&{description:H}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),{tooltipContent:!1===x?()=>null:zi(x)||K}),(S||O||E||j)&&{customHoverBehavior:Y.customHoverBehavior}),(O||E||S)&&{customClickBehavior:Y.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return Z?e.createElement(Ha,{componentName:"DonutChart",message:Z,width:B,height:N}):e.createElement(ds,{componentName:"DonutChart",width:B,height:N},e.createElement(Ko,Object.assign({ref:l},ee)))});gl.displayName="DonutChart";const fl=c(function(o,r){var i,a,s;const l=Ia(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:300,height:null!==(a=o.height)&&void 0!==a?a:250,enableHover:null===(s=o.enableHover)||void 0===s||s,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary}),c=t(null),{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!0,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:E={},className:j}=o,C=l.width,M=l.height,P=l.title,L=l.description,_=l.summary,T=l.accessibleTable,B=Math.max(d,Math.min(h,u)),N=h-d||1,D=(B-d)/N,{gaugeData:I,pieceStyle:$,gaugeAnnotations:H}=n(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],a=(i.value-r)/N;if(A){const o=(r-d)/N,s=Math.max(0,Math.min(D,(i.value-d)/N)-o),l=a-s;if(s>0){const o="fill-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:p,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:p},gaugeAnnotations:n}},[u,d,h,g,f,p,D,N,k,A]),F=w*Math.PI/180,z=180+(360-w)/2,W=-Math.PI/2+z*Math.PI/180,R=[[Math.cos(W),Math.sin(W)],[Math.cos(W+F),Math.sin(W+F)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-W)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>F+.001||R.push([Math.cos(e),Math.sin(e)]);const G=Math.min(...R.map(e=>e[0])),Y=Math.max(...R.map(e=>e[0])),q=Math.min(...R.map(e=>e[1])),X=Math.max(...R.map(e=>e[1])),V=(q+X)/2,U=(G+Y)/2,K=Math.max(10,Math.min((C-20)/(Y-G),(M-20)/(X-q))-4),Z=Math.max(10,K*(1-y)),Q=C/2-U*K,J=M/2-V*K,ee=2*(K+4),te=n(()=>{if(null!=b)return"function"==typeof b?b(B,d,h):b;const t=x?x(B):Math.round(B)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),k&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,B,d,h,x,k,K]),ne=n(()=>{if(!m)return null;const e=-Math.PI/2+z*Math.PI/180+D*F,t=Z-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,D,z,F,Z,v]),oe=n(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||C)/2},${(o.height||M)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+z*Math.PI/180+(t.value-d)/N*F,i=Z-14,a=(o.height||M)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||C)/2+Math.cos(r)*i,y:a+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[C,M,d,N,z,F,Z]),re=n(()=>{const e=[...H,...O||[]];return ne&&e.push(ne),e},[H,O,ne]),ie=n(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("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))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===I.length)return e.createElement(Ha,{componentName:"GaugeChart",message:"No data to display",width:C,height:M});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:I,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:Z,startAngle:z,sweepAngle:w,centerContent:te,size:[C,M],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:J-ee/2,bottom:M-J-ee/2,left:Q-ee/2,right:C-Q-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:zi(S)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),P&&{title:P}),L&&{description:L}),_&&{summary:_}),void 0!==T&&{accessibleTable:T}),j&&{className:j}),E);return e.createElement(ds,{componentName:"GaugeChart",width:C,height:M},e.createElement(Ko,Object.assign({ref:c},ae)))});fl.displayName="GaugeChart";const pl=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=i.width,I=i.height,$=i.enableHover,H=i.showGrid,F=i.showLegend,z=i.title,W=i.description,R=i.summary,G=i.accessibleTable,Y=i.categoryLabel,q=i.valueLabel,X=s||[],V=p||d,U=void 0===s,K=ms({data:X,rawData:s,colorBy:V,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"GroupedBarChart",chartId:M,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:D,height:I});if(K.earlyReturn)return K.earlyReturn;const Z=ja(),Q=n(()=>new Map,[X]),J=n(()=>(e,t)=>V?K.colorScale?{fill:Ne(e,V,K.colorScale)}:{}:{fill:Ca(B,Z,y,t,Q)},[V,K.colorScale,B,Z,y,Q]),ee=n(()=>fa(J,K.effectiveSelectionHook,S),[J,K.effectiveSelectionHook,S]),te=n(()=>qi({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ne=Ya({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:oe,effectiveMargin:re}=Vs({ref:r,frameRef:a,isPushMode:U,colorBy:V,colorScheme:y,showLegend:F,legendPosition:T,setup:K}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ee,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:q,rFormat:f}),N&&{oFormat:N}),{showGrid:H}),oe),z&&{title:z}),W&&{description:W}),R&&{summary:R}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===k?()=>null:zi(k)||te}),(O||E||j||C)&&{customHoverBehavior:K.customHoverBehavior}),(E||j||O)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ne?e.createElement(Ha,{componentName:"GroupedBarChart",message:ne,width:D,height:I}):e.createElement(ds,{componentName:"GroupedBarChart",width:D,height:I},e.createElement(Ko,Object.assign({ref:a},ie)))});pl.displayName="GroupedBarChart";const yl=c(function(o,r){const i=Ia(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:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N,rTickValues:D,tickLabelEdgeAlign:I,showCategoryTicks:$}=o,H=i.width,F=i.height,z=i.enableHover,W=i.showGrid,R=i.showLegend,G=i.title,Y=i.description,q=i.summary,X=i.accessibleTable,V=i.categoryLabel,U=i.valueLabel,K=s||[],Z=p||d,Q=void 0===s,J=ms({data:K,rawData:s,colorBy:Z,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:H,height:F}),ee=ol({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=ja(),ne=n(()=>new Map,[K]),oe=n(()=>(e,t)=>Z?J.colorScale?{fill:Ne(e,Z,J.colorScale)}:{}:{fill:Ca(B,te,y,t,ne)},[Z,J.colorScale,B,te,y,ne]),re=n(()=>fa(oe,J.effectiveSelectionHook,S),[oe,J.effectiveSelectionHook,S]),ie=n(()=>qi({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ae=Ya({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:se,effectiveMargin:le}=Vs({ref:r,frameRef:a,isPushMode:Q,colorBy:Z,colorScheme:y,showLegend:R,legendPosition:T,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le,barPadding:m,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===$?void 0:V,rLabel:U,rFormat:f}),D&&{rTickValues:D}),null!=I&&{tickLabelEdgeAlign:I}),N&&{oFormat:N}),void 0!==$&&{showCategoryTicks:$}),{showGrid:W}),se),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===v?()=>null:zi(v)||ie}),(O||E||j||C)&&{customHoverBehavior:J.customHoverBehavior}),(E||j||O)&&{customClickBehavior:J.customClickBehavior}),b&&b.length>0&&{annotations:b}),ee.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ae?e.createElement(Ha,{componentName:"SwimlaneChart",message:ae,width:H,height:F}):e.createElement(ds,{componentName:"SwimlaneChart",width:H,height:F},e.createElement(Ko,Object.assign({ref:a},ce)))});yl.displayName="SwimlaneChart";const ml=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ia(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:E,frameProps:j={},onObservation:C,onClick:M,chartId:P,selection:L,linkedHover:_,loading:T,emptyContent:B,legendInteraction:N,legendPosition:D}=o,I=s.width,$=s.height,H=s.enableHover,F=s.showLegend,z=null!==(i=s.showLabels)&&void 0!==i&&i,W=s.title,R=s.description,G=s.summary,Y=s.accessibleTable,q=ps(T,I,$),X=q?null:fs(l,I,$,B),V=l||[],U=c||[],K=Pa(V,m,v),Z=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Q=Na(N,m,Z),J=ja(),ee=n(()=>new Map,[]),te=n(()=>{if(Array.isArray(v))return v;if(J&&J.length>0)return J;const e=Pe[v];return Array.isArray(e)?e:Le},[v,J]),ne=n(()=>e=>{const t={};return t.fill=m?Ne(e.data||e,m,K):Ca(void 0,J,v,void 0,ee),"number"==typeof b&&(t.r=b),t},[m,K,b,J,v,ee]),oe=n(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),re=n(()=>{if(z&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[z,y]),{legend:ie,margin:ae,legendPosition:se}=Ba({data:V,colorBy:m,colorScale:K,showLegend:F,legendPosition:D,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ce}=_a({selection:L,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:M,chartType:"ForceDirectedGraph",chartId:P}),ue=Xa({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ue?e.createElement(Ha,{componentName:"ForceDirectedGraph",message:ue,width:I,height:$}):q||X||e.createElement(ds,{componentName:"ForceDirectedGraph",width:I,height:$},e.createElement(Ni,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:V},null!=c&&{edges:U},{size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ne,edgeStyle:oe,colorBy:m,colorScheme:te,nodeSize:b,nodeSizeRange:x,nodeLabel:re,showLabels:z,enableHover:H,tooltipContent:!1===E?()=>null:zi(E)||void 0,customHoverBehavior:_||C||M?le:void 0,customClickBehavior:C||M?ce:void 0,legend:ie,legendPosition:se},N&&"none"!==N&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:h,title:W,description:R,summary:G,accessibleTable:Y},j)))});function vl(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function bl(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function xl(e){return"function"==typeof e?e:t=>t[e]||1}function kl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}ml.displayName="ForceDirectedGraph";const wl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ia(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:E={},onObservation:j,onClick:C,chartId:M,selection:P,linkedHover:L,loading:_,emptyContent:T,legendInteraction:B}=o,N=s.width,D=s.height,I=s.enableHover,$=null===(i=s.showLabels)||void 0===i||i,H=s.title,F=s.description,z=s.summary,W=s.accessibleTable,R=ps(_,N,D),G=R?null:fs(c,N,D,T),Y=c||[],q=n(()=>bl(l,Y,g,f),[l,Y,g,f]),X=Pa(q,m,v),V=n(()=>{if(!m)return[];const e=new Set;for(const t of q){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[q,m]),U=Na(B,m,V),K=ja(),Z=n(()=>new Map,[]),Q=n(()=>{if(Array.isArray(v))return v;if(K&&K.length>0)return K;const e=Pe[v];return Array.isArray(e)?e:Le},[v,K]),J=q.length>0,ee=n(()=>{if(J)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Ne(e.data||e,m,X);else{const i=Array.isArray(v)?v:Pe[v]||Le,a=Array.isArray(i)?i:Le,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[J,m,X,v]),te=n(()=>{if(J)return kl({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:ee||(e=>({fill:Ca(void 0,K,v,void 0,Z)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[J,b,m,X,ee,S,K,v,Z]),ne=n(()=>{if(!$)return;const e=A||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[$,A,y]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:re,customClickBehavior:ie}=_a({selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ChordDiagram",chartId:M}),ae=Xa({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ae?e.createElement(Ha,{componentName:"ChordDiagram",message:ae,width:N,height:D}):R||G||e.createElement(ds,{componentName:"ChordDiagram",width:N,height:D},e.createElement(Ni,Object.assign({ref:a,chartType:"chord"},q.length>0&&{nodes:q},null!=c&&{edges:Y},{size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Q,edgeColorBy:b,edgeOpacity:S,nodeLabel:ne,showLabels:$,enableHover:I,tooltipContent:!1===O?()=>null:zi(O)||void 0,customHoverBehavior:L||j||C?re:void 0,customClickBehavior:j||C?ie:void 0},B&&"none"!==B&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:h,title:H,description:F,summary:z,accessibleTable:W},E)))});wl.displayName="ChordDiagram";const Al=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Ia(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:E,tooltip:j,frameProps:C={},onObservation:M,onClick:P,chartId:L,selection:_,linkedHover:T,loading:B,emptyContent:N,legendInteraction:D}=o,I=s.width,$=s.height,H=s.enableHover,F=null===(i=s.showLabels)||void 0===i||i,z=s.title,W=s.description,R=s.summary,G=s.accessibleTable,Y=ps(B,I,$),q=Y?null:fs(c,I,$,N),X=c||[],V=n(()=>bl(l,X,g,f),[l,X,g,f]),U=Pa(V,m,v),K=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Z=Na(D,m,K),Q=ja(),J=n(()=>new Map,[]),ee=n(()=>{if(Array.isArray(v))return v;if(Q&&Q.length>0)return Q;const e=Pe[v];return Array.isArray(e)?e:Le},[v,Q]),te=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Ne(e.data||e,m,U):Ca(void 0,Q,v,void 0,J),t},[m,U,Q,v,J]),ne=n(()=>kl({edgeColorBy:b,colorBy:m,colorScale:U,nodeStyleFn:te,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,U,te,O]),oe=n(()=>{if(!F)return;const e=S||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[F,S,y]),re=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=_a({selection:_,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,onClick:P,chartType:"SankeyDiagram",chartId:L}),se=Xa({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return se?e.createElement(Ha,{componentName:"SankeyDiagram",message:se,width:I,height:$}):Y||q||e.createElement(ds,{componentName:"SankeyDiagram",width:I,height:$},e.createElement(Ni,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=c&&{edges:X},{size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:te,edgeStyle:ne,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:O,edgeSort:E,nodeLabel:oe,showLabels:F,enableHover:H,tooltipContent:!1===j?()=>null:zi(j)||void 0,customHoverBehavior:T||M||P?ie:void 0,customClickBehavior:M||P?ae:void 0},D&&"none"!==D&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:z,description:W,summary:R,accessibleTable:G},C)))});function Sl(t){var o;const r=Ia(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:i,margin:a,className:s,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:E,legendInteraction:j}=t,C=r.width,M=r.height,P=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=ps(E,C,M),I=n(()=>vl(null!=i?i:null,u),[i,u]),$=Pa(I,p?void 0:g,f),H=n(()=>{if(!g||p)return[];const e=new Set;for(const t of I){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[I,g,p]),F=Na(j,p?void 0:g,H),z=ja(),W=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(f))return f;if(z&&z.length>0)return z;const e=Pe[f];return Array.isArray(e)?e:Le},[f,z]),G=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Te[(e.depth||0)%Te.length]:g?Ne(e.data||e,g,$):Ca(void 0,z,f,void 0,W),t},[g,p,$,z,f,W]),Y=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),q=n(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return xl(d)},[l,d]),X=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:U}=_a({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),K=qa({componentName:"TreeDiagram",data:i});return K?e.createElement(Ha,{componentName:"TreeDiagram",message:K,width:C,height:M}):D||e.createElement(ds,{componentName:"TreeDiagram",width:C,height:M},e.createElement(Ni,Object.assign({chartType:l},null!=i&&{data:i},{size:[C,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:q,treeOrientation:c,edgeType:y,nodeStyle:G,edgeStyle:Y,colorBy:g,colorScheme:R,colorByDepth:p,nodeSize:v,nodeLabel:L?m||h:void 0,showLabels:L,enableHover:P,tooltipContent:!1===b?()=>null:zi(b)||void 0,customHoverBehavior:O||k||w?V:void 0,customClickBehavior:k||w?U:void 0},j&&"none"!==j&&{legendHoverBehavior:F.onLegendHover,legendClickBehavior:F.onLegendClick,legendHighlightedCategory:F.highlightedCategory,legendIsolatedCategories:F.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function Ol(t){var o;const r=Ia(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:i,margin:a,className:s,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:E,legendInteraction:j}=t,C=r.width,M=r.height,P=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=ps(E,C,M),{activeSelectionHook:I,customHoverBehavior:$,customClickBehavior:H}=_a({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),F=l(e=>{if(!e)return $(null);const t=e.data||e;$({data:(null==t?void 0:t.data)||t})},[$]),z=n(()=>vl(null!=i?i:null,c),[i,c]),W=Pa(z,f?void 0:h,g),R=n(()=>{if(!h||f)return[];const e=new Set;for(const t of z){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[z,h,f]),G=Na(j,f?void 0:h,R),Y=ja(),q=n(()=>new Map,[]),X=n(()=>{if(Array.isArray(g))return g;if(Y&&Y.length>0)return Y;const e=Pe[g];return Array.isArray(e)?e:Le},[g,Y]),V=n(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Te[(e.depth||0)%Te.length]:h?Ne(e.data||e,h,W):Ca(void 0,Y,g,void 0,q),t},[h,f,W,Y,g,q]),U=n(()=>I?e=>{var t;const n=Object.assign({},V(e));if(I.isActive)if(I.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(n,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(n,k.unselectedStyle)}return n}:V,[V,I,k]),K=n(()=>xl(u),[u]),Z=void 0!==v?v:!L||"parent"!==p&&"all"!==p?void 0:18,Q=Object.assign(Object.assign({},r.marginDefaults),a),J=qa({componentName:"Treemap",data:i});return J?e.createElement(Ha,{componentName:"Treemap",message:J,width:C,height:M}):D||e.createElement(ds,{componentName:"Treemap",width:C,height:M},e.createElement(Ni,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[C,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,padding:m,paddingTop:Z,nodeStyle:U,colorBy:h,colorScheme:X,colorByDepth:f,nodeLabel:L?y||d:void 0,showLabels:L,labelMode:p,enableHover:P,tooltipContent:!1===b?()=>null:zi(b)||void 0},(w||A||S)&&{customHoverBehavior:F},(A||S)&&{customClickBehavior:H},j&&"none"!==j&&{legendHoverBehavior:G.onLegendHover,legendClickBehavior:G.onLegendClick,legendHighlightedCategory:G.highlightedCategory,legendIsolatedCategories:G.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function El(t){var o;const r=Ia(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:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O}=t,E=r.width,j=r.height,C=r.enableHover,M=null===(o=r.showLabels)||void 0===o||o,P=r.title,L=r.description,_=r.summary,T=r.accessibleTable,B=ps(S,E,j),N=n(()=>vl(null!=i?i:null,l),[i,l]),D=Pa(N,g?void 0:d,h),I=n(()=>{if(!d||g)return[];const e=new Set;for(const t of N){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[N,d,g]),$=Na(O,g?void 0:d,I),H=ja(),F=n(()=>new Map,[]),z=n(()=>{if(Array.isArray(h))return h;if(H&&H.length>0)return H;const e=Pe[h];return Array.isArray(e)?e:Le},[h,H]),W=n(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?Te[(e.depth||0)%Te.length]:d?Ne(e.data||e,d,D):Ca(void 0,H,h,void 0,F),t},[d,g,D,p,H,h,F]),R=n(()=>xl(c),[c]),G=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:Y,customClickBehavior:q}=_a({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),X=qa({componentName:"CirclePack",data:i});return X?e.createElement(Ha,{componentName:"CirclePack",message:X,width:E,height:j}):B||e.createElement(ds,{componentName:"CirclePack",width:E,height:j},e.createElement(Ni,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:R,padding:y,nodeStyle:W,colorBy:d,colorScheme:z,colorByDepth:g,nodeLabel:M?f||u:void 0,showLabels:M,enableHover:C,tooltipContent:!1===m?()=>null:zi(m)||void 0,customHoverBehavior:A||b||x?Y:void 0,customClickBehavior:b||x?q:void 0},O&&"none"!==O&&{legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:$.isolatedCategories},{className:s,title:P,description:L,summary:_,accessibleTable:T},v)))}Al.displayName="SankeyDiagram",Sl.displayName="TreeDiagram",Ol.displayName="Treemap",El.displayName="CirclePack";const jl=Te;function Cl(t){const o=Ia(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:r,margin:i,className:a,childrenAccessor:s="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:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:E,onClick:j,chartId:C,selection:M,linkedHover:P,loading:L}=t,_=o.width,T=o.height,B=o.enableHover,N=o.title,D=o.description,I=o.summary,$=o.accessibleTable,H=ps(L,_,T),F=Pa(n(()=>vl(r,s),[r,s]),d?void 0:c,u),z=ja(),W=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(u))return u;if(z&&z.length>0)return z;const e=Pe[u];return Array.isArray(e)?e:Le},[u,z]),G=n(()=>{if(Array.isArray(u))return u;const e=Pe[u];return Array.isArray(e)?e:Le},[u]),Y=n(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?G[0]:jl[(e.depth||0)%jl.length]:c?Ne(e.data||e,c,F):Ca(void 0,z,u,void 0,W),n.opacity=o?1:.85,n},[c,d,F,G,z,u,W]),q=n(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),X=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:V,customClickBehavior:U}=_a({selection:M,linkedHover:P,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:E,onClick:j,chartType:"OrbitDiagram",chartId:C}),K=n(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Z=n(()=>{if(U)return e=>{U(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[U]),Q=qa({componentName:"OrbitDiagram",data:r});return Q?e.createElement(Ha,{componentName:"OrbitDiagram",message:Q,width:_,height:T}):H||e.createElement(ds,{componentName:"OrbitDiagram",width:_,height:T},e.createElement(Ni,Object.assign({chartType:"orbit"},null!=r&&{data:r},{size:[_,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Y,edgeStyle:q,colorBy:c,colorScheme:R,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&B,tooltipContent:k?void 0:!1===w?()=>null:zi(w)||void 0,customHoverBehavior:P||E||j?K:void 0,customClickBehavior:E||j?Z:void 0,foregroundGraphics:A,annotations:S,className:a,title:N,description:D,summary:I,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:$},O)))}Cl.displayName="OrbitDiagram";const Ml=c(function(n,o){var r,i,a,s;const c=Ia(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,background:E,tooltipContent:j,tooltip:C,onHover:M,annotations:P,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,linkedHover:$,selection:H,onObservation:F,chartId:z,loading:W,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=j?j:C,Z=t(null),{customHoverBehavior:Q}=_a({selection:H,linkedHover:$,unwrapData:!0,onObservation:F,chartType:"RealtimeLineChart",chartId:z}),J=l(e=>{M&&M(e),Q(e)},[M,Q]);u(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,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},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:[]}}));const ee=ps(W,U[0],U[1]),te=ee?null:fs(m,U[0],U[1],R),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return ee||te||e.createElement(mo,{ref:Z,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:E,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:P,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,pointIdAccessor:n.pointIdAccessor,legendPosition:Y})});Ml.displayName="RealtimeLineChart";const Pl=c(function(n,o){var r,i,a,s;const c=Ia(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:E,stroke:j,strokeWidth:C,gap:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:$,selection:H,decay:F,pulse:z,staleness:W,transition:R,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U,brush:K,onBrush:Z,linkedBrush:Q}=n,J=c.showAxes,ee=c.enableHover,te=null!=g?g:c.marginDefaults,ne=null!=h?h:[c.width,c.height],oe=null!=L?L:_,re=t(null),{customHoverBehavior:ie}=_a({selection:H,linkedHover:$,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),ae=l(e=>{T&&T(e),ie(e)},[T,ie]),se=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,le=ga(Q),ce=ia(Object.assign({name:(null==le?void 0:le.name)||"__unused_hist_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof b?b:"time")},(null==le?void 0:le.yField)?{yField:le.yField}:{})),ue=t(ce.brushInteraction);ue.current=ce.brushInteraction;const de=l(e=>{if(Z&&Z(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}),le){const t=ue.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)}},[Z,G,Y,le]);u(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=re.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=re.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const he=ps(q,ne[0],ne[1]),ge=he?null:fs(v,ne[0],ne[1],X),fe={};return null!=E&&(fe.fill=E),null!=j&&(fe.stroke=j),null!=C&&(fe.strokeWidth=C),null!=M&&(fe.gap=M),he||ge||e.createElement(mo,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:te,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:O,barStyle:fe,showAxes:J,background:P,hoverAnnotation:ee,tooltipContent:oe,customHoverBehavior:ae,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,decay:F,pulse:z,staleness:W,transition:R,pointIdAccessor:n.pointIdAccessor,legendPosition:U,brush:se||(Q?{dimension:"x"}:void 0),onBrush:se||Q?de:void 0})});Pl.displayName="RealtimeTemporalHistogram";const Ll=Pl,_l=c(function(n,o){var r,i,a,s;const c=Ia(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:E,opacity:j,stroke:C,strokeWidth:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:$,selection:H,onObservation:F,chartId:z,loading:W,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Z=t(null),{customHoverBehavior:Q}=_a({selection:H,linkedHover:$,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:z}),J=l(e=>{T&&T(e),Q(e)},[T,Q]);u(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,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},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:[]}}));const ee=ps(W,U[0],U[1]),te=ee?null:fs(m,U[0],U[1],R),ne={};return null!=O&&(ne.radius=O),null!=E&&(ne.fill=E),null!=j&&(ne.opacity=j),null!=C&&(ne.stroke=C),null!=M&&(ne.strokeWidth=M),ee||te||e.createElement(mo,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});_l.displayName="RealtimeSwarmChart";const Tl=c(function(n,o){var r,i,a,s;const c=Ia(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:E,gap:j,stroke:C,strokeWidth:M,background:P,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:$,selection:H,onObservation:F,chartId:z,loading:W,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Z=t(null),{customHoverBehavior:Q}=_a({selection:H,linkedHover:$,unwrapData:!0,onObservation:F,chartType:"RealtimeWaterfallChart",chartId:z}),J=l(e=>{T&&T(e),Q(e)},[T,Q]);u(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,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},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:[]}}));const ee=ps(W,U[0],U[1]),te=ee?null:fs(m,U[0],U[1],R),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=E&&(ne.connectorWidth=E),null!=j&&(ne.gap=j),null!=C&&(ne.stroke=C),null!=M&&(ne.strokeWidth=M),ee||te||e.createElement(mo,{ref:Z,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});Tl.displayName="RealtimeWaterfallChart";const Bl=c(function(n,o){var r,i,a,s;const c=Ia(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:E="count",background:j,tooltipContent:C,tooltip:M,onHover:P,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,linkedHover:$,selection:H,onObservation:F,chartId:z,loading:W,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=C?C:M,Z=t(null),{customHoverBehavior:Q}=_a({selection:H,linkedHover:$,unwrapData:!0,onObservation:F,chartType:"RealtimeHeatmap",chartId:z}),J=l(e=>{P&&P(e),Q(e)},[P,Q]);u(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,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},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:[]}}));const ee=ps(W,U[0],U[1]),te=ee?null:fs(m,U[0],U[1],R);return ee||te||e.createElement(mo,{ref:Z,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:E,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});function Nl(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}Bl.displayName="RealtimeHeatmap";const Dl=864e5;function Il(e){return 10>e?"0"+e:e+""}const $l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hl(e){let t,n=e;return(o,r,i)=>{const a=o instanceof Date?o:new Date(o);e||!i||2>i.length||i===t||(t=i,n=function(e){if(2>e.length)return"days";const t=[];for(let n=1;e.length>n;n++)t.push(e[n]-e[n-1]);t.sort((e,t)=>e-t);const n=t[Math.floor(t.length/2)];return 12e4>n?"seconds":72e5>n?"minutes":2*Dl>n?"hours":60*Dl>n?"days":400*Dl>n?"months":"years"}(i));const s=n||"days";return null!=r&&0!==r&&i&&0!==i.length?function(e,t,n){const o=e.getUTCFullYear()!==t.getUTCFullYear(),r=o||e.getUTCMonth()!==t.getUTCMonth(),i=r||e.getUTCDate()!==t.getUTCDate(),a=i||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=$l[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Il(e.getUTCHours()),h=Il(e.getUTCMinutes()),g=Il(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:i?`${l} ${c} ${d}:${h}:${g}`:a?`${d}:${h}:${g}`:s?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return o?`${l} ${c}, ${u} ${d}:00`:r?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return o?`${l} ${c}, ${u}`:r?`${l} ${c}`:""+c;case"months":return o?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(i[r-1]),s):function(e,t){const n=$l[e.getUTCMonth()],o=e.getUTCDate(),r=e.getUTCFullYear(),i=Il(e.getUTCHours()),a=Il(e.getUTCMinutes()),s=Il(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${r} ${i}:${a}:${s}`;case"minutes":case"hours":return`${n} ${o}, ${r} ${i}:${a}`;case"days":return`${n} ${o}, ${r}`;case"months":return`${n} ${r}`;case"years":return""+r}}(a,s)}}function Fl(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function zl(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Wl(e,t){return ks(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Rl(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Gl(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*r,n=l.height*r,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,n),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),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),a.toBlob(n=>{n?(Gl(n,o+".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 Rl(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["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 a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Rl(o[e],r[e])}function Gl(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const Yl=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"]),ql=new Set(["data","nodes","edges"]),Xl="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Vl(e,t,n){if(!Ja[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Ja).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Yl.has(e)||!o&&ql.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Xl(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Ul(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Ja[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Xl(e.props)}}function Kl(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zl(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 n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Ql(e){return ks(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Jl(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(n)})}function Jl(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function ec(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function tc(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function nc(e){return"nominal"===e||"ordinal"===e}function oc(e){return"quantitative"===e||"temporal"===e}const rc={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"},ic={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"},ac={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function sc(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f;const p=[],{type:y,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,k=v.color,w=v.size,A=v.theta,S=v.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.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 E={};e.width&&(E.width=e.width),e.height&&(E.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(E.title=j),(null==k?void 0:k.field)&&(E.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=rc[k.scale.scheme];e&&(E.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(E.pointOpacity=S.value);const C=null==b?void 0:b.aggregate,M=null==x?void 0:x.aggregate;if(O&&(C||M)){const e=M?x:b,t=M?b:x,n=ac[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(O,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const n of O){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}O=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(E.data=O),(null==b?void 0:b.bin)?(E.valueAccessor=b.field,(null==x?void 0:x.field)&&(E.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(E.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(E.valueAccessor=x.field,(null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(E.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(E.bins=t),cc(e,E,p)}let P;switch(y){case"bar":P=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.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",o.stackBy=n.field):g="BarChart",nc(null==e?void 0:e.type)&&oc(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):oc(null==e?void 0:e.type)&&nc(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,k,E,O,C,M);break;case"line":if(P="LineChart",lc(b,x,E,C,M),(null==k?void 0:k.field)&&(E.lineBy=k.field),m.interpolate){const e=ic[m.interpolate];e&&(E.curve=e)}!0===m.point&&(E.showPoints=!0),O&&(E.data=O);break;case"area":if((null==k?void 0:k.field)?(P="StackedAreaChart",E.areaBy=k.field):P="AreaChart",lc(b,x,E,C,M),m.interpolate){const e=ic[m.interpolate];e&&(E.curve=e)}void 0!==m.opacity&&(E.areaOpacity=m.opacity),O&&(E.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(P="BubbleChart",E.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(E.sizeRange=w.scale.range)):P="Scatterplot",lc(b,x,E,C,M),O&&(E.data=O);break;case"rect":P="Heatmap",(null==b?void 0:b.field)&&(E.xAccessor=b.field),(null==x?void 0:x.field)&&(E.yAccessor=x.field),(null==k?void 0:k.field)&&(E.valueAccessor=k.field,delete E.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(E.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(E.yLabel=x.axis.title),O&&(E.data=O);break;case"arc":m.innerRadius&&m.innerRadius>0?(P="DonutChart",E.innerRadius=m.innerRadius):P="PieChart",(null==A?void 0:A.field)?E.valueAccessor=A.field:(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field),(null==k?void 0:k.field)&&(E.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(E.categoryAccessor=b.field),O&&(E.data=O);break;case"tick":P="DotPlot",nc(null==b?void 0:b.type)?(E.categoryAccessor=b.field,(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(E.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(E.valueLabel=x.axis.title)):nc(null==x?void 0:x.type)?(E.categoryAccessor=x.field,(null==b?void 0:b.field)&&(E.valueAccessor=C?"value":b.field),E.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(E.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(E.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null==x?void 0:x.field)&&(E.valueAccessor=M?"value":x.field)),O&&(E.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),P="Scatterplot",lc(b,x,E,C,M),O&&(E.data=O)}return cc(P,E,p)}function lc(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function cc(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}function uc(){const t=function(){const t=e.useContext(sn);return t?()=>t.setVisible(e=>!e):null}();return t?e.createElement("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:pc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"}))):null}const dc={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 hc({height:t}){return e.createElement("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 gc({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const fc=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:p},y){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),k=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),w=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S=!0===(null==a?void 0:a.dataSummary),O="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",j=e.useCallback(e=>ks(this,void 0,void 0,function*(){v.current&&(yield Wl(v.current,Object.assign(Object.assign({},O),e)))}),[O]),C=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),M=e.useCallback(e=>ks(this,void 0,void 0,function*(){s&&(yield Ql(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(y,()=>({export:j,toggleFullscreen:C,copyConfig:M,element:m.current}),[j,C,M]);const P=t||n||l||k||w||A||S||h,L=c?e.createElement(hc,{height:i}):u?e.createElement(gc,{error:u}):d?e.createElement(Fa,null,o):o;return _=e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:r,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"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},P&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,k&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Export chart","aria-label":"Export chart",style:pc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),S&&e.createElement(uc,null),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:C,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:pc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>M(),title:"Copy config","aria-label":"Copy chart configuration",style:pc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("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:dc[h].bg,color:dc[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},b?{flex:1}:{height:i})},L,g))),S?e.createElement(ln,null,_):_;var _}),pc={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 yc({children:t,columns:n="auto",minCellWidth:o=300,gap:r=16,className:i,style:a}){const s="number"==typeof n?n:void 0;return e.createElement("div",{className:"semiotic-chart-grid"+(i?" "+i:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a)},e.Children.map(t,t=>e.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==s&&2>s?t:e.createElement("div",{style:{gridColumn:"span 2"}},t):t))}function mc({children:t,context:n,position:o="right",contextSize:r=250,gap:i=12,className:a,style:s}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:i,width:"100%"},s),d=l?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return e.createElement("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u},e.createElement("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0}},t),e.createElement("div",{style:d},n))}yc.displayName="ChartGrid",mc.displayName="ContextLayout";function vc({children:n,position:i="right",size:a=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:f,style:p}){const[y,m]=r(null),[v,b]=r(null),[x,k]=r(!1),[w,A]=r(!1),S=t(null),O=t(),E="click"===s?["click","click-end"]:["hover","hover-end"],{latest:j}=sa({types:E,chartId:c,limit:1}),C=void 0!==u?u:j;o(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(O.current),O.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==C.type&&"hover-end"!==C.type||M()},[C]),o(()=>{null==g||g(x)},[x,g]);const M=l(()=>{A(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(O.current),[]),!y&&!w)return null;const P=y&&v?n(y,v):null;if(null===P&&!w)return null;const L=function(e,t,n,o){const r={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:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?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)"})}(i,a,x,w);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${i}${f?" "+f:""}`,style:Object.assign(Object.assign({},L),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:bc},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},P))}const bc={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};vc.displayName="DetailsPanel";export{Es as AreaChart,Xs as BarChart,al as BoxPlot,Ps as BubbleChart,ya as CARBON_ALERT,pa as CARBON_CATEGORICAL_14,Tn as COLOR_BLIND_SAFE_CATEGORICAL,Vi as CategoryColorProvider,fc as ChartContainer,Fa as ChartErrorBoundary,yc as ChartGrid,wl as ChordDiagram,El as CirclePack,xs as ConnectedScatterplot,mc as ContextLayout,Nn as DARK_THEME,vc as DetailsPanel,gl as DonutChart,dl as DotPlot,ml as ForceDirectedGraph,ul as FunnelChart,fl as GaugeChart,pl as GroupedBarChart,Dn as HIGH_CONTRAST_THEME,Ms as Heatmap,sl as Histogram,Se as IncrementalExtent,Bn as LIGHT_THEME,nl as LikertChart,Os as LineChart,da as LinkedCharts,Fs as MinimapChart,qs as MultiAxisLineChart,Fi as MultiLineTooltip,Cl as OrbitDiagram,hl as PieChart,zs as QuadrantChart,Bl as RealtimeHeatmap,Ll as RealtimeHistogram,Ml as RealtimeLineChart,_l as RealtimeSwarmChart,Pl as RealtimeTemporalHistogram,Tl as RealtimeWaterfallChart,cl as RidgelinePlot,Ae as RingBuffer,Al as SankeyDiagram,vs as Scatterplot,$s as ScatterplotMatrix,Cs as StackedAreaChart,Us as StackedBarChart,Ni as StreamNetworkFrame,Ko as StreamOrdinalFrame,mo as StreamXYFrame,rl as SwarmPlot,yl as SwimlaneChart,ma as THEME_PRESETS,Sa as ThemeProvider,Hi as Tooltip,Sl as TreeDiagram,Ol as Treemap,ll as ViolinPlot,Hl as adaptiveTimeTicks,Jl as configToJSX,Ql as copyConfig,Ho as createHatchPattern,Fl as darkenColor,tc as deserializeSelections,Wl as exportChart,Ul as fromConfig,Zl as fromURL,sc as fromVegaLite,zl as lightenColor,zi as normalizeTooltip,va as resolveThemePreset,ec as serializeSelections,Nl as smartTickFormat,ba as themeToCSS,xa as themeToTokens,Vl as toConfig,Kl as toURL,ia as useBrushSelection,Ui as useCategoryColors,sa as useChartObserver,aa as useFilteredData,ra as useLinkedHover,oa as useSelection,Oa as useTheme};