semiotic 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/ai/dist/componentRegistry.js +5 -0
- package/ai/dist/mcp-server.js +378 -46
- package/ai/dist/renderHOCToSVG.js +5 -3
- package/ai/schema.json +1 -1
- package/dist/components/charts/shared/ChartError.d.ts +3 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +1 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +1 -0
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/xy-statisticalOverlays-C1f7TYyD.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +50 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as a,useCallback as s,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{brushX as h,brushY as g,brush as y}from"d3-brush";import{select as p}from"d3-selection";import{scaleOrdinal as f,scaleLinear as m,scaleSequential as v,scaleLog as b,scaleBand as x}from"d3-scale";import{interpolatePlasma as k,interpolateViridis as w,interpolatePurples as A,interpolateOranges as S,interpolateGreens as E,interpolateReds as O,interpolateBlues as P,schemeSet3 as L,schemeTableau10 as M,schemeCategory10 as j}from"d3-scale-chromatic";import{quadtree as C}from"d3-quadtree";import{bin as N,quantile as D,min as _,groups as B,max as H,sum as W,mean as T,group as I}from"d3-array";import{packEnclose as $,hierarchy as z,partition as R,pack as F,treemap as G,treemapBinary as Y,cluster as q,tree as X}from"d3-hierarchy";import{area as V,curveCatmullRom as U,curveCardinal as K,curveBasis as Q,curveStepBefore as Z,curveStepAfter as J,curveStep as ee,curveMonotoneY as te,curveMonotoneX as ne,curveLinear as oe,arc as re,line as ie,curveNatural as ae,pie as se}from"d3-shape";import le from"regression";import{interpolateNumber as ce}from"d3-interpolate";import{forceLink as ue,forceSimulation as de,forceManyBody as he,forceCenter as ge,forceX as ye,forceY as pe}from"d3-force";import{ribbon as fe,chord as me}from"d3-chord";class ve{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 be{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 xe{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 ke(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 we(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 Ae(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 Se(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 Ee(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 Oe(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 Pe(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Le(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 je={category10:j,tableau10:M,set3:L,blues:P,reds:O,greens:E,oranges:S,purples:A,viridis:w,plasma:k},Ce=j,Ne=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],De=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],_e=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 Be(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")||_e.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):Ce[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+""))%Ce.length]}function He(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return f().domain(o).range(n).unknown("#999");const i=je[n]||je.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:Ce;return f().domain(o).range(e).unknown("#999")}}function We(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 Te(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Ie(e,t){return Math.min((e-t.startTime)/t.duration,1)}function $e(e,t,n){return e+(t-e)*n}function ze(){return"undefined"!=typeof performance?performance.now():Date.now()}class Re{constructor(e){this.xExtent=new xe,this.yExtent=new xe,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._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._quadtree=null,this.config=e,this.buffer=new be(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Pe(e.timeAccessor||e.xAccessor,"time"),this.getY=Pe(e.valueAccessor||e.yAccessor,"value")):(this.getX=Pe(e.xAccessor,"x"),this.getY=Pe(e.yAccessor,"y")),this.getGroup=Me(e.groupAccessor),this.getCategory=Me(e.categoryAccessor),this.getSize=e.sizeAccessor?Pe(e.sizeAccessor,"size"):void 0,this.getColor=Me(e.colorAccessor),this.getBounds=e.boundsAccessor?Pe(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?Pe(e.y0Accessor,"y0"):void 0,this.getPointId=Me(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=Pe(e.openAccessor,"open"),this.getHigh=Pe(e.highAccessor,"high"),this.getLow=Pe(e.lowAccessor,"low"),this.getClose=Pe(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new be(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){this.buffer.clear(),this.xExtent.clear(),this.yExtent.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.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;const{config:s,buffer:l}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===s.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.getBufferArray(),u=this.xExtent.extent,d=this.yExtent.extent;let h=s.xExtent?[null!==(t=s.xExtent[0])&&void 0!==t?t:u[0],null!==(n=s.xExtent[1])&&void 0!==n?n:u[1]]:u,g=s.yExtent?[null!==(o=s.yExtent[0])&&void 0!==o?o:d[0],null!==(r=s.yExtent[1])&&void 0!==r?r:d[1]]:d;const y=s.yExtent&&null!=s.yExtent[0]&&null!=s.yExtent[1];if("stackedarea"===s.chartType&&!y&&l.size>0)if(s.normalize)g=[0,1+s.extentPadding];else{const e=`${l.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)g=this._stackExtentCache.yDomain;else{const t=this.groupData(c),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);g=[0,o+(o>0?o*s.extentPadding:1)],this._stackExtentCache={key:e,yDomain:g}}}else if("bar"===s.chartType&&s.binSize&&!y&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ke(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]}(l,this.getX,this.getY,s.binSize,this.getCategory);g=[0,e+e*s.extentPadding]}else if("waterfall"===s.chartType&&!y&&l.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]}(l,this.getY),n=t-e,o=n>0?n*s.extentPadding:1;g=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!y&&g[0]!==1/0){if(this.getBounds)for(const e of c){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>g[1]&&(g[1]=t+n),g[0]>t-n&&(g[0]=t-n))}const e=g[1]-g[0],t=e>0?e*s.extentPadding:1,n=null===(i=s.yExtent)||void 0===i?void 0:i[0],o=null===(a=s.yExtent)||void 0===a?void 0:a[1];g=[null!=n?g[0]:g[0]-t,null!=o?g[1]:g[1]+t],"log"===s.yScaleType&&0>=g[0]&&d[0]>0&&(g[0]=null!=n?g[0]:d[0]/(1+s.extentPadding))}if(h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),g[0]!==1/0&&g[1]!==-1/0||(g=[0,1]),"streaming"===s.runtimeMode)if("x"==("up"===(p=s.arrowOfTime)||"down"===p?"y":"x")){const t="right"===s.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:m().domain(h).range(t),y:m().domain(g).range([e.height,0])}}else{const t="down"===s.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:m().domain(g).range([0,e.width]),y:m().domain(h).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 b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:t(s.xScaleType,h,[0,e.width]),y:t(s.yScaleType,g,[e.height,0])}}var p;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,c),this.config.decay&&this.applyDecay(this.scene,c),this.config.pulse&&this.applyPulse(this.scene,c),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>Re.QUADTREE_THRESHOLD?C().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 b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:s(this.config.xScaleType,o,[i[0]*t,i[1]*t]),y:s(this.config.yScaleType,r,[a[0]*n,a[1]*n])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o||0===t.length)return[];switch(n.chartType){case"line":return this.buildLineScene(t);case"area":return this.buildAreaScene(t);case"stackedarea":return this.buildStackedAreaScene(t);case"scatter":case"bubble":return this.buildPointScene(t);case"heatmap":return this.buildHeatmapScene(t,e);case"bar":return this.buildBarScene(t);case"swarm":return this.buildSwarmScene(t);case"waterfall":return this.buildWaterfallScene(t,e);case"candlestick":return this.buildCandlestickScene(t,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=we(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),this.config.curve&&"linear"!==this.config.curve&&(n.curve=this.config.curve),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]),r=Ae(e.data,this.scales,this.getX,this.getY,o,t,e.key,this.getY0);this.config.gradientFill&&(r.fillGradient=this.config.gradientFill),this.config.curve&&"linear"!==this.config.curve&&(r.curve=this.config.curve),n.push(r)}return n}buildStackedAreaScene(e){const t=this.groupData(e);return t.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0),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;for(const e of c)g.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[];for(const n of c){let r=e.get(n)||0;const a=g.get(n);i&&(r/=d.get(n));const l=t.x(n);s.push([l,t.y(a)]),o.push([l,t.y(a+r)]),g.set(n,a+r)}const l={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(l.curve=a),h.push(l)}return h}(t,this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize,this.config.curve&&"linear"!==this.config.curve?this.config.curve:void 0)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){let e=1/0,n=-1/0;for(const o of t)e>o&&(e=o),o>n&&(n=o);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}const i=this.getColor?this.resolveColorMap(e):null;for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},a=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(a=r(e))}if(i&&this.getColor&&!e.fill){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const s=this.getPointId?this.getPointId(o)+"":void 0,l=Se(o,this.scales,this.getX,this.getY,a,e,s);l&&t.push(l)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=Pe(this.config.valueAccessor,"value"),r=Le(this.config.xAccessor,"x"),i=Le(this.config.yAccessor,"y"),a=new Set,s=new Set;for(const t of e)a.add(r(t)),s.add(i(t));const l=Array.from(a),c=Array.from(s),u=l.every(e=>"number"==typeof e&&!isNaN(e)),d=c.every(e=>"number"==typeof e&&!isNaN(e)),h=u?l.sort((e,t)=>e-t):l,g=d?c.sort((e,t)=>e-t):c;if(0===h.length||0===g.length)return n;const y=t.width/h.length,p=t.height/g.length,f=new Map;for(const t of e){const e=`${r(t)}\0${i(t)}`;f.set(e,{val:o(t),datum:t})}let m=1/0,b=-1/0;for(const{val:e}of f.values())m>e&&(m=e),e>b&&(b=e);const x=v({blues:P,reds:O,greens:E,viridis:w}["string"==typeof this.config.colorScheme?this.config.colorScheme:"blues"]||P).domain([m,b]);for(let e=0;h.length>e;e++)for(let t=0;g.length>t;t++){const o=f.get(`${h[e]}\0${g[t]}`);if(!o)continue;const r=x(o.val);n.push(Oe(e*y,(g.length-1-t)*p,y,p,r,o.datum,this.config.showValues?{value:o.val,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],a=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,s=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=Pe(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,g]=this.scales.y.domain(),y=(d-u||1)/a,p=(g-h||1)/s,f=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/y),a-1),r=Math.min(Math.floor((n-h)/p),s-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=f.get(i);l||(l={sum:0,count:0,data:[]},f.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of f){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,k=t.width/a,w=t.height/s;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,a=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=f.get(e);i.push(Oe(r*k,(s-1-a)*w,k,w,c,{xi:r,yi:a,value:t,count:u.count,sum:u.sum,data:u.data},this.config.showValues?{value:t,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ke(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort(),a=t.filter(t=>e.has(t)),s=a.join("\0")+""+i.join("\0");this._barCategoryCache&&this._barCategoryCache.key===s?o=this._barCategoryCache.order:(o=[...a,...i],this._barCategoryCache={key:s,order:o})}const r=[],i=this.scales,[a,s]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,a),l=Math.min(e.end,s);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.abs(u-c),h=d>2?1:0,g=Math.min(c,u)+h/2,y=Math.max(d-h,1);if(y>0)if(o&&e.categories.size>0){let n=0;for(const a of o){const o=e.categories.get(a)||0;if(0===o)continue;const s=i.y(n),l=i.y(n+o);r.push(Ee(g,Math.min(s,l),y,Math.abs(s-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[a])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:o},a)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(Ee(g,Math.min(t,n),y,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],a=this.config.swarmStyle||{},s=null!==(t=a.radius)&&void 0!==t?t:3,l=null!==(n=a.fill)&&void 0!==n?n:"#007bff",c=null!==(o=a.opacity)&&void 0!==o?o:.7,u=a.stroke,d=a.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),a=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}const g={type:"point",x:o,y:a,r:s,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t};this.getPointId&&(g.pointId=this.getPointId(t)+""),i.push(g)}return i}buildWaterfallScene(e,t){var n,o,r;const i=[],a=this.scales,s=this.config.waterfallStyle,l=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===l.length)return i;const c=null!==(n=null==s?void 0:s.positiveColor)&&void 0!==n?n:"#28a745",u=null!==(o=null==s?void 0:s.negativeColor)&&void 0!==o?o:"#dc3545",d=null!==(r=null==s?void 0:s.gap)&&void 0!==r?r:1,h=null==s?void 0:s.stroke,g=null==s?void 0:s.strokeWidth;let y=0;for(let e=0;l.length>e;e++){const n=l[e],o=this.getX(n),r=this.getY(n),p=y+r;let f;f=l.length-1>e?this.getX(l[e+1])-o:e>0?o-this.getX(l[e-1]):0;const m=a.x(o),v=0!==f?a.x(o+f):m+t.width/10,b=Math.min(m,v)+d/2,x=Math.max(m,v)-d/2-b;if(0>=x){y=p;continue}const k=a.y(y),w=a.y(p);i.push(Ee(b,Math.min(k,w),x,Math.abs(k-w),{fill:0>r?u:c,stroke:h,strokeWidth:g},Object.assign(Object.assign({},n),{baseline:y,cumEnd:p,delta:r,_connectorStroke:null==s?void 0:s.connectorStroke,_connectorWidth:null==s?void 0:s.connectorWidth}))),y=p}return i}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",a=o.wickColor||"#333",s=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:a,wickWidth:s,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),a=this.scales.x(e);if(i&&0!==i)n.push([a,this.scales.y(r+i)]),o.push([a,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([a,e]),o.push([a,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}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){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("line"===t.type){const e=Array.isArray(t.datum)?t.datum:[];if(2>e.length)continue;const n=Array(e.length);let o=!1;for(let t=0;e.length>t;t++){const a=i.get(e[t]);null!=a?(n[t]=this.computeDecayOpacity(a,r),1>n[t]&&(o=!0)):n[t]=1}o&&(t._decayOpacities=n);continue}if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[],n=t.topPath?t.topPath.length:e.length;if(2>n)continue;if(e.length===n){const o=Array(n);let a=!1;for(let t=0;e.length>t;t++){const n=i.get(e[t]);null!=n?(o[t]=this.computeDecayOpacity(n,r),1>o[t]&&(a=!0)):o[t]=1}a&&(t._decayOpacities=o)}else{let o=1;for(const t of e){const e=i.get(t);if(null!=e){const t=this.computeDecayOpacity(e,r);o>t&&(o=t)}}if(1>o){const e=Array(n);e.fill(o),t._decayOpacities=e}}continue}const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:a};else if("candlestick"===t.type)t._decayOpacity=a;else{const e=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:e*a})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",a=null!==(o=this.config.pulse.glowRadius)&&void 0!==o?o:4,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type)continue;if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[t.datum];let n=0;for(const t of e){const e=s.get(t);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=this.computePulseIntensity(o,r);i>n&&(n=i)}n>0&&(t._pulseIntensity=n,t._pulseColor=i);continue}const e=s.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=this.computePulseIntensity(n,r);o>0&&(t._pulseIntensity=o,t._pulseColor=i,t._pulseGlowRadius=a)}}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}snapshotPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();for(let o=0;this.scene.length>o;o++){const r=this.scene[o],i=this.getNodeIdentity(r,o);i&&("point"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,r:r.r,opacity:r.style.opacity}):"rect"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:r.style.opacity}):"heatcell"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:null===(e=r.style)||void 0===e?void 0:e.opacity}):"candlestick"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.openY}):"line"===r.type?this.prevPathMap.set(i,{path:r.path.map(e=>[e[0],e[1]]),opacity:null===(t=r.style)||void 0===t?void 0:t.opacity}):"area"===r.type&&this.prevPathMap.set(i,{topPath:r.topPath.map(e=>[e[0],e[1]]),bottomPath:r.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(n=r.style)||void 0===n?void 0:n.opacity}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===this.config.runtimeMode&&e.datum){if(this.getCategory)return`p:${this.getCategory(e.datum)}:${this.getY(e.datum)}`;const t=this.getX(e.datum),n=this.getY(e.datum);if(null!=t&&null!=n)return`p:${t}:${n}`}return"p:"+t;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+t:"c:"+this.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d,h,g,y,p,f,m,v,b,x,k,w,A,S,E;if(!this.config.transition||0===this.prevPositionMap.size&&0===this.prevPathMap.size)return;const O=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 P=!1;const L=new Set,M=new Set;for(let e=0;this.scene.length>e;e++){const f=this.scene[e],m=this.getNodeIdentity(f,e);if(!m)continue;if(f._transitionKey=m,"line"===f.type||"area"===f.type){const e=this.prevPathMap.get(m);if(e){if(M.add(m),"line"===f.type&&e.path&&e.path.length===f.path.length){f._targetPath=f.path.map(e=>[e[0],e[1]]),f._prevPath=e.path;for(let t=0;f.path.length>t;t++)f.path[t]=[e.path[t][0],e.path[t][1]];P=!0}else if("area"===f.type&&e.topPath&&e.bottomPath&&e.topPath.length===f.topPath.length&&e.bottomPath.length===f.bottomPath.length){f._targetTopPath=f.topPath.map(e=>[e[0],e[1]]),f._targetBottomPath=f.bottomPath.map(e=>[e[0],e[1]]),f._prevTopPath=e.topPath,f._prevBottomPath=e.bottomPath;for(let t=0;f.topPath.length>t;t++)f.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;f.bottomPath.length>t;t++)f.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];P=!0}f._targetOpacity=null!==(t=f.style.opacity)&&void 0!==t?t:1}else f._targetOpacity=null!==(n=f.style.opacity)&&void 0!==n?n:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;continue}const v=this.prevPositionMap.get(m);if("point"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,r:f.r};f._targetOpacity=null!==(o=f.style.opacity)&&void 0!==o?o:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetR=e.r,f.x=v.x,f.y=v.y,f.r=null!==(r=v.r)&&void 0!==r?r:f.r,P=!0)}else f._targetOpacity=null!==(i=f.style.opacity)&&void 0!==i?i:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;else if("rect"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(a=f.style.opacity)&&void 0!==a?a:1,v.x===e.x&&v.y===e.y&&v.w===e.w&&v.h===e.h||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(s=v.w)&&void 0!==s?s:f.w,f.h=null!==(l=v.h)&&void 0!==l?l:f.h,P=!0)}else f._targetOpacity=null!==(c=f.style.opacity)&&void 0!==c?c:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;else if("heatcell"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(d=null===(u=f.style)||void 0===u?void 0:u.opacity)&&void 0!==d?d:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(h=v.w)&&void 0!==h?h:f.w,f.h=null!==(g=v.h)&&void 0!==g?g:f.h,P=!0)}else f._targetOpacity=null!==(p=null===(y=f.style)||void 0===y?void 0:y.opacity)&&void 0!==p?p:1,f.style=Object.assign(Object.assign({},f.style||{}),{opacity:0}),P=!0}for(const[e,t]of this.prevPathMap)if(!M.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(f=t.opacity)&&void 0!==f?f:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),P=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(m=t.opacity)&&void 0!==m?m:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),P=!0}for(const[e,t]of this.prevPositionMap)if(!L.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(v=t.r)&&void 0!==v?v:3,style:{opacity:null!==(b=t.opacity)&&void 0!==b?b:1},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(x=t.w)&&void 0!==x?x:0,h:null!==(k=t.h)&&void 0!==k?k:0,style:{opacity:null!==(w=t.opacity)&&void 0!==w?w:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(A=t.w)&&void 0!==A?A:0,h:null!==(S=t.h)&&void 0!==S?S:0,fill:"#999",datum:null,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1},_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}P=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),P&&(this.activeTransition={startTime:ze(),duration:O})}advanceTransition(e){var t,n,o,r,i,a;if(!this.activeTransition)return!1;const s=Ie(e,this.activeTransition),l=Te(s,"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("point"===e.type){if(void 0!==e._targetOpacity){const o=t?this.prevPositionMap.get(t):void 0,r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=$e(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=$e(o.x,e._targetX,l),e.y=$e(o.y,e._targetY,l),void 0!==e._targetR&&void 0!==o.r&&(e.r=$e(o.r,e._targetR,l))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=$e(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,l),e.y=$e(n.y,e._targetY,l),void 0!==n.w&&(e.w=$e(n.w,e._targetW,l)),void 0!==n.h&&(e.h=$e(n.h,e._targetH,l))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:$e(o,e._targetOpacity,l)})}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,l),e.y=$e(n.y,e._targetY,l),void 0!==n.w&&(e.w=$e(n.w,e._targetW,l)),void 0!==n.h&&(e.h=$e(n.h,e._targetH,l))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevPath&&e._targetOpacity>0?0:null!==(i=e.style.opacity)&&void 0!==i?i:1;e.style=Object.assign(Object.assign({},e.style),{opacity:$e(t,e._targetOpacity,l)})}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]=$e(t[o][0],n[o][0],l),e.path[o][1]=$e(t[o][1],n[o][1],l)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevTopPath&&e._targetOpacity>0?0:null!==(a=e.style.opacity)&&void 0!==a?a:1;e.style=Object.assign(Object.assign({},e.style),{opacity:$e(t,e._targetOpacity,l)})}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]=$e(t[n][0],o[n][0],l),e.topPath[n][1]=$e(t[n][1],o[n][1],l);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=$e(n[t][0],r[t][0],l),e.bottomPath[t][1]=$e(n[t][1],r[t][1],l)}}if(s>=1){for(const e of this.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(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}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:Ne,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:Ne,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()}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._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){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),Object.assign(this.config,e),(void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Pe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Pe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Pe(this.config.xAccessor,"x"),this.getY=Pe(this.config.yAccessor,"y"))),void 0!==e.groupAccessor&&(this.getGroup=Me(this.config.groupAccessor)),void 0!==e.categoryAccessor&&(this.getCategory=Me(this.config.categoryAccessor)),void 0!==e.sizeAccessor&&(this.getSize=this.config.sizeAccessor?Pe(this.config.sizeAccessor,"size"):void 0),void 0!==e.colorAccessor&&(this.getColor=Me(this.config.colorAccessor)),void 0!==e.y0Accessor&&(this.getY0=this.config.y0Accessor?Pe(this.config.y0Accessor,"y0"):void 0),void 0!==e.pointIdAccessor&&(this.getPointId=Me(this.config.pointIdAccessor)),this.needsFullRebuild=!0}}function Fe(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 Ge(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Ye(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function qe(e,t,n){var o,r,i,a;if(0===e.path.length)return null;const s=Ze(e.path,t);if(0>s)return null;const[l,c]=e.path[s];let u;if(e.path.length>1){let o=1/0;const r=Math.max(0,s-1),i=Math.min(e.path.length-2,s);for(let a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=Xe(t,n,r,i,s,l);o>c&&(o=c)}u=o}else{const e=t-l,o=n-c;u=Math.sqrt(e*e+o*o)}const d=null!==(a=null!==(r=null===(o=e.style)||void 0===o?void 0:o.strokeWidth)&&void 0!==r?r:null===(i=e.style)||void 0===i?void 0:i.lineWidth)&&void 0!==a?a:1;return u>Math.max(5,d/2+2)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:l,y:c,distance:u}}function Xe(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 Ve(e,t,n){const o=Fe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ue(e,t,n){const o=Fe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ke(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 Qe(e,t,n){if(0===e.topPath.length)return null;const o=Ze(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 Ze(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 Je(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function et(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 tt(e,r,i){const a=t(null),[s,l]=n(null);return o(()=>{if(!r&&!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()},[r,i]),[a,[r&&s?s.w:e[0],i&&s?s.h:e[1]]]}function nt(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])}Re.QUADTREE_THRESHOLD=500;const ot={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 rt(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,ot[n])(o(e,t)),r}function it(){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 at(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function st({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 lt(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),[y,p]=e.useState(0),f=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,y=[];let p=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=rt(t,u,d,h),b=at(t,r,i),x=i&&i.size>0&&i.has(t.label);y.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:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?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:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&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(it,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),y})(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:y,onFocusedIndexChange:f,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 o=0;t.label&&(o+=16);const y=((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,y=[];let p=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=rt(t,u,d,h),b=at(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(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:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&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(it,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=26+7*t.label.length}),{items:y,offset:p}})(t,r,i,a,s,l,c,n,u,d);o+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:o})),h+=o+12});let y=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(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),y+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${y},0)`},o.items)),y+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:y,y1:-8,x2:y,y2:n+0+8})),y+=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:y,onFocusedIndexChange:f,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"},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 ct(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 y,p;return"left"===a?(y=4,p=i.top):"top"===a?(y=0,p=s?32:8):"bottom"===a?(y=0,p=r-i.bottom+50):(y=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${y}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(st,{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(lt,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function ut(e){return"string"==typeof e?{type:e}:e}function dt({orient:t,config:n,values:o,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}}(n),c="top"===t||"bottom"===t,u=r(()=>{if(0===o.length)return null;const n=i.domain(),r=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)}}(o);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*r,20),y=(r-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(y+g/2),x2:p,y2:m+f*(y+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*y,x2:c,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+f*y,x2:p,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-y-g:m+y,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-y-g:m+y,x2:r,y2:"top"===t?m-y:m+y+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(y+g/2),y1:c,x2:m+f*(y+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:c,x2:m+f*(y+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:p,x2:m+f*(y+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-y-g:m+y,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-y-g:m+y,y1:r,x2:"left"===t?m-y:m+y+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=N().domain(n).thresholds(l.bins)(o);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,o)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*r;if(c){const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:r,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 r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:"left"===t?-4-a:4,y:Math.min(r,r+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=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(r/2),s=i((e.x0+e.x1)/2);o.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*(r/2),l=i((a.x0+a.x1)/2);o.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:o.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,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-o-4:o+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,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-o-4:o+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},[o,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function ht(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 gt(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 yt(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:y,events:p={},"data-testid":f}=t,m=new Set(Array.isArray(y)?y:[]);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":f},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||"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||"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||"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||"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||"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||"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||"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||"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:gt((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||"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 y=16,p=a?u?[a]:ht(a,c):[],f=i?u?[i]:ht(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),v=p.length*y),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let x=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),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(p.length+f.length)*y+(f.length>0?y:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,p.length+f.length-1)*y;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+y+(f.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},b),x)}(l,v,b,h))}function pt(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(yt,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(yt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}const ft={linear:oe,monotoneX:ne,monotoneY:te,step:ee,stepAfter:J,stepBefore:Z,basis:Q,cardinal:K,catmullRom:U};function mt(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 vt(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 bt(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=mt(e,n),c=vt(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 xt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function kt(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,y,p,f,m,v,b,x,k,w,A,S,E,O,P,L,M,j,C,N,D,_,B,H,W,T,I,z,R,F,G,Y,q,X,U;switch(t.type){case"label":{const r=bt(t,n,o);if(!r)return null;const{x:i,y:a}=r;return xt(i,a,o)?e.createElement(pt,{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=bt(t,n,o);if(!r)return null;const{x:i,y:a}=r;return xt(i,a,o)?e.createElement(pt,{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=mt(t,o);if(null==r)return null;const i=t.color||"#f97316";return 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:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=vt(t,o);if(null==r)return null;const i=t.color||"#f97316";return 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:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=$(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||"#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||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>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||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#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=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=mt(n,o),s=vt(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=mt(t,o),i=vt(t,o);return e.createElement(pt,{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",y=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.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,f=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||!f)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,y=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],y+=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*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?le.polynomial(y,{order:t.order||2}):le.linear(y)).points;const b=v.map(([e,t])=>`${p(e)},${f(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:f(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!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y: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||"#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||"#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===(f=o.scales)||void 0===f?void 0:f.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"]||oe,g=V().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const y=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:y,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:y,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===(E=o.scales)||void 0===E?void 0:E.time,s=null!==(P=null===(O=o.scales)||void 0===O?void 0:O.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.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,y=!1!==t.showBand,p=t.fill||"#6366f1",f=null!==(j=t.fillOpacity)&&void 0!==j?j:.1,m=t.anomalyColor||"#ef4444",v=null!==(C=t.anomalyRadius)&&void 0!==C?C: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},y&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:f}),k.map((t,n)=>{const r=mt(t,o),i=vt(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!==(D=null===(N=o.scales)||void 0===N?void 0:N.x)&&void 0!==D?D:null===(_=o.scales)||void 0===_?void 0:_.time,l=null!==(H=null===(B=o.scales)||void 0===B?void 0:B.y)&&void 0!==H?H:null===(W=o.scales)||void 0===W?void 0:W.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=le.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)),y=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),f=null!==(T=t.confidence)&&void 0!==T?T:.95,m=.99>f?.95>f?.9>f?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-y,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(" "),E=`${s(b)},${l(u(b))}`,O=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.createElement("polyline",{points:`${E} ${S}`,fill:"none",stroke:O,strokeWidth:null!==(R=t.strokeWidth)&&void 0!==R?R:2,strokeDasharray:null!==(F=t.strokeDasharray)&&void 0!==F?F:"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:O,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=bt(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!xt(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!==(U=t.content)&&void 0!==U?U: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=bt(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)}default:return null}}}function wt(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 At(t){const{width:n,height:o,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,y=r(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||h||St,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return l.x.ticks(Math.min(r,Math.max(2,Math.floor(n/70)))).map(e=>({value:e,pixel:l.x(e),label:o(e)}))},[l,u,h,n]),p=r(()=>{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||St,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return l.y.ticks(Math.min(r,Math.max(2,Math.floor(o/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)}))},[l,u,g,o]),f=d&&l,m=c&&l;if(!f&&!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})`},f&&e.createElement("g",{className:"stream-grid"},y.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),p.map((t,o)=>e.createElement("line",{key:"ygrid-"+o,x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),x&&!w&&e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:wt("bottom",n,o),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:wt("left",n,o),fill:"none",stroke:S,strokeWidth:1})))}function St(e){return Math.round(100*e)/100+""}function Et(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function Ot(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,axes:g,xLabel:y,yLabel:p,xFormat:f,yFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:E="right",foregroundGraphics:O,marginalGraphics:P,xValues:L,yValues:M,annotations:j,svgAnnotationRules:C,xAccessor:N,yAccessor:D,annotationData:_,pointNodes:B,curve:H,underlayRendered:W,children:T}=n,I=r(()=>{var e;if(!h||!d)return[];const t=null==g?void 0:g.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||f||St,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))).map(e=>({value:e,pixel:d.x(e),label:n(e)}))},[h,d,g,f,a]),$=r(()=>{var e;if(!h||!d)return[];const t=null==g?void 0:g.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||m||St,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)}))},[h,d,g,m,s]),z=t(new Map),R=t(null!==(o=null==j?void 0:j.length)&&void 0!==o?o:0),F=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;R.current!==F&&(R.current=F,z.current=new Map);const G=r(()=>{if(!j||0===j.length)return null;const e=kt(),t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:a,height:s,data:_,frameType:"xy",pointNodes:B,curve:H,stickyPositionCache:z.current};return j.map((n,o)=>{if(C){const r=C(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[j,C,a,s,N,D,_,d,B,H]);return h||b||x||O||P||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof b?b:"XY Chart"),e.createElement("desc",null,"string"==typeof b?b+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!W&&e.createElement("g",{className:"stream-grid"},I.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),$.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:a,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&(()=>{const t=null==g?void 0:g.find(e=>"left"===e.orient),n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, #666)",f="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes"},!W&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!W&&i&&e.createElement("path",{d:wt("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),I.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):Et(t.value,n>0?I[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},y),!W&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!W&&r&&e.createElement("path",{d:wt("left",a,s),fill:"none",stroke:d,strokeWidth:1}),$.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Et(t.value,n>0?$[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}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))})(),G,P&&d&&L&&M&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(dt,{orient:"top",config:ut(P.top),values:L,scale:d.x,size:u.top,length:a})),P.bottom&&e.createElement("g",{transform:`translate(0, ${s})`},e.createElement(dt,{orient:"bottom",config:ut(P.bottom),values:L,scale:d.x,size:u.bottom,length:a})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(dt,{orient:"left",config:ut(P.left),values:M,scale:d.y,size:u.left,length:s})),P.right&&e.createElement("g",{transform:`translate(${a}, 0)`},e.createElement(dt,{orient:"right",config:ut(P.right),values:M,scale:d.y,size:u.right,length:s}))),O,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),ct({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:E,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}const Pt="undefined"==typeof window||"undefined"==typeof document,Lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Mt(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"},i=["point","line","area","rect","heatcell","circle","candlestick"],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 jt(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(", ")}`}function Ct({scene:t,chartType:n}){var o,r,i,a;const s=[];for(const e of t){if(s.length>=50)break;"point"===e.type?s.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?s.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&s.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(a=e.value)&&void 0!==a?a:0))/100+""}})}if(0===s.length)return null;const l=new Set;for(const e of s)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:Lt,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,s.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function Nt({nodes:t,chartType:n}){var o,r,i,a,s;const l=[];for(const e of t){if(l.length>=50)break;l.push({values:{id:(null===(o=e.datum)||void 0===o?void 0:o.id)||e.id||"",x:Math.round(100*(null!==(i=null!==(r=e.cx)&&void 0!==r?r:e.x)&&void 0!==i?i:0))/100+"",y:Math.round(100*(null!==(s=null!==(a=e.cy)&&void 0!==a?a:e.y)&&void 0!==s?s:0))/100+""}})}if(0===l.length)return null;const c=new Set;for(const e of l)for(const t of Object.keys(e.values))c.add(t);const u=Array.from(c);return e.createElement("table",{style:Lt,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,u.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,l.map((t,n)=>e.createElement("tr",{key:n},u.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:u.length},"...and ",t.length-50," more items"))))}function Dt({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:Lt},n)}function _t(n){const o=i(null),c=Bt(n);return[function({children:t}){const i=r(()=>Bt(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=a(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(r.getState()),[r]),d=s(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function Bt(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 Ht={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}},Wt={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}},[Tt,It]=_t(e=>({theme:Ht,setTheme(t){e(e=>"light"===t?{theme:Ht}:"dark"===t?{theme:Wt}:{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 $t(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 zt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Rt(e){switch(e){case"monotoneX":return ne;case"monotoneY":return te;case"cardinal":return K;case"catmullRom":return U;case"step":return ee;case"stepBefore":return Z;case"stepAfter":return J;case"basis":return Q;case"natural":return ae;default:return null}}function Ft(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 Gt(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()}}function Yt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function qt(e,t,n=.3){Yt(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 Xt(e,t,n=.6){var o,r,i,a,s;if(!Yt(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 Vt(e,t,n,o=.35){Yt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ut(e){switch(e){case"monotoneX":return ne;case"monotoneY":return te;case"cardinal":return K;case"catmullRom":return U;case"step":return ee;case"stepBefore":return Z;case"stepAfter":return J;case"basis":return Q;case"natural":return ae;default:return null}}function Kt(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 Qt(e,t){const n=Ut(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=V().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 Zt=(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(Qt(e,t),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=Kt(n),a=t.fillGradient.topOpacity,l=t.fillGradient.bottomOpacity,c=e.createLinearGradient(0,o,0,r);c.addColorStop(0,`rgba(${i[0]},${i[1]},${i[2]},${a})`),c.addColorStop(1,`rgba(${i[0]},${i[1]},${i[2]},${l})`),e.fillStyle=c,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&&(Qt(e,t),Vt(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=s,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Ut(t.curve);if(e.beginPath(),n)ie().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}},Jt=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);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()),Xt(e,t),e.globalAlpha=1}}finally{e.restore()}},en=(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?tn(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))),qt(e,t),e.globalAlpha=1};function tn(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 nn(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 on(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const rn={line:[Zt,(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;Gt(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Rt(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!g){e.strokeStyle=l;const f=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(y[m]+y[m+1])*f,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 E=0;s.path.length>E;E++){const[O,P]=s.path[E],L=d[E],M=Ft(L,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(O,P);else{const j=[];for(const C of u){const N=C.value;(x>N||N>L)&&(N>x||L>N)||x===N||L===N||j.push({t:(N-x)/(L-x)})}j.sort((e,t)=>e.t-t.t);for(const D of j){const _=v+(O-v)*D.t,B=b+(P-b)*D.t,H=Ft(x+(L-x)*Math.min(D.t+1e-4,1),u,l);e.lineTo(_,B),S(),A(H,_,B)}e.lineTo(O,P)}v=O,b=P,x=L,k=M}else A(M,O,P),v=O,b=P,x=L,k=M}S()}else{if(e.beginPath(),e.strokeStyle=l,h)ie().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[W,T]=s.path[0];e.moveTo(W,T);for(let I=1;s.path.length>I;I++)e.lineTo(s.path[I][0],s.path[I][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)ie().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[z,R]=s.path[0];e.moveTo(z,R);for(let F=1;s.path.length>F;F++)e.lineTo(s.path[F][0],s.path[F][1])}const $=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo($,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}}],area:[Zt],stackedarea:[Zt],scatter:[Jt],bubble:[Jt],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),qt(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):on(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=nn(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[en],swarm:[Jt],waterfall:[(e,t,n,o)=>{var r,i,a;en(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;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();const r=Math.min(t.openY,t.closeY),i=Math.abs(t.openY-t.closeY),a=t.isUp?t.upColor:t.downColor;e.fillStyle=a,e.fillRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.strokeStyle=a,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.restore()}}]},an={top:20,right:20,bottom:30,left:40},sn={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"},ln={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 cn({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:ln},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function un({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,dimension:l,scales:c,onBrush:u}){const d=t(null),f=t(null),m=t(u);m.current=u;const v=t(c);return v.current=c,o(()=>{if(!d.current)return;const e=p(d.current).select(".brush-g"),t="x"===l?h():"y"===l?g():y();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{const t=v.current;if(!t)return;if(!e.selection)return void m.current(null);let o,i;if("x"===l){const[n,a]=e.selection;o=[t.x.invert(n),t.x.invert(a)],i=[t.y.invert(r),t.y.invert(0)]}else if("y"===l){const[r,a]=e.selection;o=[t.x.invert(0),t.x.invert(n)],i=[t.y.invert(a),t.y.invert(r)]}else{const[[n,r],[a,s]]=e.selection;o=[t.x.invert(n),t.x.invert(a)],i=[t.y.invert(s),t.y.invert(r)]}m.current({x:o,y:i})}),e.call(t),f.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),f.current=null}},[n,r,l]),e.createElement("svg",{ref:d,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`}))}const dn=c(function(i,a){var l,c,d,h,g,y,p,f,m;const{chartType:v,runtimeMode:b,data:x,chunkThreshold:k,chunkSize:w,xAccessor:A,yAccessor:S,colorAccessor:E,sizeAccessor:O,groupAccessor:P,lineDataAccessor:L,curve:M,normalize:j,binSize:C,valueAccessor:N,arrowOfTime:D="right",windowMode:_="sliding",windowSize:B=200,timeAccessor:H,xExtent:W,yExtent:T,extentPadding:I=.1,sizeRange:$,size:z=[500,300],responsiveWidth:R,responsiveHeight:F,margin:G,className:Y,background:q,lineStyle:X,pointStyle:V,areaStyle:U,waterfallStyle:K,swarmStyle:Q,barColors:Z,colorScheme:J,boundsAccessor:ee,boundsStyle:te,y0Accessor:ne,gradientFill:oe,openAccessor:re,highAccessor:ie,lowAccessor:ae,closeAccessor:se,candlestickStyle:le,showAxes:ce=!0,axes:ue,xLabel:de,yLabel:he,xFormat:ge,yFormat:ye,tickFormatTime:pe,tickFormatValue:fe,hoverAnnotation:me,tooltipContent:be,customHoverBehavior:xe,enableHover:ke,annotations:we,svgAnnotationRules:Ae,showGrid:Se,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,backgroundGraphics:Ce,foregroundGraphics:Ne,canvasPreRenderers:De,title:_e,categoryAccessor:Be,brush:He,onBrush:We,decay:Te,pulse:Ie,transition:$e,staleness:ze,heatmapAggregation:Fe,heatmapXBins:Ge,heatmapYBins:Xe,showValues:Ze,heatmapValueFormat:ot,marginalGraphics:rt,pointIdAccessor:it,xScaleType:at,yScaleType:st,accessibleTable:lt}=i,[ct,ut]=tt(z,R,F),dt=Object.assign(Object.assign({},an),G);if(rt){const e=60;rt.top&&e>dt.top&&(dt.top=e),rt.bottom&&e>dt.bottom&&(dt.bottom=e),rt.left&&e>dt.left&&(dt.left=e),rt.right&&e>dt.right&&(dt.right=e)}const ht=ut[0]-dt.left-dt.right,gt=ut[1]-dt.top-dt.bottom,yt="function"==typeof Ne?Ne({size:ut,margin:dt}):Ne,pt="function"==typeof Ce?Ce({size:ut,margin:dt}):Ce,ft=null!=me?me:ke,mt=t(null),vt=t(null),bt=t(0),xt=t(!1),kt=It(e=>e.theme),[wt,St]=n(0),[Et,Lt]=n(null),jt=t(null),Nt=t(null),[_t,Bt]=n(null),[Ht,Wt]=n(!1),[Tt,Rt]=n([]),[Ft,Gt]=n([]),Yt=t(()=>{}),qt="streaming"===b||["bar","swarm","waterfall"].includes(v),Xt=r(()=>({chartType:v,runtimeMode:qt?"streaming":"bounded",windowSize:B,windowMode:_,arrowOfTime:qt?D:"right",extentPadding:I,xAccessor:qt?void 0:A,yAccessor:qt?void 0:S,timeAccessor:qt?H:void 0,valueAccessor:N,colorAccessor:E,sizeAccessor:O,groupAccessor:P,categoryAccessor:Be,lineDataAccessor:L,xScaleType:at,yScaleType:st,xExtent:W,yExtent:T,sizeRange:$,binSize:C,normalize:j,boundsAccessor:ee,boundsStyle:te,y0Accessor:ne,gradientFill:"boolean"==typeof oe?oe?{topOpacity:.8,bottomOpacity:.05}:void 0:oe,openAccessor:re,highAccessor:ie,lowAccessor:ae,closeAccessor:se,candlestickStyle:le,lineStyle:X,pointStyle:V,areaStyle:U,swarmStyle:Q,waterfallStyle:K,colorScheme:J,barColors:Z,annotations:we,decay:Te,pulse:Ie,transition:$e,staleness:ze,heatmapAggregation:Fe,heatmapXBins:Ge,heatmapYBins:Xe,showValues:Ze,heatmapValueFormat:ot,pointIdAccessor:it,curve:M}),[v,B,_,D,I,A,S,H,N,at,st,E,O,P,Be,L,W,T,$,C,j,ee,te,ne,oe,re,ie,ae,se,le,X,V,U,Q,K,J,Z,we,Te,Ie,$e,ze,Fe,Ge,Xe,Ze,ot,qt,it,M]),Vt=t(null);Vt.current||(Vt.current=new Re(Xt));const Ut=s(()=>{bt.current||(bt.current=requestAnimationFrame(()=>Yt.current()))},[]);o(()=>{var e;null===(e=Vt.current)||void 0===e||e.updateConfig(Xt),xt.current=!0,Ut()},[Xt,Ut]),o(()=>{xt.current=!0,Ut()},[kt,Ut]);const Kt=t(null);Kt.current||(Kt.current=new ve(e=>{const t=Vt.current;t&&t.ingest(e)&&(xt.current=!0,Ut())},{chunkThreshold:k,chunkSize:w})),o(()=>{var e;null===(e=Kt.current)||void 0===e||e.updateChunkOptions({chunkThreshold:k,chunkSize:w})},[k,w]);const Qt=s(e=>{var t;null===(t=Kt.current)||void 0===t||t.push(e)},[]),Zt=s(e=>{var t;null===(t=Kt.current)||void 0===t||t.pushMany(e)},[]),Jt=s(()=>{var e,t;null===(e=Kt.current)||void 0===e||e.clear(),null===(t=Vt.current)||void 0===t||t.clear(),xt.current=!0,Ut()},[Ut]);u(a,()=>({push:Qt,pushMany:Zt,clear:Jt,getData:()=>{var e,t,n;return null===(e=Kt.current)||void 0===e||e.flush(),null!==(n=null===(t=Vt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Vt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Vt.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Qt,Zt,Jt]),o(()=>{var e;x&&(null===(e=Kt.current)||void 0===e||e.setBoundedData(x))},[x]);const en=t(()=>{}),tn=t(()=>{});en.current=e=>{if(!ft)return;const t=mt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-dt.left,r=e.clientY-n.top-dt.top;if(0>o||o>ht||0>r||r>gt)return void(jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&(xe(null),xt.current=!0),Ut()));const i=Vt.current;if(!i||0===i.scene.length)return;const a=function(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=Ye(e,t,n);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=Ye(s,t,n);break;case"line":e=qe(s,t,n);break;case"rect":e=Ve(s,t,n);break;case"heatcell":e=Ue(s,t,n);break;case"area":if(!1===s.interactive)break;e=Qe(s,t,n);break;case"candlestick":e=Ke(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(i.scene,o,r,30,i.quadtree);if(!a)return void(jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&xe(null),Ut()));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});jt.current=l,Nt.current=a.node,Bt(l),xe&&(xe(l),xt.current=!0),Ut()},tn.current=()=>{jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&(xe(null),xt.current=!0),Ut())},s(e=>en.current(e),[]);const nn=s(()=>tn.current(),[]),on=t(-1),ln=s(e=>{const t=Vt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum});break;case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n]});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n]});break}case"rect":case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=0>on.current?-1:on.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return on.current=-1,jt.current=null,Nt.current=null,Bt(null),xe&&xe(null),void Ut();const i=0>o?0:r;on.current=i;const a=et(n[i]);jt.current=a,Bt(a),xe&&xe(a),Ut()},[xe,Ut]),dn=s(e=>{on.current=-1,en.current(e)},[]);Yt.current=()=>{var e,t;bt.current=0;const n=mt.current,o=vt.current;if(!n||!o)return;const r=Vt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=xt.current||a;s&&!a&&r.computeScene({width:ht,height:gt});const l=zt(),c=function(e){if(!e)return sn;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||sn.axisStroke,tickText:i||sn.tickText,crosshair:i?i+"66":sn.crosshair,hoverFill:l?l+"4D":sn.hoverFill,hoverStroke:i?i+"99":sn.hoverStroke,pointRing:l||sn.pointRing}:sn}(n),u=null!==(e=null==ze?void 0:ze.threshold)&&void 0!==e?e:5e3,d=ze&&r.lastIngestTime>0&&i-r.lastIngestTime>u;if(s){const e=$t(n,ut,dt,l);if(e){e.clearRect(-dt.left,-dt.top,ut[0],ut[1]),d&&(e.globalAlpha=null!==(t=null==ze?void 0:ze.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=q||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-dt.left,-dt.top,ut[0],ut[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ht,gt),e.clip()),De&&r.scales)for(const t of De)e.save(),t(e,r.scene,r.scales,{width:ht,height:gt}),e.restore();const a=rn[v];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:ht,height:gt});e.restore(),d&&(e.globalAlpha=1)}}{const e=$t(o,ut,dt,l);if(e&&(ft&&jt.current&&r.scales&&function(e,t,n,o,r,i,a){if(!1===r.crosshair)return;e.save();const s="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=s.stroke||a.crosshair,e.lineWidth=s.strokeWidth||1,e.setLineDash(s.strokeDasharray?s.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}(e,jt.current,ht,gt,"object"==typeof ft?ft:{},0,c),Nt.current&&Array.isArray(me))){const t=me.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,Nt.current,t)}}s&&n&&n.setAttribute("aria-label",Mt(r.scene,v+" chart"));const h=xt.current;if(xt.current=!1,h&&r.scales&&((!Et||Et.x.domain()[0]!==r.scales.x.domain()[0]||Et.x.domain()[1]!==r.scales.x.domain()[1]||Et.y.domain()[0]!==r.scales.y.domain()[0]||Et.y.domain()[1]!==r.scales.y.domain()[1]||Et.x.range()[0]!==r.scales.x.range()[0]||Et.x.range()[1]!==r.scales.x.range()[1]||Et.y.range()[0]!==r.scales.y.range()[0]||Et.y.range()[1]!==r.scales.y.range()[1])&&Lt(r.scales),rt)){const e=r.getData(),t="function"==typeof A?A:e=>e[A||"x"],n="function"==typeof S?S:e=>e[S||"y"];Rt(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Gt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}h&&we&&we.length>0&&St(e=>e+1),(null==ze?void 0:ze.showBadge)&&Wt(!!d),(a||r.hasActivePulses)&&(bt.current=requestAnimationFrame(()=>Yt.current()))},o(()=>(Ut(),()=>{bt.current&&(cancelAnimationFrame(bt.current),bt.current=0)}),[Ut]),o(()=>{xt.current=!0,Ut()},[v,ht,gt,ce,q,X,De,Ut]),nt(ze,Vt,xt,Ut,Ht,Wt);const hn=ft&&_t?be?be(_t):e.createElement(cn,{hover:_t}):null,gn=hn?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:dt.left+_t.x,top:dt.top+_t.y,transform:`translate(${_t.x>.7*ht?"calc(-100% - 12px)":"12px"}, ${.3*gt>_t.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},hn):null,yn=on.current>=0&&_t?e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:ut[0],height:ut[1],pointerEvents:"none",zIndex:2}},e.createElement("circle",{cx:_t.x+dt.left,cy:_t.y+dt.top,r:8,fill:"none",stroke:"var(--accent, #6366f1)",strokeWidth:2,strokeDasharray:"4,2"})):null;if(Pt){const t=Vt.current;t&&x&&(t.ingest({inserts:x,bounded:!0}),t.computeScene({width:ht,height:gt}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null;return e.createElement("div",{className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof _e?_e:"XY chart",style:{position:"relative",width:ut[0],height:ut[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:ut[0],height:ut[1],style:{position:"absolute",left:0,top:0}},pt,e.createElement("g",{transform:`translate(${dt.left},${dt.top})`},q&&e.createElement("rect",{x:0,y:0,width:ht,height:gt,fill:q}),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:i.style.fill||"#4e79a7",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":return e.createElement("circle",{key:"point-"+n,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",opacity:null!==(i=t.style.opacity)&&void 0!==i?i:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"rect":return e.createElement("rect",{key:"rect-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.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(Ot,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:o,showAxes:ce,axes:ue,xLabel:de,yLabel:he,xFormat:ge||pe,yFormat:ye||fe,showGrid:Se,title:_e,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,foregroundGraphics:yt,marginalGraphics:rt,xValues:[],yValues:[],annotations:we,svgAnnotationRules:Ae,annotationFrame:0,xAccessor:"string"==typeof A?A:"string"==typeof H?H:void 0,yAccessor:"string"==typeof S?S:"string"==typeof N?N:void 0,annotationData:null==t?void 0:t.getData(),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof M?M:void 0}))}return e.createElement("div",{ref:ct,className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof _e?_e:"XY chart",tabIndex:0,style:{position:"relative",width:R?"100%":ut[0],height:F?"100%":ut[1],overflow:"visible"},onMouseMove:ft?dn:void 0,onMouseLeave:ft?nn:void 0,onKeyDown:ln},pt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:ut[0],height:ut[1],pointerEvents:"none"}},pt),e.createElement(At,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:Et,showAxes:ce,axes:ue,showGrid:Se,xFormat:ge||pe,yFormat:ye||fe}),e.createElement("canvas",{ref:mt,"aria-label":Mt(null!==(h=null===(d=Vt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:vt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Dt,{hoverPoint:_t}),lt&&e.createElement(Ct,{scene:null!==(y=null===(g=Vt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:v+" chart"}),e.createElement(Ot,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:Et,showAxes:ce,axes:ue,xLabel:de,yLabel:he,xFormat:ge||pe,yFormat:ye||fe,showGrid:Se,title:_e,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,foregroundGraphics:yt,marginalGraphics:rt,xValues:Tt,yValues:Ft,annotations:we,svgAnnotationRules:Ae,annotationFrame:wt,xAccessor:"string"==typeof A?A:"string"==typeof H?H:void 0,yAccessor:"string"==typeof S?S:"string"==typeof N?N:void 0,annotationData:null===(p=Vt.current)||void 0===p?void 0:p.getData(),pointNodes:null===(f=Vt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type),curve:"string"==typeof M?M:void 0,underlayRendered:!0}),(He||We)&&e.createElement(un,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,dimension:null!==(m=null==He?void 0:He.dimension)&&void 0!==m?m:"xy",scales:Et,onBrush:null!=We?We:()=>{}}),(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:Ht?"#dc3545":"#28a745",color:"white"})},Ht?"STALE":"LIVE"),yn,gn)});dn.displayName="StreamXYFrame";const hn=i(null);function gn({colors:t,categories:n,colorScheme:o="category10",children:i}){const a=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:je[o]||Ce,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e.createElement(hn.Provider,{value:a},i)}function yn(){return a(hn)}function pn(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 fn(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(pn(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function mn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}gn.displayName="CategoryColorProvider";const[vn,bn]=_t(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=mn(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=mn(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}})}})),[xn,kn]=_t(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 wn(e){const t=d(),n=e.clientId||t,{name:o}=e,i=bn(e=>e.selections.get(o)),a=bn(e=>e.setClause),l=bn(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?fn(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}function An(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=wn({name:t});return{onHover:s(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 Sn(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=wn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function En(e,t,n){const o=bn(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=fn(o,n);return e.filter(t)},[e,o,n])}function On(e={}){const{limit:t=50,types:n,chartId:o}=e,i=kn(e=>e.version),a=kn(e=>e.observations),s=kn(e=>e.clearObservations),l=r(()=>{let e=a;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[a,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const Pn=i(!1);function Ln({selections:e}){const t=bn(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Mn({categoryColors:r,interaction:i,selectionName:a,field:l}){const c=Object.entries(r);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=An({name:a,fields:[l]}),g=wn({name:a,clientId:"__linked-legend-isolate__"}),[y,p]=n(new Set),[f,m]=n(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(y.size>0?v.current({[l]:Array.from(y)}):b.current())},[i,y,l]);const x=s(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[l]:e.label})):(m(null),h.onHover(null)))},[i,l,h]),k=s(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(lt,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:f,isolatedCategories:y}))}function jn({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=yn(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(vn,null,e.createElement(xn,null,n&&e.createElement(Ln,{selections:n}),e.createElement(Pn.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Mn,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(Mn,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function Cn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){const a=Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}});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:a,label:""}]}}function Nn(e){return e?"string"==typeof e?{name:e}:e:null}function Dn(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 _n="#007bff";function Bn(e){return"function"==typeof e?e:t=>t[e]}function Hn(e,t,n="category10"){const o=yn();return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":He(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=He(e,t,n);return e=>o[e]||r(e)}return He(e,t,n)}},[e,t,n,o])}function Wn(e,t,n){return r(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const r=Bn(n);return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}function Tn({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a}){const l=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}:null}(t,n),c=wn({name:(null==e?void 0:e.name)||"__unused__"}),u=An({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),d=kn(e=>e.pushObservation),h=e?{isActive:c.isActive,predicate:c.predicate}:null,g=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,i,a,d]),y=s(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,i,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}function In({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40}}){const c=a(Pn),u=void 0!==o?o:!c&&!!t,d=r(()=>{if(u&&t)return Cn({data:e,colorBy:t,colorScale:n,getColor:Be})},[u,t,e,n]),h=r(()=>{const e=Object.assign(Object.assign({},l),s);return d&&("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,s,d,i]);return{legend:d,margin:h,legendPosition:i}}function $n(e,t,o){const[i,a]=n(null),[l,c]=n(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(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=r(()=>{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&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const zn={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 Rn(e,t,n){var o,r,i,a,s,l;const c=zn[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,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:c.marginDefaults}}const Fn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Gn(e,t){return"function"==typeof t?t(e):e[t]}function Yn(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 qn(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=Gn(t,o);s=Yn(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=Gn(t,o);l.push({label:n,value:Yn(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Yn(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Yn(t[e[0]],r))}}const c=Object.assign(Object.assign({},Fn),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 Xn(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=Gn(t,o);c.push({value:Yn(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=Yn(Gn(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:Yn(t[e],r)})});const u=Object.assign(Object.assign({},Fn),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 Vn(t){if(!0===t)return qn();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:Fn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?qn(t):qn())}function Un(e){return"string"==typeof e?e:"value"}function Kn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qn(e,t){return"function"==typeof t?t(e):e[t]}function Zn(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?Kn(Qn(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=Kn(Qn(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 Jn({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=Qn(l,t),u=Qn(l,n),d=o?Qn(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold"}},Kn(c)),e.createElement("div",{style:{marginTop:4}},Kn(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Un(o),": ",Kn(d)))}}function eo({componentName:t,message:n,width:o,height:r}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},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)))}class to 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(eo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var no;const oo="undefined"!=typeof process&&"production"!==(null===(no=process.env)||void 0===no?void 0:no.NODE_ENV);function ro({componentName:t,width:n,height:o,children:r}){return e.createElement(to,{fallback:r=>e.createElement(eo,{componentName:t,message:r.message,width:n,height:o})},r)}const io={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"},ao={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function so(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({},io),{width:n,height:o})},r||"No data available"):null}function lo(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({},ao),{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 co(e,t,n,o){if(!oo)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 uo(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 ho(e,t,n=3){let o,r=n+1;for(const n of t){const t=uo(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function go(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function yo(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=ho(e,t,3))&&void 0!==n?n:null)}function po({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=go(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=yo(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function fo({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 mo({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=go(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=yo(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}function vo(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())})}"function"==typeof SuppressedError&&SuppressedError;let bo=null;function xo(){return vo(this,void 0,void 0,function*(){return bo||(bo=yield import("./semiotic-ai-statisticalOverlays-C1f7TYyD.js")),bo})}const ko=c(function(i,a){var l,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=Rn(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:y,className:p,xFormat:f,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A="category10",curve:S="linear",showPoints:E=!1,pointRadius:O=3,fillArea:P=!1,areaOpacity:L=.3,lineWidth:M=2,tooltip:j,pointIdAccessor:C,annotations:N,directLabel:D,gapStrategy:_="break",anomaly:B,forecast:H,frameProps:W={},selection:T,linkedHover:I,onObservation:$,chartId:z,loading:R,emptyContent:F,legendInteraction:G,legendPosition:Y,xScaleType:q,yScaleType:X}=i,V=h.width,U=h.height,K=h.enableHover,Q=h.showGrid,Z=h.showLegend,J=h.title,ee=h.xLabel,te=h.yLabel,ne=lo(R,V,U);if(ne)return ne;const oe=so(g,V,U,F);if(oe)return oe;const re=g||[];co("LineChart",re,"xAccessor",v),co("LineChart",re,"yAccessor",b);const ie="string"==typeof v?v:"x",ae="string"==typeof b?b:"y",[se,le]=n(null),[ce,ue]=n([]);o(()=>{if(!H&&!B)return;let e=!1;return le(null),ue([]),H?function(...e){return vo(this,void 0,void 0,function*(){return(yield xo()).buildForecast(...e)})}(re,ie,ae,H,B).then(t=>{e||(le(t),ue(t.annotations))}).catch(()=>{e||(le(null),ue([]))}):B&&function(...e){return vo(this,void 0,void 0,function*(){return(yield xo()).buildAnomalyAnnotations(...e)})}(B).then(t=>{e||(le(null),ue(t))}).catch(()=>{e||ue([])}),()=>{e=!0}},[re,H,B,ie,ae]);const de=se?se.processedData:re,he=H&&!x?"__forecastSegment":x,{activeSelectionHook:ge,customHoverBehavior:ye}=Tn({selection:T,linkedHover:I,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:$,chartType:"LineChart",chartId:z}),pe=s(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]),fe=void 0!==(null===(l=de[0])||void 0===l?void 0:l[k]),me=r(()=>{if(fe)return de;if(he){const e=de.reduce((e,t)=>{const n="function"==typeof he?he(t):t[he];if(!e[n]){const t={[k]:[]};"string"==typeof he&&(t[he]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:de}]},[de,he,k,fe]),{gapProcessedLineData:ve,hasGaps:be}=r(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of me){const o=(n[k]||[]).filter(t=>!pe(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of me){const o=n[k]||[];let r=[],i=0;const a=he&&"string"==typeof he?n[he]:void 0;for(const s of o)if(pe(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"===_){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of me){const r=o[k]||[],i=[];for(const n of r)pe(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:me,hasGaps:!1}},[me,_,k,pe,he,b]),xe=Hn(de,w,A),ke=r(()=>{if(!w)return[];const e=new Set;for(const t of de){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[de,w]),we=$n(G,w,ke),Ae=r(()=>we.legendSelectionHook?we.legendSelectionHook:ge,[we.legendSelectionHook,ge]),Se=r(()=>e=>{const t={strokeWidth:M};return w?xe&&(t.stroke=Be(e,w,xe),P&&(t.fill=t.stroke,t.fillOpacity=L)):(t.stroke=_n,P&&(t.fill=_n,t.fillOpacity=L)),t},[w,xe,M,P,L]),[Ee,Oe]=n(null);o(()=>{if(!H)return void Oe(null);let e=!1;return function(...e){return vo(this,void 0,void 0,function*(){return(yield xo()).createSegmentLineStyle(...e)})}(Se,H).then(t=>{e||Oe(()=>t)}).catch(()=>{e||Oe(null)}),()=>{e=!0}},[Se,H]);const Pe=Ee||Se,Le=r(()=>Dn(Pe,Ae,T),[Pe,Ae,T]),Me=r(()=>{if(E)return e=>{const t={r:O,fillOpacity:1};return w?xe&&(t.fill=Be(e.parentLine||e,w,xe)):t.fill=_n,t}},[E,O,w,xe]),je=P?"area":"line",Ce="object"==typeof D?D:{},Ne=Ce.position||"end",De=Ce.fontSize||11,_e=r(()=>{var e,t;if(!D||!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 ve){const o=n[k]||[];if(0===o.length)continue;const a="end"===Ne?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"===Ne?6:-6,dy:0,color:xe?xe(e):_n,fontSize:De}));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];De+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=De+2)}return a},[D,w,xe,ve,k,v,b,Ne,De]),He=(!D||void 0!==Z)&&Z,We=r(()=>{if(!D)return h.marginDefaults;const e=_e.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*De);return Math.max(e,o)},0),t=e+10,n="end"===Ne?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[D,_e,De,Ne,h.marginDefaults]),{legend:Te,margin:Ie,legendPosition:$e}=In({data:ve,colorBy:w,colorScale:xe,showLegend:He,legendPosition:Y,userMargin:y,defaults:We}),ze=x||w,Re=r(()=>Zn([{label:ee||Un(v),accessor:v,role:"x"},{label:te||Un(b),accessor:b,role:"y"},...ze?[{label:Un(ze),accessor:ze,role:"group"}]:[]]),[v,b,ee,te,ze]),Fe=po({componentName:"LineChart",data:fe?(null===(c=de[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}});if(Fe)return e.createElement(eo,{componentName:"LineChart",message:Fe,width:V,height:U});const Ge=r(()=>fe||he||be?ve.flatMap(e=>{const t=e[k]||[];return he&&"string"==typeof he?t.map(t=>Object.assign(Object.assign({},t),{[he]:e[he]})):t}):de,[ve,k,fe,he,de,be]),Ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:je},null!=g&&{data:Ge}),{xAccessor:v,yAccessor:b,xScaleType:q,yScaleType:X,groupAccessor:"break"===_&&be?"_gapSegment":he||void 0,curve:S,lineStyle:Le}),E&&{pointStyle:Me}),{size:[V,U],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:Ie,showAxes:h.showAxes,xLabel:ee,yLabel:te,xFormat:f,yFormat:m,enableHover:K,showGrid:Q}),Te&&{legend:Te,legendPosition:$e}),G&&"none"!==G&&{legendHoverBehavior:we.onLegendHover,legendClickBehavior:we.onLegendClick,legendHighlightedCategory:we.highlightedCategory,legendIsolatedCategories:we.isolatedCategories}),J&&{title:J}),p&&{className:p}),{tooltipContent:!1===j?()=>null:Vn(j)||Re}),(I||$)&&{customHoverBehavior:ye}),C&&{pointIdAccessor:C}),((null==N?void 0:N.length)||ce.length||_e.length)&&{annotations:[...N||[],...ce,..._e]}),W);return e.createElement(ro,{componentName:"LineChart",width:V,height:U},e.createElement(dn,Object.assign({ref:d},Ye)))});ko.displayName="LineChart";const wo=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",areaBy:f,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k="category10",curve:w="monotoneX",areaOpacity:A=.7,showLine:S=!0,lineWidth:E=2,tooltip:O,annotations:P,frameProps:L={},selection:M,linkedHover:j,onObservation:C,chartId:N,loading:D,emptyContent:_,legendInteraction:B,legendPosition:H}=n,W=s.width,T=s.height,I=s.enableHover,$=s.showGrid,z=s.showLegend,R=s.title,F=s.xLabel,G=s.yLabel,Y=lo(D,W,T);if(Y)return Y;const q=so(l,W,T,_);if(q)return q;const X=l||[];co("AreaChart",X,"xAccessor",y),co("AreaChart",X,"yAccessor",p);const{activeSelectionHook:V,customHoverBehavior:U}=Tn({selection:M,linkedHover:j,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:C,chartType:"AreaChart",chartId:N}),K=void 0!==(null===(i=X[0])||void 0===i?void 0:i[b]),Q=r(()=>{if(K)return X;if(f){const e=X.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[b]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:X}]},[X,f,b,K]),Z=Hn(X,x,k),J=r(()=>{if(!x)return[];const e=new Set;for(const t of X){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[X,x]),ee=$n(B,x,J),te=r(()=>ee.legendSelectionHook?ee.legendSelectionHook:V,[ee.legendSelectionHook,V]),ne=r(()=>e=>{const t={};if(x){if(Z){const n=Be(e,x,Z);t.fill=n,S?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else t.fill=_n,S?(t.stroke=_n,t.strokeWidth=E):t.stroke="none";return t.fillOpacity=A,t},[x,Z,A,S,E]),oe=r(()=>Dn(ne,te,M),[ne,te,M]),{legend:re,margin:ie,legendPosition:ae}=In({data:Q,colorBy:x,colorScale:Z,showLegend:z,legendPosition:H,userMargin:c,defaults:s.marginDefaults}),se=f||x,le=r(()=>Zn([{label:F||Un(y),accessor:y,role:"x"},{label:G||Un(p),accessor:p,role:"y"},...se?[{label:Un(se),accessor:se,role:"group"}]:[]]),[y,p,F,G,se]),ce=po({componentName:"AreaChart",data:l,accessors:{xAccessor:y,yAccessor:p}});if(ce)return e.createElement(eo,{componentName:"AreaChart",message:ce,width:W,height:T});const ue=r(()=>K||f?Q.flatMap(e=>{const t=e[b]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):X,[Q,b,K,f,X]),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ue}),{xAccessor:y,yAccessor:p,groupAccessor:f||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),{curve:w,lineStyle:oe,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,showAxes:s.showAxes,xLabel:F,yLabel:G,xFormat:h,yFormat:g,enableHover:I,showGrid:$}),re&&{legend:re,legendPosition:ae}),B&&"none"!==B&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories}),R&&{title:R}),d&&{className:d}),{tooltipContent:!1===O?()=>null:Vn(O)||le}),(j||C)&&{customHoverBehavior:U}),P&&P.length>0&&{annotations:P}),L);return e.createElement(ro,{componentName:"AreaChart",width:W,height:T},e.createElement(dn,Object.assign({ref:a},de)))});function Ao({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:l="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=s(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),y=s(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=s(e=>t=>{y([t]),e(t)},[y]),f=s(e=>t=>{y(t),e(t)},[y]),m=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:Ne,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 Cn({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Be})},[e,o,a,i,d]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:p,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}wo.displayName="AreaChart";const So=c(function(n,o){var i;const a=t(null),l=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:y,xAccessor:p="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,normalize:E=!1,tooltip:O,annotations:P,frameProps:L={},selection:M,linkedHover:j,onObservation:C,chartId:N,loading:D,emptyContent:_,legendInteraction:B,legendPosition:H}=n,W=l.width,T=l.height,I=l.enableHover,$=l.showGrid,z=l.showLegend,R=l.title,F=l.xLabel,G=l.yLabel,Y=lo(D,W,T);if(Y)return Y;const q=so(c,W,T,_);if(q)return q;const X=c||[],V=Ao({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:z,legendPosition:H}),U=s(V.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[V.wrapPush]),K=s(V.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[V.wrapPushMany]);u(o,()=>({push:U,pushMany:K,clear:()=>{var e;V.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:[]}}),[U,K,V.resetCategories]);const{activeSelectionHook:Q,customHoverBehavior:Z}=Tn({selection:M,linkedHover:j,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:C,chartType:"StackedAreaChart",chartId:N}),J=void 0!==(null===(i=X[0])||void 0===i?void 0:i[v]),ee=r(()=>{if(J)return X;if(m){const e=X.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]:X}]},[X,m,v,J]),te=Hn(X,b,x),ne=r(()=>{if(!b)return[];const e=new Set;for(const t of X){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[X,b]),oe=$n(B,b,ne),re=r(()=>oe.legendSelectionHook?oe.legendSelectionHook:Q,[oe.legendSelectionHook,Q]),ie=r(()=>e=>{const t={};if(b&&te){const n=Be(e,b,te);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else b||(t.fill=_n,t.stroke=A?_n:"none",A&&(t.strokeWidth=S));return t.fillOpacity=w,t},[b,te,w,A,S]),ae=r(()=>Dn(ie,re,M),[ie,re,M]),{legend:se,margin:le,legendPosition:ce}=In({data:ee,colorBy:b,colorScale:te,showLegend:z,legendPosition:H,userMargin:d,defaults:l.marginDefaults}),ue=V.streamingLegend||se,de=H||ce,he=r(()=>{if(V.streamingMarginAdjust){const e=Object.assign({},le);for(const[t,n]of Object.entries(V.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return le},[le,V.streamingMarginAdjust]),ge=m||b,ye=r(()=>Zn([{label:F||Un(p),accessor:p,role:"x"},{label:G||Un(f),accessor:f,role:"y"},...ge?[{label:Un(ge),accessor:ge,role:"group"}]:[]]),[p,f,F,G,ge]),pe=po({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:f}});if(pe)return e.createElement(eo,{componentName:"StackedAreaChart",message:pe,width:W,height:T});const fe=r(()=>J||m?ee.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):X,[ee,v,J,m,X]),me=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:fe}),{xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:k,normalize:E,lineStyle:ae,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:he,showAxes:l.showAxes,xLabel:F,yLabel:G,xFormat:g,yFormat:y,enableHover:I,showGrid:$}),ue&&{legend:ue,legendPosition:de}),B&&"none"!==B&&{legendHoverBehavior:oe.onLegendHover,legendClickBehavior:oe.onLegendClick,legendHighlightedCategory:oe.highlightedCategory,legendIsolatedCategories:oe.isolatedCategories}),R&&{title:R}),h&&{className:h}),{tooltipContent:!1===O?()=>null:Vn(O)||ye}),(j||C)&&{customHoverBehavior:Z}),P&&P.length>0&&{annotations:P}),L);return e.createElement(ro,{componentName:"StackedAreaChart",width:W,height:T},e.createElement(dn,Object.assign({ref:a},me)))});function Eo(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:y,showLegend:p,userMargin:f,marginDefaults:m,loading:v,emptyContent:b,width:x,height:k}=e,{activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:S}=Tn({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:y}),E=Hn(t,o,i),O=r(()=>{if(!o)return[];const e=new Set;for(const n of t){const t="function"==typeof o?o(n):n[o];null!=t&&e.add(t+"")}return Array.from(e)},[t,o]),P=$n(a,o,O),L=r(()=>P.legendSelectionHook?P.legendSelectionHook:w,[P.legendSelectionHook,w]),{legend:M,margin:j,legendPosition:C}=In({data:t,colorBy:o,colorScale:E,showLegend:p,legendPosition:s,userMargin:f,defaults:m}),N=r(()=>{const e={};return M&&(e.legend=M,e.legendPosition=C),a&&"none"!==a&&(e.legendHoverBehavior=P.onLegendHover,e.legendClickBehavior=P.onLegendClick,e.legendHighlightedCategory=P.highlightedCategory,e.legendIsolatedCategories=P.isolatedCategories),e},[M,C,a,P.onLegendHover,P.onLegendClick,P.highlightedCategory,P.isolatedCategories]),D=lo(v,x,k),_=D?null:so(n,x,k,b);return{colorScale:E,allCategories:O,legendState:P,effectiveSelectionHook:L,activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:S,legend:M,margin:j,legendPosition:C,earlyReturn:D||_||null,legendBehaviorProps:N}}So.displayName="StackedAreaChart";const Oo=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",colorBy:f,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:E,frameProps:O={},selection:P,linkedHover:L,linkedBrush:M,onObservation:j,chartId:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=a.width,W=a.height,T=a.enableHover,I=a.showGrid,$=a.title,z=a.xLabel,R=a.yLabel,F=l||[],G=Eo({data:F,rawData:l,colorBy:f,colorScheme:m,legendInteraction:_,legendPosition:B,selection:P,linkedHover:L,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:j,chartType:"Scatterplot",chartId:C,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:N,emptyContent:D,width:H,height:W}),Y=Nn(M),q=Sn({name:(null==Y?void 0:Y.name)||"__unused_brush__",xField:(null==Y?void 0:Y.xField)||("string"==typeof y?y:void 0),yField:(null==Y?void 0:Y.yField)||("string"==typeof p?p:void 0)}),X=Y?"xyBrush"===q.brushInteraction.brush?"xy":"xBrush"===q.brushInteraction.brush?"x":"y":void 0,V=e.useRef(q.brushInteraction);V.current=q.brushInteraction;const U=s(e=>{const t=V.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(G.earlyReturn)return G.earlyReturn;co("Scatterplot",F,"xAccessor",y),co("Scatterplot",F,"yAccessor",p);const K=r(()=>{if(!v||0===F.length)return;const e=F.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[F,v]),Q=r(()=>e=>{const t={fillOpacity:k};return f?G.colorScale&&(t.fill=Be(e,f,G.colorScale)):t.fill=_n,t.r=v?We(e,v,b,K):x,t},[f,G.colorScale,v,b,K,x,k]),Z=r(()=>Dn(Q,G.effectiveSelectionHook,P),[Q,G.effectiveSelectionHook,P]),J=r(()=>Zn([{label:z||Un(y),accessor:y,role:"x"},{label:R||Un(p),accessor:p,role:"y"},...f?[{label:Un(f),accessor:f,role:"color"}]:[],...v?[{label:Un(v),accessor:v,role:"size"}]:[]]),[y,p,z,R,f,v]),ee=po({componentName:"Scatterplot",data:l,accessors:{xAccessor:y,yAccessor:p}});if(ee)return e.createElement(eo,{componentName:"Scatterplot",message:ee,width:H,height:W});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({chartType:"scatter"},null!=l&&{data:F}),{xAccessor:y,yAccessor:p,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:Z,colorScheme:m,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,showAxes:a.showAxes,xLabel:z,yLabel:R,xFormat:h,yFormat:g,enableHover:T,showGrid:I}),G.legendBehaviorProps),$&&{title:$}),d&&{className:d}),{tooltipContent:!1===w?()=>null:Vn(w)||J}),(L||j)&&{customHoverBehavior:G.customHoverBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),Y&&{brush:{dimension:X},onBrush:U}),O);return e.createElement(ro,{componentName:"Scatterplot",width:H,height:W},e.createElement(dn,Object.assign({ref:i},te)))});function Po(e,t){return w(1===t?.5:e/(t-1))}Oo.displayName="Scatterplot";const Lo=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:y,orderLabel:p,pointRadius:f=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,chartId:S,loading:E,emptyContent:O,legendInteraction:P}=n,L=a.width,M=a.height,j=a.enableHover,C=a.showGrid,N=a.title,D=a.xLabel,_=a.yLabel,B=s||[],H=r(()=>{if(!y||0===B.length)return B;const e="function"==typeof y?y:e=>e[y];return[...B].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})},[B,y]);co("ConnectedScatterplot",H,"xAccessor",h),co("ConnectedScatterplot",H,"yAccessor",g);const{activeSelectionHook:W,customHoverBehavior:T}=Tn({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,chartType:"ConnectedScatterplot",chartId:S}),I=$n(P,void 0,[]),$=r(()=>I.legendSelectionHook?I.legendSelectionHook:W,[I.legendSelectionHook,W]),z=r(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==$?void 0:$.isActive,a=null==$?void 0:$.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=Po(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=f+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=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,$]),R=r(()=>[z],[z]),F=t({idx:0,total:0}),G=r(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];return n=>{var o,r;const a=F.current;if(0===a.idx){const n=null!==(r=null===(o=i.current)||void 0===o?void 0:o.getData())&&void 0!==r?r:H;a.total=n.filter(n=>{const o=e(n),r=t(n);return null!=o&&null!=r&&isFinite(o)&&isFinite(r)}).length}const s=a.total,l=a.idx;return a.idx++,s>a.idx||(a.idx=0),{fill:s>0?Po(l,s):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}}},[f,H.length,h,g]),Y=r(()=>Dn(G,$,k),[G,$,k]),q=Object.assign({top:50,right:40,bottom:60,left:70},n.margin),X=p||("string"==typeof y?y:"Order"),V=r(()=>Zn([{label:D||Un(h),accessor:h,role:"x"},{label:_||Un(g),accessor:g,role:"y"},...y?[{label:X,accessor:y,role:"group"}]:[]]),[h,g,D,_,y,X]),U=po({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),K=lo(E,L,M);if(K)return K;const Q=so(s,L,M,O);if(Q)return Q;if(U)return e.createElement(eo,{componentName:"ConnectedScatterplot",message:U,width:L,height:M});const Z=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:H}),{xAccessor:h,yAccessor:g,pointStyle:Y,size:[L,M],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q,showAxes:a.showAxes,xLabel:D,yLabel:_,xFormat:c,yFormat:d,enableHover:j,showGrid:C}),N&&{title:N}),l&&{className:l}),{tooltipContent:!1===m?()=>null:Vn(m)||V}),(w||A)&&{customHoverBehavior:T}),v&&{pointIdAccessor:v}),{canvasPreRenderers:R}),b&&b.length>0&&{annotations:b}),x);return e.createElement(ro,{componentName:"ConnectedScatterplot",width:L,height:M},e.createElement(dn,Object.assign({ref:i},Z)))});Lo.displayName="ConnectedScatterplot";const Mo=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:y="y",sizeBy:p,sizeRange:f=[5,40],colorBy:m,colorScheme:v="category10",bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:E,frameProps:O={},selection:P,linkedHover:L,linkedBrush:M,onObservation:j,chartId:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=a.width,W=a.height,T=a.enableHover,I=a.showGrid,$=a.showLegend,z=a.title,R=a.xLabel,F=a.yLabel,G=lo(N,H,W);if(G)return G;const Y=so(s,H,W,D);if(Y)return Y;const q=s||[],{activeSelectionHook:X,customHoverBehavior:V}=Tn({selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],onObservation:j,chartType:"BubbleChart",chartId:C}),U=Nn(M);Sn({name:(null==U?void 0:U.name)||"__unused_brush__",xField:(null==U?void 0:U.xField)||("string"==typeof g?g:void 0),yField:(null==U?void 0:U.yField)||("string"==typeof y?y:void 0)});const K=Hn(q,m,v),Q=r(()=>{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]),Z=$n(_,m,Q),J=r(()=>Z.legendSelectionHook?Z.legendSelectionHook:X,[Z.legendSelectionHook,X]),ee=r(()=>{const e=q.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[q,p]),te=r(()=>e=>{const t={fillOpacity:b,strokeWidth:x,stroke:k};return m?K&&(t.fill=Be(e,m,K)):t.fill=_n,t.r=We(e,p,f,ee),t},[m,K,p,f,ee,b,x,k]),ne=r(()=>Dn(te,J,P),[te,J,P]),{legend:oe,margin:re,legendPosition:ie}=In({data:q,colorBy:m,colorScale:K,showLegend:$,legendPosition:B,userMargin:l,defaults:a.marginDefaults}),ae=r(()=>Zn([{label:R||Un(g),accessor:g,role:"x"},{label:F||Un(y),accessor:y,role:"y"},{label:Un(p),accessor:p,role:"size"},...m?[{label:Un(m),accessor:m,role:"color"}]:[]]),[g,y,R,F,p,m]),se=po({componentName:"BubbleChart",data:s,accessors:{xAccessor:g,yAccessor:y},requiredProps:{sizeBy:p}});if(se)return e.createElement(eo,{componentName:"BubbleChart",message:se,width:H,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({chartType:"bubble"},null!=s&&{data:q}),{xAccessor:g,yAccessor:y,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:f,pointStyle:ne,colorScheme:v,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re,showAxes:a.showAxes,xLabel:R,yLabel:F,xFormat:d,yFormat:h,enableHover:T,showGrid:I}),oe&&{legend:oe,legendPosition:ie}),_&&"none"!==_&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories}),z&&{title:z}),c&&{className:c}),{tooltipContent:!1===w?()=>null:Vn(w)||ae}),(L||j)&&{customHoverBehavior:V}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),O);return e.createElement(ro,{componentName:"BubbleChart",width:H,height:W},e.createElement(dn,Object.assign({ref:i},le)))});Mo.displayName="BubbleChart";const jo=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:y,yFormat:p,colorScheme:f="blues",customColorScale:m,showValues:b=!1,valueFormat:x,cellBorderColor:k="#fff",cellBorderWidth:A=1,tooltip:S,annotations:L,frameProps:M={},selection:j,linkedHover:C,onObservation:N,chartId:D,loading:_,emptyContent:B,showLegend:H,legendPosition:W,legendInteraction:T}=n,I=a.width,$=a.height,z=a.enableHover,R=a.title,F=a.xLabel,G=a.yLabel,Y=lo(_,I,$);if(Y)return Y;const q=so(s,I,$,B);if(q)return q;const X=s||[],V=null!=H&&H,U=null!=W?W:"right",{margin:K}=In({data:X,colorBy:V?"value":void 0,colorScale:void 0,showLegend:V,legendPosition:U,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:Q,customHoverBehavior:Z}=Tn({selection:j,linkedHover:C,fallbackFields:[],onObservation:N,chartType:"Heatmap",chartId:D}),J=$n(T,void 0,[]),ee=r(()=>J.legendSelectionHook?J.legendSelectionHook:Q,[J.legendSelectionHook,Q]),te=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ne=r(()=>{const e=X.map(te);return[Math.min(...e),Math.max(...e)]},[X,te]),oe=r(()=>"custom"===f&&m?m:v({blues:P,reds:O,greens:E,viridis:w}[f]||P).domain(ne),[f,m,ne]);r(()=>{const e=Bn(d),t=Bn(h);return{xBinCount:new Set(X.map(e)).size,yBinCount:new Set(X.map(t)).size}},[X,d,h]),r(()=>({coordinates:X}),[X]);const re=r(()=>e=>{const t=te(e);return{fill:oe(t),stroke:k,strokeWidth:A}},[te,oe,k,A]);r(()=>Dn(re,ee,j),[re,ee,j]);const ie=r(()=>Zn([{label:F||Un(d),accessor:d,role:"x"},{label:G||Un(h),accessor:h,role:"y"},{label:Un(g),accessor:g,role:"value"}]),[d,h,F,G,g]),ae=po({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}});if(ae)return e.createElement(eo,{componentName:"Heatmap",message:ae,width:I,height:$});const se=r(()=>{if(V)return{gradient:{colorFn:e=>oe(e),domain:ne,label:"string"==typeof g?g:"value",format:x}}},[V,oe,ne,g,x]),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=s&&{data:X}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==f?f:void 0,showValues:b,heatmapValueFormat:x,size:[I,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,showAxes:a.showAxes,xLabel:F,yLabel:G,xFormat:y,yFormat:p,enableHover:z}),se&&{legend:se,legendPosition:U}),R&&{title:R}),c&&{className:c}),{tooltipContent:!1===S?()=>null:Vn(S)||ie}),(C||N)&&{customHoverBehavior:Z}),L&&L.length>0&&{annotations:L}),M);return e.createElement(ro,{componentName:"Heatmap",width:I,height:$},e.createElement(dn,Object.assign({ref:i},le)))});jo.displayName="Heatmap";const Co="__splomIdx",No={top:4,bottom:4,left:4,right:4};function Do({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-No.left-No.right,l=r-No.top-No.bottom;return o(()=>{if(!a.current)return;const e=p(a.current).select(".brush-g"),t=y().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(${No.left},${No.top})`}))}function _o({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:y,onPointHover:p}){const f=t(null),m=wn({name:d,clientId:`splom-${o}-${r}`}),v=Sn({name:d,xField:o,yField:r}),b=wn({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=s(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=s(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[Co];void 0!==n&&(x({[Co]:[n]}),null==p||p(t,e.x+No.left,e.y+No.top))},[x,p]),A=s(e=>{const t={opacity:l,r:a};return t.fill=c?Be(e,c,u):_n,"hover"===y?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*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,a,y,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(dn,{ref:f,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:No,showAxes:!1,enableHover:"hover"===y,customHoverBehavior:"hover"===y?w:void 0,tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&e.createElement(Do,{frameRef:f,cellSize:i,xField:o,yField:r,onBrush:k}))}function Bo({data:t,field:n,label:o,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=wn({name:c,clientId:"splom-diag-"+n}),g=wn({name:u,clientId:`splom-diag-${n}-hover`}),y="hover"===d?g:h,p=y.isActive,f=y.predicate,m=r(()=>{const e=t.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const o=Math.min(...e),r=(Math.max(...e)-o)/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)),y=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of t){const t=e[n];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-o)/r),a-1);if(d[i]++,p&&!f(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!f(e)||y[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=y.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,n,a,i,p,f,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"},o),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):_n,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:_n,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):_n,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:_n,opacity:.7}))))}function Ho({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 Wo(t){const{data:o,fields:i,fieldLabels:a={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:y="histogram",histogramBins:p=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:E}=t,O="splom",P="splom-hover",L=m?"hover":f?"brush":"hover",M=bn(e=>e.clearSelection),[j,C]=n(null),N=s(()=>{M(P),C(null)},[M,P]),D=r(()=>(o||[]).map((e,t)=>void 0!==e[Co]?e:Object.assign(Object.assign({},e),{[Co]:t})),[o]),_=Hn(D,l,c),B=void 0!==k?k:!!l,H=r(()=>{if(!B||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(D.map(t=>t[e]))].map(e=>({label:e+"",color:_?_(e+""):_n})):null},[B,l,D,_]),W=r(()=>({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"}},H&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},H.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:W,onMouseLeave:"hover"===L?N: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"===y?e.createElement(Ho,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(Bo,{key:"diag-"+t,data:D,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:l,colorScale:_,brushSelectionName:O,hoverSelectionName:P,unselectedOpacity:v,mode:L}):e.createElement(_o,{key:`cell-${t}-${o}`,data:D,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:l,colorScale:_,brushSelectionName:O,hoverSelectionName:P,unselectedOpacity:v,showGrid:b,tooltip:x,mode:L,onPointHover:"hover"===L?(e,i,a)=>{e?(C({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:E})):(C(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E}))}: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))),j&&"hover"===L&&(()=>{const t=j.datum,n=a[j.xField]||j.xField,o=a[j.yField]||j.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[Co];return e.createElement("div",{style:{position:"absolute",left:40+j.colIndex*(u+d)+j.px,top:j.rowIndex*(u+d)+j.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[j.xField]?Number(t[j.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[j.yField]?Number(t[j.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function To(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(jn,{selections:r},e.createElement(Wo,Object.assign({},t)))}function Io(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=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 $o(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=D(e,.25))&&void 0!==t?t:i,median:null!==(n=D(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=D(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}To.displayName="ScatterplotMatrix";const zo={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;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,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(Ee(e.x,n,e.width,Math.abs(a),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(Ee(n,e.x,Math.abs(a),e.width,y,p,i)),0>t?r+=t:o+=t}}}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(Ee(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(Ee(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,y=s.length>0,p=2*Math.PI,f=-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=y&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(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),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:Io,donut:Io,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,y=[],p="vertical"===g,f=!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=D(t,.25))&&void 0!==n?n:s,g=null!==(o=D(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=D(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(f)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(y.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}),f)for(const e of S)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return y},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,y=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)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),y-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/f*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/f*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=D(t,.25))&&void 0!==n?n:i,l=null!==(o=D(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=D(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:$o(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(Ee(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},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)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=s(e.pieceData[0],e.name),f=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]/y*f}`;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]/y*f} ${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:$o(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(Ee(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(Ee(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class Ro{constructor(e){this.rExtent=new xe,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 be(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=>Pe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new xe)):(this.getR=Pe(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 be(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=[];for(const e of t)n.has(e)?o.push(e):this.categories.delete(e);return o}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;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack&&this.config.normalize)a=0,s=1;else if("bar"===r&&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>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}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=zo[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:Ne,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 y=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?(y.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?(y.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)y.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:ze(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Ie(e,this.activeTransition),i=Te(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=$e(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=$e(o.x,e._targetX,i),e.y=$e(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=$e(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,i),e.y=$e(n.y,e._targetY,i),void 0!==n.w&&(e.w=$e(n.w,e._targetW,i),e.h=$e(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){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function Fo(e,t,n){const o=Fe(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Go(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function Yo(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=Ge(Math.atan2(r,o)),s=Ge(e.startAngle),l=Ge(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 qo(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 Xo(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 Vo(t){const{width:n,height:o,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),y=r(()=>!l||h?[]:l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(d||Uo)(e)})),[l,d,h]),p=u&&l&&!h,f=c&&l&&!h;return p||f?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})`},p&&e.createElement("g",{className:"ordinal-grid"},y.map((t,r)=>e.createElement("line",{key:"grid-"+r,x1:g?t.pixel:0,y1:g?0:t.pixel,x2:g?t.pixel:n,y2:g?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),f&&e.createElement(e.Fragment,null,g?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Uo(e){return Math.round(100*e)/100+""}function Ko(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,oLabel:g,rLabel:y,oFormat:p,rFormat:f,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:S="right",foregroundGraphics:E,annotations:O,svgAnnotationRules:P,xAccessor:L,yAccessor:M,annotationData:j,underlayRendered:C,children:N}=n,D="radial"===(null==d?void 0:d.projection),_="horizontal"===(null==d?void 0:d.projection),B=r(()=>h&&d&&!D?d.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2,label:p?p(e):e}}):[],[h,d,p,D]),H=r(()=>h&&d&&!D?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(f||Uo)(e)})):[],[h,d,f,D]),W=t(new Map),T=t(null!==(o=null==O?void 0:O.length)&&void 0!==o?o:0),I=null!==(i=null==O?void 0:O.length)&&void 0!==i?i:0;T.current!==I&&(T.current=I,W.current=new Map);const $=r(()=>{if(!O||0===O.length)return null;const e=kt(),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}:null,timeAxis:"x",xAccessor:L,yAccessor:M,width:a,height:s,data:j,frameType:"ordinal",stickyPositionCache:W.current};return O.map((t,n)=>{if(P){const r=P(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[O,P,a,s,d,L,M,j]);return h||v||b||E||$&&$.length>0||m||N?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof v?v:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},m&&d&&!D&&!C&&e.createElement("g",{className:"ordinal-grid"},H.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:_?t.pixel:0,y1:_?0:t.pixel,x2:_?t.pixel:a,y2:_?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!D&&e.createElement("g",{className:"ordinal-axes"},_?e.createElement(e.Fragment,null,!C&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.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}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&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"}},g),!C&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.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))),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!C&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.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}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},g),!C&&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:"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))),y&&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"}},y))),$,E,N),v&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof v?v:null),ct({legend:b,totalWidth:l,totalHeight:c,margin:u,legendPosition:S,title:v,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A})):null}function Qo(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 Zo=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)Qo(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&&(Qo(e,t),Vt(e,t)),e.globalAlpha=1},Jo=(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()}},er=(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}},tr=e=>[er,...e],nr={bar:tr([en]),clusterbar:tr([en]),point:tr([Jt]),swarm:tr([Jt]),pie:[Zo],donut:[Zo],boxplot:tr([(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()}},Jt]),violin:tr([Jo]),histogram:tr([en]),ridgeline:tr([Jo]),timeline:tr([en])},or={top:50,right:40,bottom:60,left:70},rr={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 ir({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:rr},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:rr},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:rr},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:rr},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const y=(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(!y&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:rr},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:rr},y&&e.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const ar=c(function(i,a){var l,c,d,h,g,y,p;const{chartType:f,runtimeMode:m,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:k,stackBy:w,groupBy:A,multiAxis:S,timeAccessor:E,valueAccessor:O,categoryAccessor:P,projection:L="vertical",size:M=[600,400],responsiveWidth:j,responsiveHeight:C,margin:N,barPadding:D,innerRadius:_,normalize:B,startAngle:H,dynamicColumnWidth:W,bins:T,showOutliers:I,showIQR:$,amplitude:z,connectorAccessor:R,connectorStyle:F,rExtent:G,oExtent:Y,extentPadding:q=.05,oSort:X,windowMode:V="sliding",windowSize:U=200,pieceStyle:K,summaryStyle:Q,colorScheme:Z,barColors:J,showAxes:ee=!0,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,enableHover:ae=!0,hoverAnnotation:se,tooltipContent:le,customHoverBehavior:ce,annotations:ue,svgAnnotationRules:de,showGrid:he=!1,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,backgroundGraphics:xe,foregroundGraphics:ke,title:we,className:Ae,background:Se,centerContent:Ee,decay:Oe,pulse:Pe,transition:Le,staleness:Me,accessibleTable:je}=i,[Ce,Ne]=tt(M,j,C),De=r(()=>Object.assign(Object.assign({},or),N),[N]),_e=Ne[0]-De.left-De.right,Be=Ne[1]-De.top-De.bottom,He="function"==typeof ke?ke({size:Ne,margin:De}):ke,We=t(null),Te=t(!0),Ie=It(e=>e.theme),$e=t(0),ze=t(null),Re=t(()=>{}),[Fe,Ge]=n(null),[Ye,qe]=n(null),[Xe,Ve]=n(0),[Ue,Ke]=n(!1),Qe=ae||se,Ze="streaming"===m,ot=r(()=>({chartType:f,runtimeMode:Ze?"streaming":"bounded",windowSize:U,windowMode:V,extentPadding:q,projection:L,oAccessor:Ze?void 0:b,rAccessor:Ze?void 0:x,colorAccessor:k,stackBy:w,groupBy:A,multiAxis:S,timeAccessor:Ze?E:void 0,valueAccessor:Ze?O||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:Ze?P||b:void 0,rExtent:G,oExtent:Y,barPadding:D,innerRadius:_,normalize:B,startAngle:H,dynamicColumnWidth:W,bins:T,showOutliers:I,showIQR:$,amplitude:z,connectorAccessor:R,connectorStyle:F,oSort:X,pieceStyle:K,summaryStyle:Q,colorScheme:Z,barColors:J,decay:Oe,pulse:Pe,transition:Le,staleness:Me}),[f,U,V,q,L,b,x,k,w,A,S,E,O,P,G,Y,D,_,B,H,W,T,I,$,z,R,F,X,K,Q,Z,J,Oe,Pe,Le,Me,Ze]),rt=t(null);rt.current||(rt.current=new Ro(ot));const it=s(()=>{$e.current||($e.current=requestAnimationFrame(()=>Re.current()))},[]);o(()=>{var e;null===(e=rt.current)||void 0===e||e.updateConfig(ot),Te.current=!0,it()},[ot,it]),o(()=>{Te.current=!0,it()},[Ie,it]);const at=t(null);at.current||(at.current=new ve(e=>{const t=rt.current;t&&t.ingest(e)&&(Te.current=!0,it())}));const st=s(e=>{var t;null===(t=at.current)||void 0===t||t.push(e)},[]),lt=s(e=>{var t;null===(t=at.current)||void 0===t||t.pushMany(e)},[]),ct=s(()=>{var e,t;null===(e=at.current)||void 0===e||e.clear(),null===(t=rt.current)||void 0===t||t.clear(),Te.current=!0,it()},[it]);u(a,()=>({push:st,pushMany:lt,clear:ct,getData:()=>{var e,t,n;return null===(e=at.current)||void 0===e||e.flush(),null!==(n=null===(t=rt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[st,lt,ct]),o(()=>{var e;v&&(null===(e=at.current)||void 0===e||e.setBoundedData(v))},[v]);const ut=t(()=>{}),dt=t(()=>{});ut.current=e=>{if(!Qe)return;const t=We.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-De.left,r=e.clientY-n.top-De.top;if(0>o||o>_e||0>r||r>Be)return void(ze.current&&(ze.current=null,Ge(null),ce&&ce(null),it()));const i=rt.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=Fo(i,t,n);break;case"point":e=Go(i,t,n);break;case"wedge":e=Yo(i,t,n);break;case"boxplot":e=qo(i,t,n);break;case"violin":e=Xo(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-_e/2:o,a?r-Be/2:r);if(!s)return void(ze.current&&(ze.current=null,Ge(null),ce&&ce(null),it()));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 b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});ze.current=c,Ge(c),ce&&(ce(c),Te.current=!0),it()},dt.current=()=>{ze.current&&(ze.current=null,Ge(null),ce&&(ce(null),Te.current=!0),it())},s(e=>ut.current(e),[]);const ht=s(()=>dt.current(),[]),gt=t(-1),yt=s(e=>{const t=rt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=gt.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return gt.current=-1,ze.current=null,Ge(null),ce&&ce(null),void it();const i=0>o?0:r;gt.current=i;const a=Object.assign(Object.assign({},et(n[i])),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});ze.current=a,Ge(a),ce&&ce(a),it()},[ce,it]),pt=s(e=>{gt.current=-1,ut.current(e)},[]);Re.current=()=>{var e,t;$e.current=0;const n=We.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=rt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=Te.current;s&&!a&&(r.computeScene({width:_e,height:Be}),Te.current=!1),(s||a)&&n.setAttribute("aria-label",Mt(r.scene,f+" chart"));const l=zt(),c=Ne[0]*l,u=Ne[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=Ne[0]+"px",n.style.height=Ne[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,Ne[0],Ne[1]);const d=null!==(e=null==Me?void 0:Me.threshold)&&void 0!==e?e:5e3,h=Me&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==Me?void 0:Me.dimOpacity)&&void 0!==t?t:.5);const g=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=Se||(g&&"transparent"!==g?g:null);y&&(o.fillStyle=y,o.fillRect(0,0,Ne[0],Ne[1]));const p="radial"===L;p?(o.save(),o.translate(De.left+_e/2,De.top+Be/2)):o.translate(De.left,De.top);const m=nr[f]||[],v={width:_e,height:Be};for(const e of m)e(o,r.scene,r.scales,v);p&&o.restore(),h&&(o.globalAlpha=1),s&&r.scales&&(qe(r.scales),Ve(e=>e+1)),(null==Me?void 0:Me.showBadge)&&Ke(!!h),(a||r.hasActivePulses)&&($e.current=requestAnimationFrame(()=>Re.current()))},o(()=>(it(),()=>{$e.current&&(cancelAnimationFrame($e.current),$e.current=0)}),[it]),o(()=>{Te.current=!0,it()},[f,_e,Be,ee,Se,it]),nt(Me,rt,Te,it,Ue,Ke);const ft=Qe&&Fe?le?le(Fe):e.createElement(ir,{hover:Fe}):null,mt="radial"===L,vt=Fe?mt?Fe.x+_e/2:Fe.x:0,bt=Fe?mt?Fe.y+Be/2:Fe.y:0,xt=ft?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:De.left+vt,top:De.top+bt,transform:`translate(${vt>.7*_e?"calc(-100% - 12px)":"12px"}, ${.3*Be>bt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},ft):null;if(Pt){const t=rt.current;t&&v&&(t.ingest({inserts:v,bounded:!0}),t.computeScene({width:_e,height:Be}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===L,i=r?De.left+_e/2:De.left,a=r?De.top+Be/2:De.top;return e.createElement("div",{className:"stream-ordinal-frame"+(Ae?" "+Ae:""),role:"img","aria-label":"string"==typeof we?we:"Ordinal chart",style:{position:"relative",width:Ne[0],height:Ne[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ne[0],height:Ne[1],style:{position:"absolute",left:0,top:0}},xe&&e.createElement("g",{transform:`translate(${De.left},${De.top})`},xe),e.createElement("g",{transform:`translate(${i},${a})`},Se&&e.createElement("rect",{x:0,y:0,width:_e,height:Be,fill:Se}),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":return e.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"point":return e.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",opacity:null!==(o=t.style.opacity)&&void 0!==o?o:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"wedge":{const n=t,o=re().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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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});default:return null}}(t,n)).filter(Boolean))),e.createElement(Ko,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:o,showAxes:ee,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,showGrid:he,title:we,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,foregroundGraphics:He,annotations:ue,svgAnnotationRules:de,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==t?void 0:t.getData()}),Ee&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:De.left+_e/2,top:De.top+Be/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ee))}return e.createElement("div",{ref:Ce,className:"stream-ordinal-frame"+(Ae?" "+Ae:""),role:"img","aria-label":"string"==typeof we?we:"Ordinal chart",tabIndex:0,style:{position:"relative",width:j?"100%":Ne[0],height:C?"100%":Ne[1],overflow:"visible"},onMouseMove:Qe?pt:void 0,onMouseLeave:Qe?ht:void 0,onKeyDown:yt},xe&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ne[0],height:Ne[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${De.left},${De.top})`},xe)),e.createElement(Vo,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:Ye,showAxes:ee,showGrid:he,rFormat:ie}),e.createElement("canvas",{ref:We,"aria-label":Mt(null!==(h=null===(d=rt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],f+" chart"),style:{position:"absolute",top:0,left:0,width:Ne[0],height:Ne[1]}}),e.createElement(Dt,{hoverPoint:Fe}),je&&e.createElement(Ct,{scene:null!==(y=null===(g=rt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:f+" chart"}),e.createElement(Ko,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:Ye,showAxes:ee,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,showGrid:he,title:we,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,foregroundGraphics:He,annotations:ue,svgAnnotationRules:de,annotationFrame:Xe,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(p=rt.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),Ee&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:De.left+_e/2,top:De.top+Be/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ee),(null==Me?void 0:Me.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Me.badgePosition?{top:4,left:4}:"bottom-left"===Me.badgePosition?{bottom:4,left:4}:"bottom-right"===Me.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ue?"#dc3545":"#28a745",color:"white"})},Ue?"STALE":"LIVE"),xt)});ar.displayName="StreamOrdinalFrame";const sr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",sort:m=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Eo({data:W,rawData:s,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:S,chartType:"BarChart",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;co("BarChart",W,"categoryAccessor",d),co("BarChart",W,"valueAccessor",h);const I=Wn(W,m,h),$=r(()=>e=>{const t={};return t.fill=p?Be(e,p,T.colorScale):_n,t},[p,T.colorScale]),z=r(()=>Dn($,T.effectiveSelectionHook,w),[$,T.effectiveSelectionHook,w]),R=r(()=>Jn({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),F=po({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return e.createElement(eo,{componentName:"BarChart",message:F,width:j,height:C});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:I}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:z,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:v,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:y,showGrid:D,oSort:m}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||R}),(A||S)&&{customHoverBehavior:T.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(ro,{componentName:"BarChart",width:j,height:C},e.createElement(ar,Object.assign({ref:a},G)))});sr.displayName="BarChart";const lr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",stackBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:f,colorBy:m,colorScheme:v="category10",normalize:b=!1,barPadding:x=40,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=i.width,D=i.height,_=i.enableHover,B=i.showGrid,H=i.showLegend,W=i.title,T=i.categoryLabel,I=i.valueLabel,$=l||[],z=m||g,R=Ao({isPushMode:void 0===l,colorBy:z,colorScheme:v,showLegend:H,legendPosition:C}),F=s(R.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[R.wrapPush]),G=s(R.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[R.wrapPushMany]);u(o,()=>({push:F,pushMany:G,clear:()=>{var e;R.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:[]}}),[F,G,R.resetCategories]);const Y=Eo({data:$,rawData:l,colorBy:z,colorScheme:v,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:O,chartType:"StackedBarChart",chartId:P,showLegend:H,userMargin:c,marginDefaults:i.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;const q=r(()=>e=>z?Y.colorScale?{fill:Be(e,z,Y.colorScale)}:{}:{fill:_n},[z,Y.colorScale]),X=r(()=>Dn(q,Y.effectiveSelectionHook,S),[q,Y.effectiveSelectionHook,S]),V=r(()=>Jn({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),U=po({componentName:"StackedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{stackBy:g}});if(U)return e.createElement(eo,{componentName:"StackedBarChart",message:U,width:N,height:D});const K=r(()=>R.streamingLegend?Object.assign(Object.assign({},Y.legendBehaviorProps),{legend:R.streamingLegend,legendPosition:C||Y.legendPosition}):Y.legendBehaviorProps,[Y.legendBehaviorProps,Y.legendPosition,R.streamingLegend,C]),Q=r(()=>{if(R.streamingMarginAdjust){const e=Object.assign({},Y.margin);for(const[t,n]of Object.entries(R.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Y.margin},[Y.margin,R.streamingMarginAdjust]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:$}),{oAccessor:h,rAccessor:y,stackBy:g,normalize:b,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:X,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,barPadding:x,enableHover:_,showAxes:i.showAxes,oLabel:T,rLabel:I,rFormat:f,showGrid:B}),K),W&&{title:W}),d&&{className:d}),{tooltipContent:!1===k?()=>null:Vn(k)||V}),(E||O)&&{customHoverBehavior:Y.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(ro,{componentName:"StackedBarChart",width:N,height:D},e.createElement(ar,Object.assign({ref:a},Z)))});lr.displayName="StackedBarChart";const cr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",groupBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:f,colorBy:m,colorScheme:v="category10",barPadding:b=60,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:E,chartId:O,loading:P,emptyContent:L,legendInteraction:M,legendPosition:j}=n,C=i.width,N=i.height,D=i.enableHover,_=i.showGrid,B=i.showLegend,H=i.title,W=i.categoryLabel,T=i.valueLabel,I=l||[],$=m||g,z=Ao({isPushMode:void 0===l,colorBy:$,colorScheme:v,showLegend:B,legendPosition:j}),R=s(z.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),F=s(z.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);u(o,()=>({push:R,pushMany:F,clear:()=>{var e;z.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:[]}}),[R,F,z.resetCategories]);const G=Eo({data:I,rawData:l,colorBy:$,colorScheme:v,legendInteraction:M,legendPosition:j,selection:A,linkedHover:S,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:E,chartType:"GroupedBarChart",chartId:O,showLegend:B,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:C,height:N});if(G.earlyReturn)return G.earlyReturn;const Y=r(()=>e=>$?G.colorScale?{fill:Be(e,$,G.colorScale)}:{}:{fill:_n},[$,G.colorScale]),q=r(()=>Dn(Y,G.effectiveSelectionHook,A),[Y,G.effectiveSelectionHook,A]),X=r(()=>Jn({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),V=po({componentName:"GroupedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{groupBy:g}});if(V)return e.createElement(eo,{componentName:"GroupedBarChart",message:V,width:C,height:N});const U=r(()=>z.streamingLegend?Object.assign(Object.assign({},G.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:j||G.legendPosition}):G.legendBehaviorProps,[G.legendBehaviorProps,G.legendPosition,z.streamingLegend,j]),K=r(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},G.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return G.margin},[G.margin,z.streamingMarginAdjust]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=l&&{data:I}),{oAccessor:h,rAccessor:y,groupBy:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:q,size:[C,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,barPadding:b,enableHover:D,showAxes:i.showAxes,oLabel:W,rLabel:T,rFormat:f,showGrid:_}),U),H&&{title:H}),d&&{className:d}),{tooltipContent:!1===x?()=>null:Vn(x)||X}),(S||E)&&{customHoverBehavior:G.customHoverBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(ro,{componentName:"GroupedBarChart",width:C,height:N},e.createElement(ar,Object.assign({ref:a},Q)))});cr.displayName="GroupedBarChart";const ur=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,frameProps:S={},selection:E,linkedHover:O,onObservation:P,chartId:L,loading:M,emptyContent:j,legendInteraction:C,legendPosition:N}=n,D=i.width,_=i.height,B=i.enableHover,H=i.showGrid,W=i.title,T=i.categoryLabel,I=i.valueLabel,$=s||[],z=Eo({data:$,rawData:s,colorBy:p,colorScheme:f,legendInteraction:C,legendPosition:N,selection:E,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,chartType:"SwarmPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:j,width:D,height:_});if(z.earlyReturn)return z.earlyReturn;const R=r(()=>{if(!m)return;const e=$.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[$,m]),F=r(()=>e=>{const t={fillOpacity:x};return t.fill=p?Be(e,p,z.colorScale):_n,t.r=m?We(e,m,v,R):b,t},[p,z.colorScale,m,v,R,b,x]),G=r(()=>Dn(F,z.effectiveSelectionHook,E),[F,z.effectiveSelectionHook,E]),Y=r(()=>Jn({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),q=po({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(q)return e.createElement(eo,{componentName:"SwarmPlot",message:q,width:D,height:_});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:$}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:G,size:[D,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:k,enableHover:B,showAxes:i.showAxes,oLabel:T,rLabel:I,rFormat:y,showGrid:H}),z.legendBehaviorProps),W&&{title:W}),c&&{className:c}),{tooltipContent:!1===w?()=>null:Vn(w)||Y}),(O||P)&&{customHoverBehavior:z.customHoverBehavior}),A&&A.length>0&&{annotations:A}),S);return e.createElement(ro,{componentName:"SwarmPlot",width:D,height:_},e.createElement(ar,Object.assign({ref:a},X)))});ur.displayName="SwarmPlot";const dr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Eo({data:W,rawData:s,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"BoxPlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;const I=r(()=>e=>{const t=p?Be(e,p,T.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.8}},[p,T.colorScale]),$=r(()=>Dn(I,T.effectiveSelectionHook,w),[I,T.effectiveSelectionHook,w]),z=r(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||(t.data||t).category||"")+""),null!=n.median&&e.createElement(e.Fragment,null,null!=n.n&&e.createElement("div",null,"n = ",n.n),e.createElement("div",null,"Median: ",n.median.toLocaleString()),e.createElement("div",null,"Q1: ",n.q1.toLocaleString()),e.createElement("div",null,"Q3: ",n.q3.toLocaleString()),e.createElement("div",null,"Min: ",n.min.toLocaleString()),e.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),R=po({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(R)return e.createElement(eo,{componentName:"BoxPlot",message:R,width:j,height:C});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:$,showOutliers:m,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:v,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:y,showGrid:D}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||z}),(A||S)&&{customHoverBehavior:T.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(ro,{componentName:"BoxPlot",width:j,height:C},e.createElement(ar,Object.assign({ref:a},F)))});dr.displayName="BoxPlot";const hr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y=!1,valueFormat:p,colorBy:f,colorScheme:m="category10",categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendPosition:L}=n,M=i.width,j=i.height,C=i.enableHover,N=i.showGrid,D=i.title,_=i.categoryLabel,B=i.valueLabel,H=s||[],W=Eo({data:H,rawData:s,colorBy:f,colorScheme:m,legendInteraction:void 0,legendPosition:L,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"Histogram",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:M,height:j});if(W.earlyReturn)return W.earlyReturn;const T=r(()=>e=>{const t=f?Be(e,f,W.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.8}},[f,W.colorScale]),I=r(()=>Dn(T,W.activeSelectionHook,w),[T,W.activeSelectionHook,w]),$=r(()=>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:Fn},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)))},[]),z=po({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(z)return e.createElement(eo,{componentName:"Histogram",message:z,width:M,height:j});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:H}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:I,bins:g,normalize:y,size:[M,j],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:v,enableHover:C,showAxes:i.showAxes,oLabel:_,rLabel:B,rFormat:p,showGrid:N}),W.legendBehaviorProps),D&&{title:D}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||$}),(A||S)&&{customHoverBehavior:W.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(ro,{componentName:"Histogram",width:M,height:j},e.createElement(ar,Object.assign({ref:a},R)))});hr.displayName="Histogram";const gr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y=25,showIQR:p=!0,valueFormat:f,colorBy:m,colorScheme:v="category10",categoryPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:E,chartId:O,loading:P,emptyContent:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Eo({data:W,rawData:s,colorBy:m,colorScheme:v,legendInteraction:void 0,legendPosition:M,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,chartType:"ViolinPlot",chartId:O,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;const I=r(()=>e=>{const t=m?Be(e,m,T.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.6}},[m,T.colorScale]),$=r(()=>Dn(I,T.activeSelectionHook,A),[I,T.activeSelectionHook,A]),z=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;if(r)return e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(t.data)?t.data:[]).map(e=>{const t="function"==typeof h?h(e):e[h];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),a=i.length,s=a>0?i[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[h]),R=po({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(R)return e.createElement(eo,{componentName:"ViolinPlot",message:R,width:j,height:C});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:$,bins:y,showIQR:p,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:b,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:f,showGrid:D}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Vn(x)||z}),(S||E)&&{customHoverBehavior:T.customHoverBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(ro,{componentName:"ViolinPlot",width:j,height:C},e.createElement(ar,Object.assign({ref:a},F)))});gr.displayName="ViolinPlot";const yr=c(function(n,o){var i;const a=Rn(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),s=t(null);u(o,()=>({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:y="horizontal",valueFormat:p,colorBy:f,colorScheme:m="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=a.width,D=a.height,_=a.enableHover,B=a.showGrid,H=a.title,W=a.categoryLabel,T=a.valueLabel,I=l||[],$=Eo({data:I,rawData:l,colorBy:f,colorScheme:m,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if($.earlyReturn)return $.earlyReturn;const z=Wn(I,v,g),R=r(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=f?Be(e,f,$.colorScale):_n,t},[f,$.colorScale,b]),F=r(()=>Dn(R,$.effectiveSelectionHook,S),[R,$.effectiveSelectionHook,S]),G=r(()=>Jn({categoryAccessor:h,valueAccessor:g}),[h,g]),Y=po({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(Y)return e.createElement(eo,{componentName:"DotPlot",message:Y,width:N,height:D});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:z}),{oAccessor:h,rAccessor:g,projection:"horizontal"===y?"horizontal":"vertical",pieceStyle:F,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:$.margin,barPadding:x,enableHover:_,showAxes:a.showAxes,oLabel:W,rLabel:T,rFormat:p,showGrid:B,oSort:v}),$.legendBehaviorProps),H&&{title:H}),d&&{className:d}),{tooltipContent:!1===k?()=>null:Vn(k)||G}),(E||O)&&{customHoverBehavior:$.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(ro,{componentName:"DotPlot",width:N,height:D},e.createElement(ar,Object.assign({ref:s},q)))});function pr(t){const n=Rn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:k,chartId:w,loading:A,emptyContent:S,legendPosition:E}=t,O=n.width,P=n.height,L=n.enableHover,M=n.showGrid,j=n.title,C=n.categoryLabel,N=n.valueLabel,D=o||[],_=Eo({data:D,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:E,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:k,chartType:"RidgelinePlot",chartId:w,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:A,emptyContent:S,width:O,height:P});if(_.earlyReturn)return _.earlyReturn;const B=r(()=>e=>{const t=g?Be(e,g,_.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.5}},[g,_.colorScale]),H=r(()=>Dn(B,_.activeSelectionHook,b),[B,_.activeSelectionHook,b]),W=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;return r?e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),T=po({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:s,valueAccessor:l}});if(T)return e.createElement(eo,{componentName:"RidgelinePlot",message:T,width:O,height:P});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:D}),{oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:H,bins:u,size:[O,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_.margin,barPadding:p,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:N,rFormat:h,showGrid:M,oSort:!1,amplitude:d}),_.legendBehaviorProps),j&&{title:j}),a&&{className:a}),{tooltipContent:!1===f?()=>null:Vn(f)||W}),(x||k)&&{customHoverBehavior:_.customHoverBehavior}),m&&m.length>0&&{annotations:m}),v);return e.createElement(ro,{componentName:"RidgelinePlot",width:O,height:P},e.createElement(ar,Object.assign({},I)))}yr.displayName="DotPlot",pr.displayName="RidgelinePlot";const fr=c(function(n,o){var i,a;const l=Rn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",colorBy:f,colorScheme:m="category10",startAngle:v=0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=l.width,C=l.height,N=l.enableHover,D=l.showLegend,_=l.title,B=d||[],H=f||y,W=Ao({isPushMode:void 0===d,colorBy:H,colorScheme:m,showLegend:D,legendPosition:M}),T=s(W.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[W.wrapPush]),I=s(W.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[W.wrapPushMany]);u(o,()=>({push:T,pushMany:I,clear:()=>{var e;W.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[T,I,W.resetCategories]);const $=Eo({data:B,rawData:d,colorBy:H,colorScheme:m,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:S,chartType:"PieChart",chartId:E,showLegend:D,userMargin:h,marginDefaults:l.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if($.earlyReturn)return $.earlyReturn;const z=r(()=>e=>H?$.colorScale?{fill:Be(e,H,$.colorScale)}:{}:{fill:_n},[H,$.colorScale]),R=r(()=>Dn(z,$.effectiveSelectionHook,w),[z,$.effectiveSelectionHook,w]),F=r(()=>Jn({categoryAccessor:y,valueAccessor:p,groupAccessor:f&&f!==y?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[y,p,f]),G=po({componentName:"PieChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(G)return e.createElement(eo,{componentName:"PieChart",message:G,width:j,height:C});const Y=r(()=>W.streamingLegend?Object.assign(Object.assign({},$.legendBehaviorProps),{legend:W.streamingLegend,legendPosition:M||$.legendPosition}):$.legendBehaviorProps,[$.legendBehaviorProps,$.legendPosition,W.streamingLegend,M]),q=r(()=>{if(W.streamingMarginAdjust){const e=Object.assign({},$.margin);for(const[t,n]of Object.entries(W.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return $.margin},[$.margin,W.streamingMarginAdjust]),X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=d&&{data:B}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:R,startAngle:v,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q,enableHover:N,showAxes:!1}),Y),_&&{title:_}),g&&{className:g}),{tooltipContent:!1===b?()=>null:Vn(b)||F}),(A||S)&&{customHoverBehavior:$.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(ro,{componentName:"PieChart",width:j,height:C},e.createElement(ar,Object.assign({ref:c},X)))});fr.displayName="PieChart";const mr=c(function(n,o){var i,a;const l=Rn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,linkedHover:n.linkedHover}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",innerRadius:f=60,centerContent:m,colorBy:v,colorScheme:b="category10",startAngle:x=0,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=l.width,D=l.height,_=l.enableHover,B=l.showLegend,H=l.title,W=d||[],T=v||y,I=Ao({isPushMode:void 0===d,colorBy:T,colorScheme:b,showLegend:B,legendPosition:C}),$=s(I.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[I.wrapPush]),z=s(I.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[I.wrapPushMany]);u(o,()=>({push:$,pushMany:z,clear:()=>{var e;I.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[$,z,I.resetCategories]);const R=Eo({data:W,rawData:d,colorBy:T,colorScheme:b,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:T?["string"==typeof T?T:""]:[],unwrapData:!0,onObservation:O,chartType:"DonutChart",chartId:P,showLegend:B,userMargin:h,marginDefaults:l.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if(R.earlyReturn)return R.earlyReturn;const F=r(()=>e=>T?R.colorScale?{fill:Be(e,T,R.colorScale)}:{}:{fill:_n},[T,R.colorScale]),G=r(()=>Dn(F,R.effectiveSelectionHook,S),[F,R.effectiveSelectionHook,S]),Y=r(()=>Jn({categoryAccessor:y,valueAccessor:p,groupAccessor:v&&v!==y?v:void 0,groupLabel:"string"==typeof v?v:"group",pieData:!0}),[y,p,v]),q=po({componentName:"DonutChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(q)return e.createElement(eo,{componentName:"DonutChart",message:q,width:N,height:D});const X=r(()=>I.streamingLegend?Object.assign(Object.assign({},R.legendBehaviorProps),{legend:I.streamingLegend,legendPosition:C||R.legendPosition}):R.legendBehaviorProps,[R.legendBehaviorProps,R.legendPosition,I.streamingLegend,C]),V=r(()=>{if(I.streamingMarginAdjust){const e=Object.assign({},R.margin);for(const[t,n]of Object.entries(I.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return R.margin},[R.margin,I.streamingMarginAdjust]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=d&&{data:W}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:G,innerRadius:f,startAngle:x,centerContent:m,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,enableHover:_,showAxes:!1}),X),H&&{title:H}),g&&{className:g}),{tooltipContent:!1===k?()=>null:Vn(k)||Y}),(E||O)&&{customHoverBehavior:R.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(ro,{componentName:"DonutChart",width:N,height:D},e.createElement(ar,Object.assign({ref:c},U)))});mr.displayName="DonutChart";const vr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},br={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class xr{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=kr(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 kr(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=wr(l,c,u,d,s),g=d.x-l.x,y=d.y-l.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;h.x+=-y/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=wr(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 wr(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 Ar(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Sr(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 y=i[t];g.length>y;++y){var p=g[y];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]=y}else{if(o[t]===n[t]){var f=[],m=[],v=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(r[b]=!1,f.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=y;break}}d.push(f);var x=Array(v);for(y=0;m.length>y;y++)for(var k=0;m[y].length>k;k++)x[--v]=m[y][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 y=h[l];if(0!==y.length){y.sort(function(e,t){return e-t}),c=[y[0]];for(var p=1;y.length>p;p++)y[p]!==y[p-1]&&c.push(y[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 y=0;s.length>y;y++)for(var p=0;s[y].length>p;p++){var f=s[y][p];i[+f]=!1,a[f]={}}c(n),n+=1}else n=h}return o}function Er(e){return e.y0-e.y1>0?"up":"down"}function Or(e,t){return t(e.source)==t(e.target)}function Pr(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 Lr(e){return e.target.x0-e.source.x1}function Mr(e,t){var n=Cr(e),o=Lr(t)/Math.tan(n);return"up"==Er(e)?e.y1-o:e.y1+o}function jr(e,t){var n=Cr(e),o=Lr(t)/Math.tan(n);return"up"==Er(e)?e.y1+o:e.y1-o}function Cr(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Nr(e,t){return t(e)}function Dr(e){return Br(e.source)}function _r(e){return Br(e.target)}function Br(e){return(e.y0+e.y1)/2}function Hr(e){return e.virtual?0:e.value}function Wr(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Or(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Or(e,t)?o+1:o}),n+o}function Tr(e){return e.target.depth}function Ir(e,t){return e.sourceLinks.length?e.depth:t-1}function $r(e,t){return e.y0-t.y0}function zr(e,t){return t.y0-e.y0}function Rr(e,t){return e.y1-t.y1}function Fr(e,t){return t.y1-e.y1}function Gr(e,t){return qr(e.source,t.source)||e.index-t.index}function Yr(e,t){return qr(e.target,t.target)||e.index-t.index}function qr(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Xr(e,t){return Vr(e)==Vr(t)?"bottom"==e.circularLinkType?zr(e,t):$r(e,t):Vr(t)-Vr(e)}function Vr(e){return e.target.column-e.source.column}function Ur(e,t){return Kr(e)==Kr(t)}function Kr(e){return e.y0-e.y1>0?"up":"down"}function Qr(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=_(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}),Zr(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Zr(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,Or(e,t)&&Pr(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?zr:$r);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?Fr:Rr),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 Zr(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(Or(e,t)&&Pr(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&&Jr(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 Jr(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function ei(e){return function(){return e}}function ti(e){return e.index}function ni(e){return e.nodes}function oi(e){return e.links}function ri(e,t,n){var o=B(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+=Br(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Br(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?Wr(t,n)-Wr(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==Wr(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 ii(e,t,n,o,r,i){var a=B(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&&Wr(r,n)>0){var l=T(r.sourceLinks,_r),c=T(r.targetLinks,Dr),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Br(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=T(r.sourceLinks,_r),g=T(r.targetLinks,Dr),y=((h&&g?(h+g)/2:h||g)-Br(r))*t;r.y0+=y,r.y1+=y}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||qr),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 ai(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Yr),e.targetLinks.sort(Gr)}),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 si(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=ti,l=Ir,c=void 0,u=32,d=2,h=ni,g=oi;function y(){var y={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 I(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=Ar(n,o)),"object"!=typeof r&&(r=e.target=Ar(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=Sr(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){Nr(e,t)!=Nr(r.source,t)&&Nr(e,t)!=Nr(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),Or(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(W(e.sourceLinks,Hr),W(e.targetLinks,Hr)),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 y=B(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=H(y,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=B(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=_(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/W(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),ri(h,c,s),ii(h,c,s,g,g,u),ai(h),Qr(h,s,d,10,8),ri(h,c,s),ii(h,c,s,g,g,u),ai(h),Qr(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 Nr(n.source,t)==Nr(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(!Ur(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Mr(t,e);return e.y1-n}if(t.target.column>e.target.column)return Mr(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 Nr(n.target,t)==Nr(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(!Ur(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=jr(t,e);return e.y0-n}if(t.source.column>e.source.column)return jr(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=_(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),Qr(h,s,d,10,8)}(y),y}return y.update=function(e){return ai(e),Qr(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(r=+e,y):r},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:ei(e),y):h},y.links=function(e){return arguments.length?(g="function"==typeof e?e:ei(e),y):g},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:ei(e),y):s},y.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:ei(e),y):l},y.nodeSort=function(e){return arguments.length?(c=e,y):c},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],y):[[e,t],[n,o]]},y.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],y):[n-e,o-t]},y}const li=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.y1,a=e.target.y0,s=ce(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=ce(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 ci(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 ui={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(Tr))-1:0},justify:Ir},di={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,y=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,f=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=si().extent(v).links(m).nodes(f).nodeAlign(ui[h]||Ir).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(y),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of f)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 f)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 f){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(`${"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(`${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:j,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const p=[],f=[],m=[];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(t):{},r={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};p.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const v=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of v){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";u?o=u(e).fill||o:"target"===h&&n?o=y.get(n.id)||o:t&&(o=y.get(t.id)||o);const r=u?u(e):{};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;f.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}}),f.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?ci(e):li(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};f.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(b=n.nodeLabel)?"function"==typeof b?b:e=>e[b]||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.x0+e/2,s=n.y1+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 b;return{sceneNodes:p,sceneEdges:f,labels:m}}},hi={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=gi(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=yi(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=yi(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)))),y=h?40:g,p=pi(n.nodeSize,n.nodeSizeRange,e),f=e=>p(e),m=ue().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),v=de().force("charge",he().strength(e=>-25*f(e))).force("center",ge(s,l).strength(.8)).force("x",ye(s).strength(.15)).force("y",pe(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;y>e;++e)v.tick();for(const t of e){if(null==t.x||null==t.y)continue;const e=f(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=pi(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:j,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=s?s(t):{},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(e):{},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=(f=n.nodeLabel)?"function"==typeof f?f:e=>e[f]||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(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:h,sceneEdges:g,labels:y}}};function gi(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 yi(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 pi(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=_(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 fi=j,mi={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 y=e.length,p=Array.from({length:y},()=>Array.from({length:y},()=>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 f=me().padAngle(r);a&&f.sortGroups(a);const m=f(p),v=m.groups,b=re().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,y=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:fi,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const m=fe().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(n).fill||f.get(n.id)||p[t%p.length]:f.get(n.id)||p[t%p.length];const a=h?h(n):{},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=vi(n,u,d);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=f.get(n.id)||r:t&&(r=f.get(t.id)||r)}const a=g?g(e):{},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 vi(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(" ")}function bi(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}const xi={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=z(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=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"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=q();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=G().size([n,o]).tile(Y).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;F().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 y=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:Ei(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?ki(i,o,n):"treemap"===a||"partition"===a?wi(i,o):"circlepack"===a&&Ai(i,o),i.__hierarchyNode=o,e.push(i),y.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.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=[],y=n.treeOrientation||"vertical",p="radial"===y,f=o[0]/2,m=o[1]/2,v="number"==typeof(x=n.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const t of e){let e=t.x,o=t.y;p&&(e+=f,o+=m);const i=r(t);let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=b[t.depth%b.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 k=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+=f,r+=m,a+=f,s+=m);const u=Si(o,r,a,s,y),d=i(e),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:k};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Oi(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+=f,s+=m),p){const e=a-f,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"===y?((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=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];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(n);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,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:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Oi(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const d=!((null===(i=c.data)||void 0===i?void 0:i.children)&&c.data.children.length>0);if(!a){if("leaf"===r&&!d)continue;if("parent"===r&&d)continue}const h=n?n(c):c.id;if(!h)continue;if((d?30:40)>e||(d?16:14)>u)continue;let g=o(c).fill||"#4d430c";t.colorByDepth&&void 0!==c.depth&&(g=l[c.depth%l.length]);const y=bi(g);s.push(d?{x:c.x0+e/2,y:c.y0+u/2,text:h+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:h+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}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=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(n);let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.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=Oi(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(r).fill||"#4d430c";if(t.colorByDepth&&void 0!==r.depth&&(c=d[r.depth%d.length]),a){const t=bi(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 ki(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 wi(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 Ai(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 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}`}}function Ei(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 Oi(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 Pi(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const Li={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,y=Pi(n);y.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function f(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=f(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}),y.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},E=p?u/h(S)*A:u*A,O=se().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),P=O(k),L=g(S);for(let t=0;k.length>t;t++){const s=(P[t].startAngle+P[t].endAngle)/2,c=k[t],u=f(l(c)),h=i+E*Math.sin(s),g=a+E*Math.cos(s)*L;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}),y.metaMap.set(u,{ring:E,angle:s,depth:d,parentId:n,eccentricity:L}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,E,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=[],y=[];if(!1!==n.orbitShowRings){const t=Pi(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(t),n=c?c(t):{},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(n);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;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:y}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=Pi(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)},Mi={sankey:di,force:hi,chord:mi,tree:xi,cluster:xi,treemap:xi,circlepack:xi,partition:xi,orbit:Li};function ji(e){return Mi[e]}class Ci{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({},vr),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new xr(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({},vr),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new xr(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({},Ni(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Ni(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Ni(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}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,Ni(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Ni(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange):(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||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=ji(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(const e of c)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}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=ji(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=ji(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=ji(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=Ie(e,this.transition),n=Te(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=$e(e._prevX0,e._targetX0,n),e.x1=$e(e._prevX1,e._targetX1,n),e.y0=$e(e._prevY0,e._targetY0,n),e.y1=$e(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=$e(e._prevY0,e._targetY0,n),e.y1=$e(e._prevY1,e._targetY1,n),e.sankeyWidth=$e(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.y1,i=n.y0,a=ce(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=ce(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 Ni(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 Di(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=_i(t,n,o);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=Ti(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function _i(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){const o=Fe(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=Ge(Math.atan2(r,o)),s=Ge(e.startAngle),l=Ge(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 Bi=null,Hi=null;function Wi(){return Hi||(Bi=document.createElement("canvas"),Bi.width=1,Bi.height=1,Hi=Bi.getContext("2d")),Hi}function Ti(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 Ii(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:y="right",foregroundGraphics:p,sceneNodes:f,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:f});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,ct({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:y,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&f).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=f.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 y=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:y+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function $i(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=t.style.fill;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 zi(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 Ri(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 Fi(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()}Ii.displayName="NetworkSVGOverlay";const Gi={top:20,right:80,bottom:20,left:80},Yi={top:40,right:40,bottom:40,left:40},qi=new Set(["chord","force","circlepack","orbit"]),Xi=[800,600],Vi={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 Ui({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:Vi},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:Vi},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:Vi},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 Ki=c(function(i,a){var l,c,d,h,g,y,p,f,m,v,b;const{chartType:x,nodes:k,edges:w,data:A,initialEdges:S,nodeIDAccessor:E="id",sourceAccessor:O="source",targetAccessor:P="target",valueAccessor:L="value",childrenAccessor:M,hierarchySum:j,orientation:C="horizontal",nodeAlign:N="justify",nodePaddingRatio:D=.05,nodeWidth:_=15,iterations:B=300,forceStrength:H=.1,padAngle:W=.01,groupWidth:T=20,sortGroups:I,edgeSort:$,treeOrientation:z="vertical",edgeType:R="curve",padding:F,paddingTop:G,tensionConfig:Y,showParticles:q=!1,particleStyle:X,nodeStyle:V,edgeStyle:U,colorBy:K,colorScheme:Q="category10",edgeColorBy:Z="source",edgeOpacity:J=.5,colorByDepth:ee=!1,nodeSize:te=8,nodeSizeRange:ne=[5,20],nodeLabel:oe,showLabels:ie=!0,labelMode:ae,size:se=Xi,responsiveWidth:le,responsiveHeight:ce,margin:ue,className:de,background:he,enableHover:ge=!0,tooltipContent:ye,customHoverBehavior:pe,customClickBehavior:fe,onObservation:me,chartId:ve,onTopologyChange:be,annotations:xe,svgAnnotationRules:ke,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,title:Le,foregroundGraphics:Me,backgroundGraphics:je,decay:Ne,pulse:De,staleness:_e,thresholds:Be,accessibleTable:He,orbitMode:We,orbitSize:Te,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:ze,orbitEccentricity:Re,orbitShowRings:Fe,orbitAnimated:Ge}=i,Ye=qi.has(x)?Yi:Gi,[qe,Xe]=tt(se,le,ce),Ve=Object.assign(Object.assign({},Ye),ue),Ue=Xe[0]-Ve.left-Ve.right,Ke=Xe[1]-Ve.top-Ve.bottom,Qe="function"==typeof Me?Me({size:Xe,margin:Ve}):Me,Ze=r(()=>Object.assign(Object.assign({},vr),Y),[Y]),et=r(()=>Object.assign(Object.assign({},br),X),[X]),ot=r(()=>({chartType:x,nodeIDAccessor:E,sourceAccessor:O,targetAccessor:P,valueAccessor:L,childrenAccessor:M,hierarchySum:j,orientation:C,nodeAlign:N,nodePaddingRatio:D,nodeWidth:_,iterations:B,forceStrength:H,padAngle:W,groupWidth:T,sortGroups:I,edgeSort:$,treeOrientation:z,edgeType:R,padding:F,paddingTop:G,tensionConfig:Ze,showParticles:q,particleStyle:et,nodeStyle:V,edgeStyle:U,nodeLabel:oe,showLabels:ie,labelMode:ae,colorBy:K,colorScheme:Q,edgeColorBy:Z,edgeOpacity:J,colorByDepth:ee,nodeSize:te,nodeSizeRange:ne,decay:Ne,pulse:De,staleness:_e,thresholds:Be,orbitMode:We,orbitSize:Te,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:ze,orbitEccentricity:Re,orbitShowRings:Fe,orbitAnimated:Ge}),[x,E,O,P,L,M,j,C,N,D,_,B,H,W,T,I,$,z,R,F,G,Ze,q,et,V,U,oe,ie,ae,K,Q,Z,J,ee,te,ne,Ne,De,_e,Be,We,Te,Ie,$e,ze,Re,Fe,Ge]),rt=t(null),it=t(0),at=t(0),st=t(!0),lt=It(e=>e.theme),ct=t(()=>{}),ut=t(null);ut.current||(ut.current=new Ci(ot));const[dt,ht]=n(null),[gt,yt]=n(0),[pt,ft]=n(0),[mt,vt]=n(!1),bt=t(null),xt=t(new Map),kt=t(0),wt=s(e=>{if("function"==typeof K)return K(e)+"";if("string"==typeof K&&e.data){const t=e.data[K];if(void 0!==t){if(!xt.current.has(t+"")){const e=Array.isArray(Q)?Q:Ce;xt.current.set(t+"",e[kt.current++%e.length])}return xt.current.get(t+"")}}if(!xt.current.has(e.id)){const t=Array.isArray(Q)?Q:Ce;xt.current.set(e.id,t[kt.current++%t.length])}return xt.current.get(e.id)},[K,Q]),At=s(e=>{if("function"==typeof Z)return Z(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===Z&&n?wt(n):t?wt(t):"#999"},[Z,wt]),St=s(e=>{if(!(null==X?void 0:X.colorBy))return At(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===et.colorBy&&n?wt(n):t?wt(t):"#999"},[null==X?void 0:X.colorBy,et.colorBy,wt,At]),Et="sankey"===x&&q||!!De||null!==(c=null===(l=ut.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c,Ot=s(()=>{it.current&&!Et||it.current||(it.current=requestAnimationFrame(()=>ct.current()))},[Et]);o(()=>{var e;null===(e=ut.current)||void 0===e||e.updateConfig(ot),st.current=!0,Ot()},[ot,Ot]),o(()=>{st.current=!0,Ot()},[lt,Ot]);const Lt=s(()=>{const e=ut.current;if(!e)return;e.runLayout([Ue,Ke]),e.buildScene([Ue,Ke]),st.current=!0;const t=Array.isArray(Q)?Q:Ce,n=Array.from(e.nodes.values());for(let e=0;n.length>e;e++){const o=n[e];xt.current.has(o.id)||xt.current.set(o.id,t[e%t.length])}if(kt.current=n.length,yt(e.layoutVersion),be){const{nodes:t,edges:n}=e.getLayoutData();be(t,n)}},[Ue,Ke,be,Q]),Mt=s(e=>{const t=ut.current;t&&(t.ingestEdge(e)&&Lt(),Ot())},[Lt,Ot]),Ct=s(e=>{const t=ut.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Lt(),Ot()},[Lt,Ot]),_t=s(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),xt.current.clear(),kt.current=0,yt(0),ht(null),bt.current=null,st.current=!0,Ot()},[Ot]),Bt=s(()=>{const e=ut.current;e&&(e.tension+=999,Lt(),Ot())},[Lt,Ot]);u(a,()=>({push:Mt,pushMany:Ct,clear:_t,getTopology:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=ut.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:Bt,getTension:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Mt,Ct,_t,Bt]);const Ht=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),Wt=Ht?A||(Array.isArray(w)?void 0:w):void 0;o(()=>{const e=ut.current;if(e)if(Ht&&Wt)e.ingestHierarchy(Wt,[Ue,Ke]),e.buildScene([Ue,Ke]),st.current=!0,Ot();else{const t=k||[],n=Array.isArray(w)?w:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[Ue,Ke]),e.buildScene([Ue,Ke]);const o=Array.isArray(Q)?Q:Ce,r=Array.from(e.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];xt.current.has(t.id)||xt.current.set(t.id,o[e%o.length])}kt.current=r.length,st.current=!0,Ot()}},[k,w,A,Wt,Ht,Ue,Ke,ot,Ot,Q]),o(()=>{S&&S.length>0&&Ct(S)},[]);const Tt=s(e=>{if(pe&&pe(e),me){const t=Date.now();me(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ve}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ve})}},[pe,me,ve]),Rt=s(e=>{if(fe&&fe(e),me){const t=Date.now();me(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ve}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ve})}},[fe,me,ve]),Ft=t(()=>{}),Gt=t(()=>{});Ft.current=e=>{if(!ge)return;const t=rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,r=e.clientY-n.top-Ve.top;if(0>o||o>Ue||0>r||r>Ke)return void(bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot()));const i=ut.current;if(!i)return;const a=Di(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot()));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});bt.current=l,ht(l),Tt&&(Tt(l),st.current=!0),Ot()},Gt.current=()=>{bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot())};const Yt=t(()=>{});Yt.current=e=>{if(!fe&&!me)return;const t=rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,r=e.clientY-n.top-Ve.top;if(0>o||o>Ue||0>r||r>Ke)return;const i=ut.current;if(!i)return;const a=Di(i.sceneNodes,i.sceneEdges,o,r);if(a){const e=a.datum||{};Rt(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 Rt(null)},s(e=>Ft.current(e),[]);const Vt=s(()=>Gt.current(),[]),Ut=s(e=>Yt.current(e),[]),Kt=t(-1),Qt=s(e=>{const t=ut.current;if(!t)return;const n=function(e){const t=[];for(const n of e)"circle"===n.type&&null!=n.cx?t.push({x:n.cx,y:n.cy,datum:n.datum}):"rect"===n.type&&null!=n.x?t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum}):"arc"===n.type&&null!=n.cx&&t.push({x:n.cx,y:n.cy,datum:n.datum});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===n.length)return;const o=Kt.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Kt.current=-1,bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),void Ot();const i=0>o?0:r;Kt.current=i;const a=n[i],s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:"node",data:s,x:a.x,y:a.y});bt.current=l,ht(l),Tt&&(Tt(l),st.current=!0),Ot()},[Tt,Ot]),Zt=s(e=>{Kt.current=-1,Ft.current(e)},[]);ct.current=()=>{var e,t,n,o,r,i,a;it.current=0;const s=rt.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=ut.current;if(!c)return;const u=performance.now(),d=at.current?Math.min((u-at.current)/1e3,.1):.016;at.current=u;const h=c.advanceTransition(u),g=c.tickAnimation([Ue,Ke],d);(h||st.current||g)&&c.buildScene([Ue,Ke]);const y=zt();if(!$t(s,Xe,Ve,y))return;l.clearRect(-Ve.left,-Ve.top,Xe[0],Xe[1]),he&&(l.fillStyle=he,l.fillRect(0,0,Ue,Ke)),Ne&&c.applyDecay(),De&&c.applyPulse(u),Be&&c.applyThresholds(u),c.applyTopologyDiff(u);const p=null!==(e=null==_e?void 0:_e.threshold)&&void 0!==e?e:5e3,f=_e&&c.lastIngestTime>0&&u-c.lastIngestTime>p;if(f&&(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":$i(e,n);break;case"line":zi(e,n);break;case"ribbon":Ri(e,n);break;case"curved":Fi(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)),qt(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()),Xt(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),q&&c.particlePool&&!f){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:br.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:br.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,et);const t=.5*(null!==(n=et.speedMultiplier)&&void 0!==n?n:1);let o;if(et.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:br.radius,l=null!==(a=o.opacity)&&void 0!==a?a:br.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,et,St)}}f&&(l.globalAlpha=1);const m=st.current;if(st.current=!1,m||h||g){const e=rt.current;e&&e.setAttribute("aria-label",jt(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"))}(m||h||g)&&ft(e=>e+1),(Et||h||g||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(it.current=requestAnimationFrame(()=>ct.current()))},o(()=>(Ot(),()=>{it.current&&(cancelAnimationFrame(it.current),it.current=0)}),[Ot]),o(()=>{st.current=!0,Ot()},[x,Ue,Ke,he,Ot]),nt(_e,ut,st,Ot,mt,vt);const Jt=ge&&dt?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:Ve.left+dt.x,top:Ve.top+dt.y,transform:`translate(${dt.x>.6*Ue?"calc(-100% - 12px)":"12px"}, ${.3*Ke>dt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2,width:"max-content"}},ye?ye(dt):e.createElement(Ui,{data:dt})):null;if(Pt){const t=ut.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),n=e?A||(Array.isArray(w)?void 0:w):void 0;if(e&&n)t.ingestHierarchy(n,[Ue,Ke]),t.buildScene([Ue,Ke]);else{const e=k||[],n=Array.isArray(w)?w:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[Ue,Ke]),t.buildScene([Ue,Ke]))}}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"+(de?" "+de:""),role:"img","aria-label":"string"==typeof Le?Le:"Network chart",style:{position:"relative",width:Xe[0],height:Xe[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Xe[0],height:Xe[1],style:{position:"absolute",left:0,top:0}},je&&e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},je),e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},he&&e.createElement("rect",{x:0,y:0,width:Ue,height:Ke,fill:he}),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":case"ribbon":return e.createElement("path",{key:"net-edge-"+n,d:t.pathD,fill:t.style.fill||"#999",fillOpacity:t.style.fillOpacity,stroke:t.style.stroke||"none",strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"curved":return e.createElement("path",{key:"net-edge-"+n,d:t.pathD,fill:t.style.fill||"none",stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":return e.createElement("circle",{key:"net-circle-"+n,cx:t.cx,cy:t.cy,r:t.r,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"rect":return e.createElement("rect",{key:"net-rect-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"arc":{const o=t,r=re().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:o.style.fill||"#4e79a7",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(Ii,{width:Ue,height:Ke,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ve,labels:r,sceneNodes:n,title:Le,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,foregroundGraphics:Qe,annotations:xe,svgAnnotationRules:ke,annotationFrame:0}))}const en=ut.current;return e.createElement("div",{ref:qe,className:"stream-network-frame"+(de?" "+de:""),role:"img","aria-label":"string"==typeof Le?Le:"Network chart",tabIndex:0,style:{position:"relative",width:le?"100%":Xe[0],height:ce?"100%":Xe[1],overflow:"visible"},onMouseMove:ge?Zt:void 0,onMouseLeave:ge?Vt:void 0,onClick:fe||me?Ut:void 0,onKeyDown:Qt},je&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Xe[0],height:Xe[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},je)),e.createElement("canvas",{ref:rt,"aria-label":jt(null!==(p=null===(y=null==en?void 0:en.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==p?p:0,null!==(m=null===(f=null==en?void 0:en.sceneEdges)||void 0===f?void 0:f.length)&&void 0!==m?m:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(Dt,{hoverPoint:dt}),He&&e.createElement(Nt,{nodes:null!==(v=null==en?void 0:en.sceneNodes)&&void 0!==v?v:[],edges:null!==(b=null==en?void 0:en.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart"}),e.createElement(Ii,{width:Ue,height:Ke,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ve,labels:(null==en?void 0:en.labels)||[],sceneNodes:null==en?void 0:en.sceneNodes,title:Le,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,foregroundGraphics:Qe,annotations:xe,svgAnnotationRules:ke,annotationFrame:pt}),Jt,(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:mt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},mt?"STALE":"LIVE"))});Ki.displayName="StreamNetworkFrame";const Qi=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:y="source",targetAccessor:p="target",nodeLabel:f,colorBy:m,colorScheme:v="category10",nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:E=.1,tooltip:O,frameProps:P={},onObservation:L,chartId:M,selection:j,linkedHover:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=s.width,W=s.height,T=s.enableHover,I=s.showLegend,$=null!==(i=s.showLabels)&&void 0!==i&&i,z=s.title,R=lo(N,H,W);if(R)return R;const F=so(l,H,W,D);if(F)return F;const G=l||[],Y=c||[],q=Hn(G,m,v),X=r(()=>{if(!m)return[];const e=new Set;for(const t of G){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[G,m]),V=$n(_,m,X),U=r(()=>e=>{const t={};return t.fill=m?Be(e.data||e,m,q):_n,"number"==typeof b&&(t.r=b),t},[m,q,b]),K=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),Q=r(()=>{if($&&f)return"function"==typeof f?f:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[f])&&void 0!==n?n:e[f])&&void 0!==o?o:e.id}},[$,f]),{legend:Z,margin:J,legendPosition:ee}=In({data:G,colorBy:m,colorScale:q,showLegend:I,legendPosition:B,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:te}=Tn({selection:j,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:L,chartType:"ForceDirectedGraph",chartId:M}),ne=mo({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ne?e.createElement(eo,{componentName:"ForceDirectedGraph",message:ne,width:H,height:W}):e.createElement(ro,{componentName:"ForceDirectedGraph",width:H,height:W},e.createElement(Ki,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:G},null!=c&&{edges:Y},{size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,nodeIDAccessor:g,sourceAccessor:y,targetAccessor:p,iterations:S,forceStrength:E,nodeStyle:U,edgeStyle:K,colorBy:m,colorScheme:v,nodeSize:b,nodeSizeRange:x,nodeLabel:Q,showLabels:$,enableHover:T,tooltipContent:!1===O?()=>null:Vn(O)||void 0,customHoverBehavior:C||L?te:void 0,legend:Z,legendPosition:ee},_&&"none"!==_&&{legendHoverBehavior:V.onLegendHover,legendClickBehavior:V.onLegendClick,legendHighlightedCategory:V.highlightedCategory,legendIsolatedCategories:V.isolatedCategories},{className:h,title:z},P)))});function Zi(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 Ji(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 ea(e){return"function"==typeof e?e:t=>t[e]||1}function ta({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=Be(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=Be(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}}Qi.displayName="ForceDirectedGraph";const na=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:y="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:E,frameProps:O={},onObservation:P,chartId:L,selection:M,linkedHover:j,loading:C,emptyContent:N,legendInteraction:D}=n,_=s.width,B=s.height,H=s.enableHover,W=null===(i=s.showLabels)||void 0===i||i,T=s.title,I=lo(C,_,B);if(I)return I;const $=so(c,_,B,N);if($)return $;const z=c||[],R=r(()=>Ji(l,z,g,y),[l,z,g,y]),F=Hn(R,m,v),G=r(()=>{if(!m)return[];const e=new Set;for(const t of R){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[R,m]),Y=$n(D,m,G),q=R.length>0,X=r(()=>{if(q)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Be(e.data||e,m,F);else{const i=Array.isArray(v)?v:je[v]||Ce,a=Array.isArray(i)?i:Ce,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}},[q,m,F,v]),V=r(()=>{if(q)return ta({edgeColorBy:b,colorBy:m,colorScale:F,nodeStyleFn:X||(e=>({fill:_n})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[q,b,m,F,X,S]),U=r(()=>{if(!W)return;const e=A||f;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,A,f]),K=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:Q}=Tn({selection:M,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:P,chartType:"ChordDiagram",chartId:L}),Z=mo({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return Z?e.createElement(eo,{componentName:"ChordDiagram",message:Z,width:_,height:B}):e.createElement(ro,{componentName:"ChordDiagram",width:_,height:B},e.createElement(Ki,Object.assign({ref:a,chartType:"chord"},R.length>0&&{nodes:R},null!=c&&{edges:z},{size:[_,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:y,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:X,edgeStyle:V,colorBy:m,colorScheme:v,edgeColorBy:b,edgeOpacity:S,nodeLabel:U,showLabels:W,enableHover:H,tooltipContent:!1===E?()=>null:Vn(E)||void 0,customHoverBehavior:j||P?Q:void 0},D&&"none"!==D&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories},{className:h,title:T},O)))});na.displayName="ChordDiagram";const oa=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:y="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:E=.5,edgeSort:O,tooltip:P,frameProps:L={},onObservation:M,chartId:j,selection:C,linkedHover:N,loading:D,emptyContent:_,legendInteraction:B}=n,H=s.width,W=s.height,T=s.enableHover,I=null===(i=s.showLabels)||void 0===i||i,$=s.title,z=lo(D,H,W);if(z)return z;const R=so(c,H,W,_);if(R)return R;const F=c||[],G=r(()=>Ji(l,F,g,y),[l,F,g,y]),Y=Hn(G,m,v),q=r(()=>{if(!m)return[];const e=new Set;for(const t of G){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[G,m]),X=$n(B,m,q),V=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Be(e.data||e,m,Y):"#4d430c",t},[m,Y]),U=r(()=>ta({edgeColorBy:b,colorBy:m,colorScale:Y,nodeStyleFn:V,edgeOpacity:E,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,Y,V,E]),K=r(()=>{if(!I)return;const e=S||f;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}},[I,S,f]),Q=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:Z,customClickBehavior:J}=Tn({selection:C,linkedHover:N,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,chartType:"SankeyDiagram",chartId:j}),ee=mo({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return ee?e.createElement(eo,{componentName:"SankeyDiagram",message:ee,width:H,height:W}):e.createElement(ro,{componentName:"SankeyDiagram",width:H,height:W},e.createElement(Ki,Object.assign({ref:a,chartType:"sankey"},G.length>0&&{nodes:G},null!=c&&{edges:F},{size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:y,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:V,edgeStyle:U,colorBy:m,colorScheme:v,edgeColorBy:b,edgeOpacity:E,edgeSort:O,nodeLabel:K,showLabels:I,enableHover:T,tooltipContent:!1===P?()=>null:Vn(P)||void 0,customHoverBehavior:N||M?Z:void 0,customClickBehavior:M?J:void 0},B&&"none"!==B&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories},{className:h,title:$},L)))});function ra(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{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:y="category10",colorByDepth:p=!1,edgeStyle:f="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,chartId:w,selection:A,linkedHover:S,loading:E,legendInteraction:O}=t,P=o.width,L=o.height,M=o.enableHover,j=null===(n=o.showLabels)||void 0===n||n,C=o.title,N=lo(E,P,L);if(N)return N;const D=r(()=>Zi(null!=i?i:null,u),[i,u]),_=Hn(D,p?void 0:g,y),B=r(()=>{if(!g||p)return[];const e=new Set;for(const t of D){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[D,g,p]),H=$n(O,p?void 0:g,B),W=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?De[(e.depth||0)%De.length]:g?Be(e.data||e,g,_):_n,t},[g,p,_]),T=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),I=r(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return ea(d)},[l,d]),$=Object.assign(Object.assign({},o.marginDefaults),a),{customHoverBehavior:z}=Tn({selection:A,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,chartType:"TreeDiagram",chartId:w}),R=fo({componentName:"TreeDiagram",data:i});return R?e.createElement(eo,{componentName:"TreeDiagram",message:R,width:P,height:L}):e.createElement(ro,{componentName:"TreeDiagram",width:P,height:L},e.createElement(Ki,Object.assign({chartType:l},null!=i&&{data:i},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:I,treeOrientation:c,edgeType:f,nodeStyle:W,edgeStyle:T,colorBy:g,colorScheme:y,colorByDepth:p,nodeSize:v,nodeLabel:j?m||h:void 0,showLabels:j,enableHover:M,tooltipContent:!1===b?()=>null:Vn(b)||void 0,customHoverBehavior:S||k?z:void 0},O&&"none"!==O&&{legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:H.isolatedCategories},{className:s,title:C},x)))}function ia(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,labelMode:p="leaf",nodeLabel:f,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,chartId:S,loading:E,legendInteraction:O}=t,P=o.width,L=o.height,M=o.enableHover,j=null===(n=o.showLabels)||void 0===n||n,C=o.title,N=lo(E,P,L);if(N)return N;const{activeSelectionHook:D,customHoverBehavior:_}=Tn({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,chartType:"Treemap",chartId:S}),B=s(e=>{if(!e)return _(null);const t=e.data||e;_({data:(null==t?void 0:t.data)||t})},[_]),H=r(()=>Zi(null!=i?i:null,c),[i,c]),W=Hn(H,y?void 0:h,g),T=r(()=>{if(!h||y)return[];const e=new Set;for(const t of H){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[H,h,y]),I=$n(O,y?void 0:h,T),$=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=y?De[(e.depth||0)%De.length]:h?Be(e.data||e,h,W):_n,t},[h,y,W]),z=r(()=>D?e=>{var t;const n=Object.assign({},$(e));if(D.isActive)if(D.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}:$,[$,D,k]),R=r(()=>ea(u),[u]),F=void 0!==v?v:j&&"parent"===p?18:void 0,G=Object.assign(Object.assign({},o.marginDefaults),a),Y=fo({componentName:"Treemap",data:i});return Y?e.createElement(eo,{componentName:"Treemap",message:Y,width:P,height:L}):e.createElement(ro,{componentName:"Treemap",width:P,height:L},e.createElement(Ki,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:R,padding:m,paddingTop:F,nodeStyle:z,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:j?f||d:void 0,showLabels:j,labelMode:p,enableHover:M,tooltipContent:!1===b?()=>null:Vn(b)||void 0},(w||A)&&{customHoverBehavior:B},O&&"none"!==O&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories},{className:l,title:C},x)))}function aa(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:g=!1,nodeLabel:y,circleOpacity:p=.7,padding:f=4,tooltip:m,frameProps:v={},onObservation:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S}=t,E=o.width,O=o.height,P=o.enableHover,L=null===(n=o.showLabels)||void 0===n||n,M=o.title,j=lo(A,E,O);if(j)return j;const C=r(()=>Zi(null!=i?i:null,l),[i,l]),N=Hn(C,g?void 0:d,h),D=r(()=>{if(!d||g)return[];const e=new Set;for(const t of C){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[C,d,g]),_=$n(S,g?void 0:d,D),B=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?De[(e.depth||0)%De.length]:d?Be(e.data||e,d,N):_n,t},[d,g,N,p]),H=r(()=>ea(c),[c]),W=Object.assign(Object.assign({},o.marginDefaults),a),{customHoverBehavior:T}=Tn({selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,chartType:"CirclePack",chartId:x}),I=fo({componentName:"CirclePack",data:i});return I?e.createElement(eo,{componentName:"CirclePack",message:I,width:E,height:O}):e.createElement(ro,{componentName:"CirclePack",width:E,height:O},e.createElement(Ki,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:H,padding:f,nodeStyle:B,colorBy:d,colorScheme:h,colorByDepth:g,nodeLabel:L?y||u:void 0,showLabels:L,enableHover:P,tooltipContent:!1===m?()=>null:Vn(m)||void 0,customHoverBehavior:w||b?T:void 0},S&&"none"!==S&&{legendHoverBehavior:_.onLegendHover,legendClickBehavior:_.onLegendClick,legendHighlightedCategory:_.highlightedCategory,legendIsolatedCategories:_.isolatedCategories},{className:s,title:M},v)))}oa.displayName="SankeyDiagram",ra.displayName="TreeDiagram",ia.displayName="Treemap",aa.displayName="CirclePack";const sa=De;function la(t){const n=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u="category10",colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:y=.25,revolution:p,revolutionStyle:f,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:E={},onObservation:O,chartId:P,selection:L,linkedHover:M,loading:j}=t,C=n.width,N=n.height,D=n.enableHover,_=n.title,B=lo(j,C,N);if(B)return B;const H=Hn(r(()=>Zi(o,s),[o,s]),d?void 0:c,u),W=r(()=>{if(Array.isArray(u))return u;const e=je[u];return Array.isArray(e)?e:Ce},[u]),T=r(()=>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?W[0]:sa[(e.depth||0)%sa.length]:c?Be(e.data||e,c,H):_n,n.opacity=o?1:.85,n},[c,d,H,W]),I=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),$=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:z}=Tn({selection:L,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:O,chartType:"OrbitDiagram",chartId:P}),R=r(()=>{if(z)return e=>{z(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z]),F=fo({componentName:"OrbitDiagram",data:o});return F?e.createElement(eo,{componentName:"OrbitDiagram",message:F,width:C,height:N}):e.createElement(ro,{componentName:"OrbitDiagram",width:C,height:N},e.createElement(Ki,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[C,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:T,edgeStyle:I,colorBy:c,colorScheme:u,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:Vn(w)||void 0,customHoverBehavior:M||O?R:void 0,foregroundGraphics:A,annotations:S,className:a,title:_,orbitMode:h,orbitSize:g,orbitSpeed:y,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k},E)))}la.displayName="OrbitDiagram";const ca=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:E,background:O,tooltipContent:P,tooltip:L,onHover:M,annotations:j,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:D,decay:_,pulse:B,staleness:H,transition:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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!=P?P:L,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:z}),J=s(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=lo(R,U[0],U[1]);if(ee)return ee;const te=so(m,U[0],U[1],F);if(te)return te;const ne={stroke:A,strokeWidth:S,strokeDasharray:E};return e.createElement(dn,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:O,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:j,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:D,decay:_,pulse:B,staleness:H,transition:W,legendPosition:Y})});ca.displayName="RealtimeLineChart";const ua=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:y,arrowOfTime:p="right",windowMode:f="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:E,fill:O,stroke:P,strokeWidth:L,gap:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,decay:$,pulse:z,staleness:R,transition:F,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U}=n,K=c.showAxes,Q=c.enableHover,Z=null!=g?g:c.marginDefaults,J=null!=h?h:[c.width,c.height],ee=null!=C?C:N,te=t(null),{customHoverBehavior:ne}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),oe=s(e=>{D&&D(e),ne(e)},[D,ne]);u(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const re=lo(q,J[0],J[1]);if(re)return re;const ie=so(v,J[0],J[1],X);if(ie)return ie;const ae={};return null!=O&&(ae.fill=O),null!=P&&(ae.stroke=P),null!=L&&(ae.strokeWidth=L),null!=M&&(ae.gap=M),e.createElement(dn,{ref:te,chartType:"bar",runtimeMode:"streaming",size:J,margin:Z,className:V?`${y||""} semiotic-emphasis-${V}`.trim():y,arrowOfTime:p,windowMode:f,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:E,barStyle:ae,showAxes:K,background:j,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:oe,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,decay:$,pulse:z,staleness:R,transition:F,legendPosition:U})});ua.displayName="RealtimeTemporalHistogram";const da=ua,ha=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:E,fill:O,opacity:P,stroke:L,strokeWidth:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:N,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeSwarmChart",chartId:z}),J=s(e=>{D&&D(e),Z(e)},[D,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=lo(R,U[0],U[1]);if(ee)return ee;const te=so(m,U[0],U[1],F);if(te)return te;const ne={};return null!=E&&(ne.radius=E),null!=O&&(ne.fill=O),null!=P&&(ne.opacity=P),null!=L&&(ne.stroke=L),null!=M&&(ne.strokeWidth=M),e.createElement(dn,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,legendPosition:Y})});ha.displayName="RealtimeSwarmChart";const ga=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:E,connectorWidth:O,gap:P,stroke:L,strokeWidth:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:N,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:z}),J=s(e=>{D&&D(e),Z(e)},[D,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=lo(R,U[0],U[1]);if(ee)return ee;const te=so(m,U[0],U[1],F);if(te)return te;const ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=E&&(ne.connectorStroke=E),null!=O&&(ne.connectorWidth=O),null!=P&&(ne.gap=P),null!=L&&(ne.stroke=L),null!=M&&(ne.strokeWidth=M),e.createElement(dn,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,legendPosition:Y})});ga.displayName="RealtimeWaterfallChart";const ya=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:E=20,aggregation:O="count",background:P,tooltipContent:L,tooltip:M,onHover:j,annotations:C,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:_,decay:B,pulse:H,staleness:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:M,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeHeatmap",chartId:z}),J=s(e=>{j&&j(e),Z(e)},[j,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=lo(R,U[0],U[1]);if(ee)return ee;const te=so(m,U[0],U[1],F);return te||e.createElement(dn,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:E,heatmapAggregation:O,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:C,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:_,decay:B,pulse:H,staleness:W,legendPosition:Y})});ya.displayName="RealtimeHeatmap";let[pa]=_t(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function fa({theme:t}){const n=It(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function ma({children:t}){const n=It(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function va({theme:t,children:n}){return e.createElement(Tt,null,e.createElement(fa,{theme:t}),e.createElement(ma,null,n))}function ba(){return It(e=>e.theme)}function xa(e,t){return vo(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"),ka(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);wa(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),y=new Image;y.width=l.width,y.height=l.height,yield new Promise((e,t)=>{y.onload=()=>{c.drawImage(y,0,0),a.toBlob(n=>{n?(wa(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},y.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},y.src=g})}})}function ka(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++)ka(o[e],r[e])}function wa(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 Aa={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"]},frameProps:{type:"object"}},Sa={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ea={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},Oa=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Pa=["vertical","horizontal"],La={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Sa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Oa},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({},Aa),Sa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Oa},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Sa),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Oa},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({},Aa),Sa),{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({},Aa),Sa),{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({},Aa),Sa),{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({},Aa),Sa),{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"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Sa),{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({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Aa),Ea),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pa},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Aa),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Aa),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Aa),{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({},Aa),{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:Pa},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({},Aa),{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({},Aa),{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({},Aa),{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({},Aa),{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({},Aa),{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"},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 Ma(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function ja(e,t){const n=[],o=La[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(La).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(!Ma(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=ho(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=po({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=fo({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=mo({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}}const Ca=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"]),Na=new Set(["data","nodes","edges"]),Da="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function _a(e,t,n){if(!La[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(La).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Ca.has(e)||!o&&Na.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Da(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Ba(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!La[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Da(e.props)}}function Ha(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Wa(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 Ta(e){return vo(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Ia(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 Ia(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")}const $a={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 za({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 Ra({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 Fa=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:y,style:p},f){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="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",O=e.useCallback(e=>vo(this,void 0,void 0,function*(){v.current&&(yield xa(v.current,Object.assign(Object.assign({},S),e)))}),[S]),P=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),L=e.useCallback(e=>vo(this,void 0,void 0,function*(){s&&(yield Ta(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(f,()=>({export:O,toggleFullscreen:P,copyConfig:L,element:m.current}),[O,P,L]);const M=t||n||l||k||w||A||h,j=c?e.createElement(za,{height:i}):u?e.createElement(Ra,{error:u}):d?e.createElement(to,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"+(y?" "+y:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:8,overflow:"hidden",background:"var(--semiotic-bg, #fff)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},M&&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:()=>O(),title:"Export chart","aria-label":"Export chart",style:Ga},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"}))),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:P,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:Ga},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:()=>L(),title:"Copy config","aria-label":"Copy chart configuration",style:Ga},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:$a[h].bg,color:$a[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})},j,g)))}),Ga={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 Ya({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 qa({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))}Ya.displayName="ChartGrid",qa.displayName="ContextLayout";function Xa({children:r,position:i="right",size:a=300,trigger:l="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:y,style:p}){const[f,m]=n(null),[v,b]=n(null),[x,k]=n(!1),[w,A]=n(!1),S=t(null),E=t(),O="click"===l?["click","click-end"]:["hover","hover-end"],{latest:P}=On({types:O,chartId:c,limit:1}),L=void 0!==u?u:P;o(()=>{if(L)if("click"===L.type||"hover"===L.type){const e=L;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(E.current),E.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==L.type&&"hover-end"!==L.type||M()},[L]),o(()=>{null==g||g(x)},[x,g]);const M=s(()=>{A(!0),k(!1),clearTimeout(E.current),E.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(E.current),[]),!f&&!w)return null;const j=f&&v?r(f,v):null;if(null===j&&!w)return null;const C=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}${y?" "+y:""}`,style:Object.assign(Object.assign({},C),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:Va},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}},j))}const Va={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};Xa.displayName="DetailsPanel";const Ua=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Ka=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Qa=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Za=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ja=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function es(e,t){const n=[],o=ja(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return La[e]?(function(e,t,n){const o=La[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=La[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){Ua.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){Ka.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=La[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(!Qa.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(!Za.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=La[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(!Ja.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),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}function ts(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 ns(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 os(e){return"nominal"===e||"ordinal"===e}function rs(e){return"quantitative"===e||"temporal"===e}const is={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"},as={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"},ss={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function ls(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,y;const p=[],{type:f,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 E;(null===(t=e.data)||void 0===t?void 0:t.values)?E=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 O={};e.width&&(O.width=e.width),e.height&&(O.height=e.height);const P=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(P&&(O.title=P),(null==k?void 0:k.field)&&(O.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=is[k.scale.scheme];e&&(O.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(O.pointOpacity=S.value);const L=null==b?void 0:b.aggregate,M=null==x?void 0:x.aggregate;if(E&&(L||M)){const e=M?x:b,t=M?b:x,n=ss[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)E=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}(E,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&E){const e=new Map;for(const n of E){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}E=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";E&&(O.data=E),(null==b?void 0:b.bin)?(O.valueAccessor=b.field,(null==x?void 0:x.field)&&(O.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(O.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(O.valueAccessor=x.field,(null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(O.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&&(O.bins=t),us(e,O,p)}let j;switch(f){case"bar":j=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",os(null==e?void 0:e.type)&&rs(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)):rs(null==e?void 0:e.type)&&os(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,O,E,L,M);break;case"line":if(j="LineChart",cs(b,x,O,L,M),(null==k?void 0:k.field)&&(O.lineBy=k.field),m.interpolate){const e=as[m.interpolate];e&&(O.curve=e)}!0===m.point&&(O.showPoints=!0),E&&(O.data=E);break;case"area":if((null==k?void 0:k.field)?(j="StackedAreaChart",O.areaBy=k.field):j="AreaChart",cs(b,x,O,L,M),m.interpolate){const e=as[m.interpolate];e&&(O.curve=e)}void 0!==m.opacity&&(O.areaOpacity=m.opacity),E&&(O.data=E);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(j="BubbleChart",O.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(O.sizeRange=w.scale.range)):j="Scatterplot",cs(b,x,O,L,M),E&&(O.data=E);break;case"rect":j="Heatmap",(null==b?void 0:b.field)&&(O.xAccessor=b.field),(null==x?void 0:x.field)&&(O.yAccessor=x.field),(null==k?void 0:k.field)&&(O.valueAccessor=k.field,delete O.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(O.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(O.yLabel=x.axis.title),E&&(O.data=E);break;case"arc":m.innerRadius&&m.innerRadius>0?(j="DonutChart",O.innerRadius=m.innerRadius):j="PieChart",(null==A?void 0:A.field)?O.valueAccessor=A.field:(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field),(null==k?void 0:k.field)&&(O.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(O.categoryAccessor=b.field),E&&(O.data=E);break;case"tick":j="DotPlot",os(null==b?void 0:b.type)?(O.categoryAccessor=b.field,(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(O.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(O.valueLabel=x.axis.title)):os(null==x?void 0:x.type)?(O.categoryAccessor=x.field,(null==b?void 0:b.field)&&(O.valueAccessor=L?"value":b.field),O.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(O.categoryLabel=x.axis.title),(null===(y=null==b?void 0:b.axis)||void 0===y?void 0:y.title)&&(O.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field)),E&&(O.data=E);break;default:p.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),j="Scatterplot",cs(b,x,O,L,M),E&&(O.data=E)}return us(j,O,p)}function cs(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 us(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}export{wo as AreaChart,sr as BarChart,dr as BoxPlot,Mo as BubbleChart,gn as CategoryColorProvider,Fa as ChartContainer,Ya as ChartGrid,na as ChordDiagram,aa as CirclePack,Lo as ConnectedScatterplot,qa as ContextLayout,Xa as DetailsPanel,mr as DonutChart,yr as DotPlot,Qi as ForceDirectedGraph,cr as GroupedBarChart,jo as Heatmap,hr as Histogram,ko as LineChart,jn as LinkedCharts,Xn as MultiLineTooltip,la as OrbitDiagram,fr as PieChart,ya as RealtimeHeatmap,da as RealtimeHistogram,ca as RealtimeLineChart,ha as RealtimeSwarmChart,ga as RealtimeWaterfallChart,pr as RidgelinePlot,oa as SankeyDiagram,Oo as Scatterplot,To as ScatterplotMatrix,So as StackedAreaChart,lr as StackedBarChart,ur as SwarmPlot,va as ThemeProvider,pa as TooltipProvider,ra as TreeDiagram,ia as Treemap,gr as ViolinPlot,Ia as configToJSX,Ta as copyConfig,ns as deserializeSelections,es as diagnoseConfig,xa as exportChart,Ba as fromConfig,Wa as fromURL,ls as fromVegaLite,ts as serializeSelections,_a as toConfig,Ha as toURL,Sn as useBrushSelection,yn as useCategoryColors,On as useChartObserver,En as useFilteredData,An as useLinkedHover,wn as useSelection,ba as useTheme,ja as validateProps};
|
|
1
|
+
import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as a,useCallback as s,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{brushX as h,brushY as g,brush as y}from"d3-brush";import{select as p}from"d3-selection";import{scaleOrdinal as f,scaleLinear as m,scaleSequential as v,scaleLog as b,scaleBand as x}from"d3-scale";import{interpolatePlasma as k,interpolateViridis as w,interpolatePurples as A,interpolateOranges as S,interpolateGreens as E,interpolateReds as O,interpolateBlues as P,schemeSet3 as L,schemeTableau10 as M,schemeCategory10 as j}from"d3-scale-chromatic";import{quadtree as C}from"d3-quadtree";import{bin as N,quantile as D,min as _,groups as B,max as H,sum as W,mean as T,group as I}from"d3-array";import{packEnclose as $,hierarchy as z,partition as R,pack as F,treemap as G,treemapBinary as Y,cluster as q,tree as X}from"d3-hierarchy";import{area as V,curveCatmullRom as U,curveCardinal as K,curveBasis as Q,curveStepBefore as Z,curveStepAfter as J,curveStep as ee,curveMonotoneY as te,curveMonotoneX as ne,curveLinear as oe,arc as re,line as ie,curveNatural as ae,pie as se}from"d3-shape";import le from"regression";import{interpolateNumber as ce}from"d3-interpolate";import{forceLink as ue,forceSimulation as de,forceManyBody as he,forceCenter as ge,forceX as ye,forceY as pe}from"d3-force";import{ribbon as fe,chord as me}from"d3-chord";class ve{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 be{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 xe{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 ke(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 we(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 Ae(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 Se(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 Ee(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 Oe(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 Pe(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Le(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 je={category10:j,tableau10:M,set3:L,blues:P,reds:O,greens:E,oranges:S,purples:A,viridis:w,plasma:k},Ce=j,Ne=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],De=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],_e=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 Be(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")||_e.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):Ce[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+""))%Ce.length]}function He(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return f().domain(o).range(n).unknown("#999");const i=je[n]||je.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:Ce;return f().domain(o).range(e).unknown("#999")}}function We(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 Te(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Ie(e,t){return Math.min((e-t.startTime)/t.duration,1)}function $e(e,t,n){return e+(t-e)*n}function ze(){return"undefined"!=typeof performance?performance.now():Date.now()}class Re{constructor(e){this.xExtent=new xe,this.yExtent=new xe,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._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._quadtree=null,this.config=e,this.buffer=new be(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Pe(e.timeAccessor||e.xAccessor,"time"),this.getY=Pe(e.valueAccessor||e.yAccessor,"value")):(this.getX=Pe(e.xAccessor,"x"),this.getY=Pe(e.yAccessor,"y")),this.getGroup=Me(e.groupAccessor),this.getCategory=Me(e.categoryAccessor),this.getSize=e.sizeAccessor?Pe(e.sizeAccessor,"size"):void 0,this.getColor=Me(e.colorAccessor),this.getBounds=e.boundsAccessor?Pe(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?Pe(e.y0Accessor,"y0"):void 0,this.getPointId=Me(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=Pe(e.openAccessor,"open"),this.getHigh=Pe(e.highAccessor,"high"),this.getLow=Pe(e.lowAccessor,"low"),this.getClose=Pe(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new be(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){this.buffer.clear(),this.xExtent.clear(),this.yExtent.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.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;const{config:s,buffer:l}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===s.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.getBufferArray(),u=this.xExtent.extent,d=this.yExtent.extent;let h=s.xExtent?[null!==(t=s.xExtent[0])&&void 0!==t?t:u[0],null!==(n=s.xExtent[1])&&void 0!==n?n:u[1]]:u,g=s.yExtent?[null!==(o=s.yExtent[0])&&void 0!==o?o:d[0],null!==(r=s.yExtent[1])&&void 0!==r?r:d[1]]:d;const y=s.yExtent&&null!=s.yExtent[0]&&null!=s.yExtent[1];if("stackedarea"===s.chartType&&!y&&l.size>0)if(s.normalize)g=[0,1+s.extentPadding];else{const e=`${l.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)g=this._stackExtentCache.yDomain;else{const t=this.groupData(c),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);g=[0,o+(o>0?o*s.extentPadding:1)],this._stackExtentCache={key:e,yDomain:g}}}else if("bar"===s.chartType&&s.binSize&&!y&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ke(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]}(l,this.getX,this.getY,s.binSize,this.getCategory);g=[0,e+e*s.extentPadding]}else if("waterfall"===s.chartType&&!y&&l.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]}(l,this.getY),n=t-e,o=n>0?n*s.extentPadding:1;g=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!y&&g[0]!==1/0){if(this.getBounds)for(const e of c){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>g[1]&&(g[1]=t+n),g[0]>t-n&&(g[0]=t-n))}const e=g[1]-g[0],t=e>0?e*s.extentPadding:1,n=null===(i=s.yExtent)||void 0===i?void 0:i[0],o=null===(a=s.yExtent)||void 0===a?void 0:a[1];g=[null!=n?g[0]:g[0]-t,null!=o?g[1]:g[1]+t],"log"===s.yScaleType&&0>=g[0]&&d[0]>0&&(g[0]=null!=n?g[0]:d[0]/(1+s.extentPadding))}if(h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),g[0]!==1/0&&g[1]!==-1/0||(g=[0,1]),"streaming"===s.runtimeMode)if("x"==("up"===(p=s.arrowOfTime)||"down"===p?"y":"x")){const t="right"===s.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:m().domain(h).range(t),y:m().domain(g).range([e.height,0])}}else{const t="down"===s.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:m().domain(g).range([0,e.width]),y:m().domain(h).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 b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:t(s.xScaleType,h,[0,e.width]),y:t(s.yScaleType,g,[e.height,0])}}var p;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,c),this.config.decay&&this.applyDecay(this.scene,c),this.config.pulse&&this.applyPulse(this.scene,c),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>Re.QUADTREE_THRESHOLD?C().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 b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:s(this.config.xScaleType,o,[i[0]*t,i[1]*t]),y:s(this.config.yScaleType,r,[a[0]*n,a[1]*n])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o||0===t.length)return[];switch(n.chartType){case"line":return this.buildLineScene(t);case"area":return this.buildAreaScene(t);case"stackedarea":return this.buildStackedAreaScene(t);case"scatter":case"bubble":return this.buildPointScene(t);case"heatmap":return this.buildHeatmapScene(t,e);case"bar":return this.buildBarScene(t);case"swarm":return this.buildSwarmScene(t);case"waterfall":return this.buildWaterfallScene(t,e);case"candlestick":return this.buildCandlestickScene(t,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=we(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),this.config.curve&&"linear"!==this.config.curve&&(n.curve=this.config.curve),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]),r=Ae(e.data,this.scales,this.getX,this.getY,o,t,e.key,this.getY0);this.config.gradientFill&&(r.fillGradient=this.config.gradientFill),this.config.curve&&"linear"!==this.config.curve&&(r.curve=this.config.curve),n.push(r)}return n}buildStackedAreaScene(e){const t=this.groupData(e);return t.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0),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;for(const e of c)g.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[];for(const n of c){let r=e.get(n)||0;const a=g.get(n);i&&(r/=d.get(n));const l=t.x(n);s.push([l,t.y(a)]),o.push([l,t.y(a+r)]),g.set(n,a+r)}const l={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(l.curve=a),h.push(l)}return h}(t,this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize,this.config.curve&&"linear"!==this.config.curve?this.config.curve:void 0)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){let e=1/0,n=-1/0;for(const o of t)e>o&&(e=o),o>n&&(n=o);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}const i=this.getColor?this.resolveColorMap(e):null;for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},a=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(a=r(e))}if(i&&this.getColor&&!e.fill){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const s=this.getPointId?this.getPointId(o)+"":void 0,l=Se(o,this.scales,this.getX,this.getY,a,e,s);l&&t.push(l)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=Pe(this.config.valueAccessor,"value"),r=Le(this.config.xAccessor,"x"),i=Le(this.config.yAccessor,"y"),a=new Set,s=new Set;for(const t of e)a.add(r(t)),s.add(i(t));const l=Array.from(a),c=Array.from(s),u=l.every(e=>"number"==typeof e&&!isNaN(e)),d=c.every(e=>"number"==typeof e&&!isNaN(e)),h=u?l.sort((e,t)=>e-t):l,g=d?c.sort((e,t)=>e-t):c;if(0===h.length||0===g.length)return n;const y=t.width/h.length,p=t.height/g.length,f=new Map;for(const t of e){const e=`${r(t)}\0${i(t)}`;f.set(e,{val:o(t),datum:t})}let m=1/0,b=-1/0;for(const{val:e}of f.values())m>e&&(m=e),e>b&&(b=e);const x=v({blues:P,reds:O,greens:E,viridis:w}["string"==typeof this.config.colorScheme?this.config.colorScheme:"blues"]||P).domain([m,b]);for(let e=0;h.length>e;e++)for(let t=0;g.length>t;t++){const o=f.get(`${h[e]}\0${g[t]}`);if(!o)continue;const r=x(o.val);n.push(Oe(e*y,(g.length-1-t)*p,y,p,r,o.datum,this.config.showValues?{value:o.val,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],a=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,s=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=Pe(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,g]=this.scales.y.domain(),y=(d-u||1)/a,p=(g-h||1)/s,f=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/y),a-1),r=Math.min(Math.floor((n-h)/p),s-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=f.get(i);l||(l={sum:0,count:0,data:[]},f.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of f){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,k=t.width/a,w=t.height/s;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,a=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=f.get(e);i.push(Oe(r*k,(s-1-a)*w,k,w,c,{xi:r,yi:a,value:t,count:u.count,sum:u.sum,data:u.data},this.config.showValues?{value:t,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ke(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort(),a=t.filter(t=>e.has(t)),s=a.join("\0")+""+i.join("\0");this._barCategoryCache&&this._barCategoryCache.key===s?o=this._barCategoryCache.order:(o=[...a,...i],this._barCategoryCache={key:s,order:o})}const r=[],i=this.scales,[a,s]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,a),l=Math.min(e.end,s);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.abs(u-c),h=d>2?1:0,g=Math.min(c,u)+h/2,y=Math.max(d-h,1);if(y>0)if(o&&e.categories.size>0){let n=0;for(const a of o){const o=e.categories.get(a)||0;if(0===o)continue;const s=i.y(n),l=i.y(n+o);r.push(Ee(g,Math.min(s,l),y,Math.abs(s-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[a])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:o},a)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(Ee(g,Math.min(t,n),y,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],a=this.config.swarmStyle||{},s=null!==(t=a.radius)&&void 0!==t?t:3,l=null!==(n=a.fill)&&void 0!==n?n:"#007bff",c=null!==(o=a.opacity)&&void 0!==o?o:.7,u=a.stroke,d=a.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),a=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}const g={type:"point",x:o,y:a,r:s,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t};this.getPointId&&(g.pointId=this.getPointId(t)+""),i.push(g)}return i}buildWaterfallScene(e,t){var n,o,r;const i=[],a=this.scales,s=this.config.waterfallStyle,l=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===l.length)return i;const c=null!==(n=null==s?void 0:s.positiveColor)&&void 0!==n?n:"#28a745",u=null!==(o=null==s?void 0:s.negativeColor)&&void 0!==o?o:"#dc3545",d=null!==(r=null==s?void 0:s.gap)&&void 0!==r?r:1,h=null==s?void 0:s.stroke,g=null==s?void 0:s.strokeWidth;let y=0;for(let e=0;l.length>e;e++){const n=l[e],o=this.getX(n),r=this.getY(n),p=y+r;let f;f=l.length-1>e?this.getX(l[e+1])-o:e>0?o-this.getX(l[e-1]):0;const m=a.x(o),v=0!==f?a.x(o+f):m+t.width/10,b=Math.min(m,v)+d/2,x=Math.max(m,v)-d/2-b;if(0>=x){y=p;continue}const k=a.y(y),w=a.y(p);i.push(Ee(b,Math.min(k,w),x,Math.abs(k-w),{fill:0>r?u:c,stroke:h,strokeWidth:g},Object.assign(Object.assign({},n),{baseline:y,cumEnd:p,delta:r,_connectorStroke:null==s?void 0:s.connectorStroke,_connectorWidth:null==s?void 0:s.connectorWidth}))),y=p}return i}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",a=o.wickColor||"#333",s=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:a,wickWidth:s,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),a=this.scales.x(e);if(i&&0!==i)n.push([a,this.scales.y(r+i)]),o.push([a,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([a,e]),o.push([a,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}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){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("line"===t.type){const e=Array.isArray(t.datum)?t.datum:[];if(2>e.length)continue;const n=Array(e.length);let o=!1;for(let t=0;e.length>t;t++){const a=i.get(e[t]);null!=a?(n[t]=this.computeDecayOpacity(a,r),1>n[t]&&(o=!0)):n[t]=1}o&&(t._decayOpacities=n);continue}if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[],n=t.topPath?t.topPath.length:e.length;if(2>n)continue;if(e.length===n){const o=Array(n);let a=!1;for(let t=0;e.length>t;t++){const n=i.get(e[t]);null!=n?(o[t]=this.computeDecayOpacity(n,r),1>o[t]&&(a=!0)):o[t]=1}a&&(t._decayOpacities=o)}else{let o=1;for(const t of e){const e=i.get(t);if(null!=e){const t=this.computeDecayOpacity(e,r);o>t&&(o=t)}}if(1>o){const e=Array(n);e.fill(o),t._decayOpacities=e}}continue}const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:a};else if("candlestick"===t.type)t._decayOpacity=a;else{const e=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:e*a})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",a=null!==(o=this.config.pulse.glowRadius)&&void 0!==o?o:4,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type)continue;if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[t.datum];let n=0;for(const t of e){const e=s.get(t);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=this.computePulseIntensity(o,r);i>n&&(n=i)}n>0&&(t._pulseIntensity=n,t._pulseColor=i);continue}const e=s.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=this.computePulseIntensity(n,r);o>0&&(t._pulseIntensity=o,t._pulseColor=i,t._pulseGlowRadius=a)}}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}snapshotPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();for(let o=0;this.scene.length>o;o++){const r=this.scene[o],i=this.getNodeIdentity(r,o);i&&("point"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,r:r.r,opacity:r.style.opacity}):"rect"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:r.style.opacity}):"heatcell"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:null===(e=r.style)||void 0===e?void 0:e.opacity}):"candlestick"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.openY}):"line"===r.type?this.prevPathMap.set(i,{path:r.path.map(e=>[e[0],e[1]]),opacity:null===(t=r.style)||void 0===t?void 0:t.opacity}):"area"===r.type&&this.prevPathMap.set(i,{topPath:r.topPath.map(e=>[e[0],e[1]]),bottomPath:r.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(n=r.style)||void 0===n?void 0:n.opacity}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===this.config.runtimeMode&&e.datum){if(this.getCategory)return`p:${this.getCategory(e.datum)}:${this.getY(e.datum)}`;const t=this.getX(e.datum),n=this.getY(e.datum);if(null!=t&&null!=n)return`p:${t}:${n}`}return"p:"+t;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+t:"c:"+this.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d,h,g,y,p,f,m,v,b,x,k,w,A,S,E;if(!this.config.transition||0===this.prevPositionMap.size&&0===this.prevPathMap.size)return;const O=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 P=!1;const L=new Set,M=new Set;for(let e=0;this.scene.length>e;e++){const f=this.scene[e],m=this.getNodeIdentity(f,e);if(!m)continue;if(f._transitionKey=m,"line"===f.type||"area"===f.type){const e=this.prevPathMap.get(m);if(e){if(M.add(m),"line"===f.type&&e.path&&e.path.length===f.path.length){f._targetPath=f.path.map(e=>[e[0],e[1]]),f._prevPath=e.path;for(let t=0;f.path.length>t;t++)f.path[t]=[e.path[t][0],e.path[t][1]];P=!0}else if("area"===f.type&&e.topPath&&e.bottomPath&&e.topPath.length===f.topPath.length&&e.bottomPath.length===f.bottomPath.length){f._targetTopPath=f.topPath.map(e=>[e[0],e[1]]),f._targetBottomPath=f.bottomPath.map(e=>[e[0],e[1]]),f._prevTopPath=e.topPath,f._prevBottomPath=e.bottomPath;for(let t=0;f.topPath.length>t;t++)f.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;f.bottomPath.length>t;t++)f.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];P=!0}f._targetOpacity=null!==(t=f.style.opacity)&&void 0!==t?t:1}else f._targetOpacity=null!==(n=f.style.opacity)&&void 0!==n?n:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;continue}const v=this.prevPositionMap.get(m);if("point"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,r:f.r};f._targetOpacity=null!==(o=f.style.opacity)&&void 0!==o?o:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetR=e.r,f.x=v.x,f.y=v.y,f.r=null!==(r=v.r)&&void 0!==r?r:f.r,P=!0)}else f._targetOpacity=null!==(i=f.style.opacity)&&void 0!==i?i:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;else if("rect"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(a=f.style.opacity)&&void 0!==a?a:1,v.x===e.x&&v.y===e.y&&v.w===e.w&&v.h===e.h||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(s=v.w)&&void 0!==s?s:f.w,f.h=null!==(l=v.h)&&void 0!==l?l:f.h,P=!0)}else f._targetOpacity=null!==(c=f.style.opacity)&&void 0!==c?c:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),P=!0;else if("heatcell"===f.type)if(v){L.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(d=null===(u=f.style)||void 0===u?void 0:u.opacity)&&void 0!==d?d:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(h=v.w)&&void 0!==h?h:f.w,f.h=null!==(g=v.h)&&void 0!==g?g:f.h,P=!0)}else f._targetOpacity=null!==(p=null===(y=f.style)||void 0===y?void 0:y.opacity)&&void 0!==p?p:1,f.style=Object.assign(Object.assign({},f.style||{}),{opacity:0}),P=!0}for(const[e,t]of this.prevPathMap)if(!M.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(f=t.opacity)&&void 0!==f?f:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),P=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(m=t.opacity)&&void 0!==m?m:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),P=!0}for(const[e,t]of this.prevPositionMap)if(!L.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(v=t.r)&&void 0!==v?v:3,style:{opacity:null!==(b=t.opacity)&&void 0!==b?b:1},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(x=t.w)&&void 0!==x?x:0,h:null!==(k=t.h)&&void 0!==k?k:0,style:{opacity:null!==(w=t.opacity)&&void 0!==w?w:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(A=t.w)&&void 0!==A?A:0,h:null!==(S=t.h)&&void 0!==S?S:0,fill:"#999",datum:null,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1},_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}P=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),P&&(this.activeTransition={startTime:ze(),duration:O})}advanceTransition(e){var t,n,o,r,i,a;if(!this.activeTransition)return!1;const s=Ie(e,this.activeTransition),l=Te(s,"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("point"===e.type){if(void 0!==e._targetOpacity){const o=t?this.prevPositionMap.get(t):void 0,r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=$e(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=$e(o.x,e._targetX,l),e.y=$e(o.y,e._targetY,l),void 0!==e._targetR&&void 0!==o.r&&(e.r=$e(o.r,e._targetR,l))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=$e(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,l),e.y=$e(n.y,e._targetY,l),void 0!==n.w&&(e.w=$e(n.w,e._targetW,l)),void 0!==n.h&&(e.h=$e(n.h,e._targetH,l))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:$e(o,e._targetOpacity,l)})}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,l),e.y=$e(n.y,e._targetY,l),void 0!==n.w&&(e.w=$e(n.w,e._targetW,l)),void 0!==n.h&&(e.h=$e(n.h,e._targetH,l))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevPath&&e._targetOpacity>0?0:null!==(i=e.style.opacity)&&void 0!==i?i:1;e.style=Object.assign(Object.assign({},e.style),{opacity:$e(t,e._targetOpacity,l)})}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]=$e(t[o][0],n[o][0],l),e.path[o][1]=$e(t[o][1],n[o][1],l)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevTopPath&&e._targetOpacity>0?0:null!==(a=e.style.opacity)&&void 0!==a?a:1;e.style=Object.assign(Object.assign({},e.style),{opacity:$e(t,e._targetOpacity,l)})}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]=$e(t[n][0],o[n][0],l),e.topPath[n][1]=$e(t[n][1],o[n][1],l);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=$e(n[t][0],r[t][0],l),e.bottomPath[t][1]=$e(n[t][1],r[t][1],l)}}if(s>=1){for(const e of this.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(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}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:Ne,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:Ne,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()}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._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){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),Object.assign(this.config,e),(void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Pe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Pe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Pe(this.config.xAccessor,"x"),this.getY=Pe(this.config.yAccessor,"y"))),void 0!==e.groupAccessor&&(this.getGroup=Me(this.config.groupAccessor)),void 0!==e.categoryAccessor&&(this.getCategory=Me(this.config.categoryAccessor)),void 0!==e.sizeAccessor&&(this.getSize=this.config.sizeAccessor?Pe(this.config.sizeAccessor,"size"):void 0),void 0!==e.colorAccessor&&(this.getColor=Me(this.config.colorAccessor)),void 0!==e.y0Accessor&&(this.getY0=this.config.y0Accessor?Pe(this.config.y0Accessor,"y0"):void 0),void 0!==e.pointIdAccessor&&(this.getPointId=Me(this.config.pointIdAccessor)),this.needsFullRebuild=!0}}function Fe(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 Ge(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Ye(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function qe(e,t,n){var o,r,i,a;if(0===e.path.length)return null;const s=Ze(e.path,t);if(0>s)return null;const[l,c]=e.path[s];let u;if(e.path.length>1){let o=1/0;const r=Math.max(0,s-1),i=Math.min(e.path.length-2,s);for(let a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=Xe(t,n,r,i,s,l);o>c&&(o=c)}u=o}else{const e=t-l,o=n-c;u=Math.sqrt(e*e+o*o)}const d=null!==(a=null!==(r=null===(o=e.style)||void 0===o?void 0:o.strokeWidth)&&void 0!==r?r:null===(i=e.style)||void 0===i?void 0:i.lineWidth)&&void 0!==a?a:1;return u>Math.max(5,d/2+2)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:l,y:c,distance:u}}function Xe(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 Ve(e,t,n){const o=Fe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ue(e,t,n){const o=Fe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ke(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 Qe(e,t,n){if(0===e.topPath.length)return null;const o=Ze(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 Ze(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 Je(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function et(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 tt(e,r,i){const a=t(null),[s,l]=n(null);return o(()=>{if(!r&&!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()},[r,i]),[a,[r&&s?s.w:e[0],i&&s?s.h:e[1]]]}function nt(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])}Re.QUADTREE_THRESHOLD=500;const ot={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 rt(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,ot[n])(o(e,t)),r}function it(){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 at(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function st({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 lt(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),[y,p]=e.useState(0),f=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,y=[];let p=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=rt(t,u,d,h),b=at(t,r,i),x=i&&i.size>0&&i.has(t.label);y.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:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?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:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&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(it,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),y})(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:y,onFocusedIndexChange:f,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 o=0;t.label&&(o+=16);const y=((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,y=[];let p=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=rt(t,u,d,h),b=at(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(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:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&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(it,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=26+7*t.label.length}),{items:y,offset:p}})(t,r,i,a,s,l,c,n,u,d);o+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:o})),h+=o+12});let y=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(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),y+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${y},0)`},o.items)),y+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:y,y1:-8,x2:y,y2:n+0+8})),y+=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:y,onFocusedIndexChange:f,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"},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 ct(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 y,p;return"left"===a?(y=4,p=i.top):"top"===a?(y=0,p=s?32:8):"bottom"===a?(y=0,p=r-i.bottom+50):(y=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${y}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(st,{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(lt,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function ut(e){return"string"==typeof e?{type:e}:e}function dt({orient:t,config:n,values:o,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}}(n),c="top"===t||"bottom"===t,u=r(()=>{if(0===o.length)return null;const n=i.domain(),r=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)}}(o);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*r,20),y=(r-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(y+g/2),x2:p,y2:m+f*(y+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*y,x2:c,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+f*y,x2:p,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-y-g:m+y,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-y-g:m+y,x2:r,y2:"top"===t?m-y:m+y+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(y+g/2),y1:c,x2:m+f*(y+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:c,x2:m+f*(y+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:p,x2:m+f*(y+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-y-g:m+y,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-y-g:m+y,y1:r,x2:"left"===t?m-y:m+y+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=N().domain(n).thresholds(l.bins)(o);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,o)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*r;if(c){const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:r,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 r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:"left"===t?-4-a:4,y:Math.min(r,r+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=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(r/2),s=i((e.x0+e.x1)/2);o.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*(r/2),l=i((a.x0+a.x1)/2);o.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:o.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,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-o-4:o+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,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-o-4:o+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},[o,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function ht(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 gt(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 yt(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:y,events:p={},"data-testid":f}=t,m=new Set(Array.isArray(y)?y:[]);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":f},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||"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||"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||"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||"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||"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||"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||"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||"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:gt((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||"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 y=16,p=a?u?[a]:ht(a,c):[],f=i?u?[i]:ht(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),v=p.length*y),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let x=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),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(p.length+f.length)*y+(f.length>0?y:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,p.length+f.length-1)*y;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+y+(f.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},b),x)}(l,v,b,h))}function pt(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(yt,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(yt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}const ft={linear:oe,monotoneX:ne,monotoneY:te,step:ee,stepAfter:J,stepBefore:Z,basis:Q,cardinal:K,catmullRom:U};function mt(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 vt(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 bt(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=mt(e,n),c=vt(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 xt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function kt(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,y,p,f,m,v,b,x,k,w,A,S,E,O,P,L,M,j,C,N,D,_,B,H,W,T,I,z,R,F,G,Y,q,X,U;switch(t.type){case"label":{const r=bt(t,n,o);if(!r)return null;const{x:i,y:a}=r;return xt(i,a,o)?e.createElement(pt,{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=bt(t,n,o);if(!r)return null;const{x:i,y:a}=r;return xt(i,a,o)?e.createElement(pt,{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=mt(t,o);if(null==r)return null;const i=t.color||"#f97316";return 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:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=vt(t,o);if(null==r)return null;const i=t.color||"#f97316";return 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:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=$(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||"#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||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>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||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#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=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=mt(n,o),s=vt(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=mt(t,o),i=vt(t,o);return e.createElement(pt,{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",y=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.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,f=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||!f)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,y=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],y+=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*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?le.polynomial(y,{order:t.order||2}):le.linear(y)).points;const b=v.map(([e,t])=>`${p(e)},${f(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:f(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!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y: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||"#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||"#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===(f=o.scales)||void 0===f?void 0:f.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"]||oe,g=V().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const y=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:y,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:y,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===(E=o.scales)||void 0===E?void 0:E.time,s=null!==(P=null===(O=o.scales)||void 0===O?void 0:O.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.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,y=!1!==t.showBand,p=t.fill||"#6366f1",f=null!==(j=t.fillOpacity)&&void 0!==j?j:.1,m=t.anomalyColor||"#ef4444",v=null!==(C=t.anomalyRadius)&&void 0!==C?C: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},y&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:f}),k.map((t,n)=>{const r=mt(t,o),i=vt(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!==(D=null===(N=o.scales)||void 0===N?void 0:N.x)&&void 0!==D?D:null===(_=o.scales)||void 0===_?void 0:_.time,l=null!==(H=null===(B=o.scales)||void 0===B?void 0:B.y)&&void 0!==H?H:null===(W=o.scales)||void 0===W?void 0:W.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=le.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)),y=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),f=null!==(T=t.confidence)&&void 0!==T?T:.95,m=.99>f?.95>f?.9>f?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-y,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(" "),E=`${s(b)},${l(u(b))}`,O=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.createElement("polyline",{points:`${E} ${S}`,fill:"none",stroke:O,strokeWidth:null!==(R=t.strokeWidth)&&void 0!==R?R:2,strokeDasharray:null!==(F=t.strokeDasharray)&&void 0!==F?F:"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:O,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=bt(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!xt(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!==(U=t.content)&&void 0!==U?U: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=bt(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)}default:return null}}}function wt(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 At(t){const{width:n,height:o,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,y=r(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||h||St,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return l.x.ticks(Math.min(r,Math.max(2,Math.floor(n/70)))).map(e=>({value:e,pixel:l.x(e),label:o(e)}))},[l,u,h,n]),p=r(()=>{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||St,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return l.y.ticks(Math.min(r,Math.max(2,Math.floor(o/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)}))},[l,u,g,o]),f=d&&l,m=c&&l;if(!f&&!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})`},f&&e.createElement("g",{className:"stream-grid"},y.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),p.map((t,o)=>e.createElement("line",{key:"ygrid-"+o,x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),x&&!w&&e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:wt("bottom",n,o),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:wt("left",n,o),fill:"none",stroke:S,strokeWidth:1})))}function St(e){return Math.round(100*e)/100+""}function Et(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function Ot(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,axes:g,xLabel:y,yLabel:p,xFormat:f,yFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:E="right",foregroundGraphics:O,marginalGraphics:P,xValues:L,yValues:M,annotations:j,svgAnnotationRules:C,xAccessor:N,yAccessor:D,annotationData:_,pointNodes:B,curve:H,underlayRendered:W,children:T}=n,I=r(()=>{var e;if(!h||!d)return[];const t=null==g?void 0:g.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||f||St,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))).map(e=>({value:e,pixel:d.x(e),label:n(e)}))},[h,d,g,f,a]),$=r(()=>{var e;if(!h||!d)return[];const t=null==g?void 0:g.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||m||St,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)}))},[h,d,g,m,s]),z=t(new Map),R=t(null!==(o=null==j?void 0:j.length)&&void 0!==o?o:0),F=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;R.current!==F&&(R.current=F,z.current=new Map);const G=r(()=>{if(!j||0===j.length)return null;const e=kt(),t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:a,height:s,data:_,frameType:"xy",pointNodes:B,curve:H,stickyPositionCache:z.current};return j.map((n,o)=>{if(C){const r=C(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[j,C,a,s,N,D,_,d,B,H]);return h||b||x||O||P||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof b?b:"XY Chart"),e.createElement("desc",null,"string"==typeof b?b+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!W&&e.createElement("g",{className:"stream-grid"},I.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),$.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:a,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&(()=>{const t=null==g?void 0:g.find(e=>"left"===e.orient),n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, #666)",f="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes"},!W&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!W&&i&&e.createElement("path",{d:wt("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),I.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):Et(t.value,n>0?I[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},y),!W&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!W&&r&&e.createElement("path",{d:wt("left",a,s),fill:"none",stroke:d,strokeWidth:1}),$.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Et(t.value,n>0?$[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}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))})(),G,P&&d&&L&&M&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(dt,{orient:"top",config:ut(P.top),values:L,scale:d.x,size:u.top,length:a})),P.bottom&&e.createElement("g",{transform:`translate(0, ${s})`},e.createElement(dt,{orient:"bottom",config:ut(P.bottom),values:L,scale:d.x,size:u.bottom,length:a})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(dt,{orient:"left",config:ut(P.left),values:M,scale:d.y,size:u.left,length:s})),P.right&&e.createElement("g",{transform:`translate(${a}, 0)`},e.createElement(dt,{orient:"right",config:ut(P.right),values:M,scale:d.y,size:u.right,length:s}))),O,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),ct({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:E,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}const Pt="undefined"==typeof window||"undefined"==typeof document,Lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Mt(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"},i=["point","line","area","rect","heatcell","circle","candlestick"],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 jt(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(", ")}`}function Ct({scene:t,chartType:n}){var o,r,i,a;const s=[];for(const e of t){if(s.length>=50)break;"point"===e.type?s.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?s.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&s.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(a=e.value)&&void 0!==a?a:0))/100+""}})}if(0===s.length)return null;const l=new Set;for(const e of s)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:Lt,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,s.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function Nt({nodes:t,chartType:n}){var o,r,i,a,s;const l=[];for(const e of t){if(l.length>=50)break;l.push({values:{id:(null===(o=e.datum)||void 0===o?void 0:o.id)||e.id||"",x:Math.round(100*(null!==(i=null!==(r=e.cx)&&void 0!==r?r:e.x)&&void 0!==i?i:0))/100+"",y:Math.round(100*(null!==(s=null!==(a=e.cy)&&void 0!==a?a:e.y)&&void 0!==s?s:0))/100+""}})}if(0===l.length)return null;const c=new Set;for(const e of l)for(const t of Object.keys(e.values))c.add(t);const u=Array.from(c);return e.createElement("table",{style:Lt,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,u.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,l.map((t,n)=>e.createElement("tr",{key:n},u.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:u.length},"...and ",t.length-50," more items"))))}function Dt({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:Lt},n)}function _t(n){const o=i(null),c=Bt(n);return[function({children:t}){const i=r(()=>Bt(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=a(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(r.getState()),[r]),d=s(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function Bt(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 Ht={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}},Wt={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}},[Tt,It]=_t(e=>({theme:Ht,setTheme(t){e(e=>"light"===t?{theme:Ht}:"dark"===t?{theme:Wt}:{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 $t(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 zt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Rt(e){switch(e){case"monotoneX":return ne;case"monotoneY":return te;case"cardinal":return K;case"catmullRom":return U;case"step":return ee;case"stepBefore":return Z;case"stepAfter":return J;case"basis":return Q;case"natural":return ae;default:return null}}function Ft(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 Gt(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()}}function Yt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function qt(e,t,n=.3){Yt(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 Xt(e,t,n=.6){var o,r,i,a,s;if(!Yt(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 Vt(e,t,n,o=.35){Yt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ut(e){switch(e){case"monotoneX":return ne;case"monotoneY":return te;case"cardinal":return K;case"catmullRom":return U;case"step":return ee;case"stepBefore":return Z;case"stepAfter":return J;case"basis":return Q;case"natural":return ae;default:return null}}function Kt(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 Qt(e,t){const n=Ut(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=V().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 Zt=(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(Qt(e,t),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=Kt(n),a=t.fillGradient.topOpacity,l=t.fillGradient.bottomOpacity,c=e.createLinearGradient(0,o,0,r);c.addColorStop(0,`rgba(${i[0]},${i[1]},${i[2]},${a})`),c.addColorStop(1,`rgba(${i[0]},${i[1]},${i[2]},${l})`),e.fillStyle=c,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&&(Qt(e,t),Vt(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=s,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Ut(t.curve);if(e.beginPath(),n)ie().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}},Jt=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);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()),Xt(e,t),e.globalAlpha=1}}finally{e.restore()}},en=(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?tn(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))),qt(e,t),e.globalAlpha=1};function tn(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 nn(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 on(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const rn={line:[Zt,(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;Gt(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Rt(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!g){e.strokeStyle=l;const f=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(y[m]+y[m+1])*f,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 E=0;s.path.length>E;E++){const[O,P]=s.path[E],L=d[E],M=Ft(L,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(O,P);else{const j=[];for(const C of u){const N=C.value;(x>N||N>L)&&(N>x||L>N)||x===N||L===N||j.push({t:(N-x)/(L-x)})}j.sort((e,t)=>e.t-t.t);for(const D of j){const _=v+(O-v)*D.t,B=b+(P-b)*D.t,H=Ft(x+(L-x)*Math.min(D.t+1e-4,1),u,l);e.lineTo(_,B),S(),A(H,_,B)}e.lineTo(O,P)}v=O,b=P,x=L,k=M}else A(M,O,P),v=O,b=P,x=L,k=M}S()}else{if(e.beginPath(),e.strokeStyle=l,h)ie().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[W,T]=s.path[0];e.moveTo(W,T);for(let I=1;s.path.length>I;I++)e.lineTo(s.path[I][0],s.path[I][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)ie().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[z,R]=s.path[0];e.moveTo(z,R);for(let F=1;s.path.length>F;F++)e.lineTo(s.path[F][0],s.path[F][1])}const $=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo($,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}}],area:[Zt],stackedarea:[Zt],scatter:[Jt],bubble:[Jt],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),qt(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):on(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=nn(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[en],swarm:[Jt],waterfall:[(e,t,n,o)=>{var r,i,a;en(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;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();const r=Math.min(t.openY,t.closeY),i=Math.abs(t.openY-t.closeY),a=t.isUp?t.upColor:t.downColor;e.fillStyle=a,e.fillRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.strokeStyle=a,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.restore()}}]},an={top:20,right:20,bottom:30,left:40},sn={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"},ln={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 cn({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:ln},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function un({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,dimension:l,scales:c,onBrush:u}){const d=t(null),f=t(null),m=t(u);m.current=u;const v=t(c);return v.current=c,o(()=>{if(!d.current)return;const e=p(d.current).select(".brush-g"),t="x"===l?h():"y"===l?g():y();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{const t=v.current;if(!t)return;if(!e.selection)return void m.current(null);let o,i;if("x"===l){const[n,a]=e.selection;o=[t.x.invert(n),t.x.invert(a)],i=[t.y.invert(r),t.y.invert(0)]}else if("y"===l){const[r,a]=e.selection;o=[t.x.invert(0),t.x.invert(n)],i=[t.y.invert(a),t.y.invert(r)]}else{const[[n,r],[a,s]]=e.selection;o=[t.x.invert(n),t.x.invert(a)],i=[t.y.invert(s),t.y.invert(r)]}m.current({x:o,y:i})}),e.call(t),f.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),f.current=null}},[n,r,l]),e.createElement("svg",{ref:d,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`}))}const dn=c(function(i,a){var l,c,d,h,g,y,p,f,m;const{chartType:v,runtimeMode:b,data:x,chunkThreshold:k,chunkSize:w,xAccessor:A,yAccessor:S,colorAccessor:E,sizeAccessor:O,groupAccessor:P,lineDataAccessor:L,curve:M,normalize:j,binSize:C,valueAccessor:N,arrowOfTime:D="right",windowMode:_="sliding",windowSize:B=200,timeAccessor:H,xExtent:W,yExtent:T,extentPadding:I=.1,sizeRange:$,size:z=[500,300],responsiveWidth:R,responsiveHeight:F,margin:G,className:Y,background:q,lineStyle:X,pointStyle:V,areaStyle:U,waterfallStyle:K,swarmStyle:Q,barColors:Z,colorScheme:J,boundsAccessor:ee,boundsStyle:te,y0Accessor:ne,gradientFill:oe,openAccessor:re,highAccessor:ie,lowAccessor:ae,closeAccessor:se,candlestickStyle:le,showAxes:ce=!0,axes:ue,xLabel:de,yLabel:he,xFormat:ge,yFormat:ye,tickFormatTime:pe,tickFormatValue:fe,hoverAnnotation:me,tooltipContent:be,customHoverBehavior:xe,enableHover:ke,annotations:we,svgAnnotationRules:Ae,showGrid:Se,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,backgroundGraphics:Ce,foregroundGraphics:Ne,canvasPreRenderers:De,title:_e,categoryAccessor:Be,brush:He,onBrush:We,decay:Te,pulse:Ie,transition:$e,staleness:ze,heatmapAggregation:Fe,heatmapXBins:Ge,heatmapYBins:Xe,showValues:Ze,heatmapValueFormat:ot,marginalGraphics:rt,pointIdAccessor:it,xScaleType:at,yScaleType:st,accessibleTable:lt}=i,[ct,ut]=tt(z,R,F),dt=Object.assign(Object.assign({},an),G);if(rt){const e=60;rt.top&&e>dt.top&&(dt.top=e),rt.bottom&&e>dt.bottom&&(dt.bottom=e),rt.left&&e>dt.left&&(dt.left=e),rt.right&&e>dt.right&&(dt.right=e)}const ht=ut[0]-dt.left-dt.right,gt=ut[1]-dt.top-dt.bottom,yt="function"==typeof Ne?Ne({size:ut,margin:dt}):Ne,pt="function"==typeof Ce?Ce({size:ut,margin:dt}):Ce,ft=null!=me?me:ke,mt=t(null),vt=t(null),bt=t(0),xt=t(!1),kt=It(e=>e.theme),[wt,St]=n(0),[Et,Lt]=n(null),jt=t(null),Nt=t(null),[_t,Bt]=n(null),[Ht,Wt]=n(!1),[Tt,Rt]=n([]),[Ft,Gt]=n([]),Yt=t(()=>{}),qt="streaming"===b||["bar","swarm","waterfall"].includes(v),Xt=r(()=>({chartType:v,runtimeMode:qt?"streaming":"bounded",windowSize:B,windowMode:_,arrowOfTime:qt?D:"right",extentPadding:I,xAccessor:qt?void 0:A,yAccessor:qt?void 0:S,timeAccessor:qt?H:void 0,valueAccessor:N,colorAccessor:E,sizeAccessor:O,groupAccessor:P,categoryAccessor:Be,lineDataAccessor:L,xScaleType:at,yScaleType:st,xExtent:W,yExtent:T,sizeRange:$,binSize:C,normalize:j,boundsAccessor:ee,boundsStyle:te,y0Accessor:ne,gradientFill:"boolean"==typeof oe?oe?{topOpacity:.8,bottomOpacity:.05}:void 0:oe,openAccessor:re,highAccessor:ie,lowAccessor:ae,closeAccessor:se,candlestickStyle:le,lineStyle:X,pointStyle:V,areaStyle:U,swarmStyle:Q,waterfallStyle:K,colorScheme:J,barColors:Z,annotations:we,decay:Te,pulse:Ie,transition:$e,staleness:ze,heatmapAggregation:Fe,heatmapXBins:Ge,heatmapYBins:Xe,showValues:Ze,heatmapValueFormat:ot,pointIdAccessor:it,curve:M}),[v,B,_,D,I,A,S,H,N,at,st,E,O,P,Be,L,W,T,$,C,j,ee,te,ne,oe,re,ie,ae,se,le,X,V,U,Q,K,J,Z,we,Te,Ie,$e,ze,Fe,Ge,Xe,Ze,ot,qt,it,M]),Vt=t(null);Vt.current||(Vt.current=new Re(Xt));const Ut=s(()=>{bt.current||(bt.current=requestAnimationFrame(()=>Yt.current()))},[]);o(()=>{var e;null===(e=Vt.current)||void 0===e||e.updateConfig(Xt),xt.current=!0,Ut()},[Xt,Ut]),o(()=>{xt.current=!0,Ut()},[kt,Ut]);const Kt=t(null);Kt.current||(Kt.current=new ve(e=>{const t=Vt.current;t&&t.ingest(e)&&(xt.current=!0,Ut())},{chunkThreshold:k,chunkSize:w})),o(()=>{var e;null===(e=Kt.current)||void 0===e||e.updateChunkOptions({chunkThreshold:k,chunkSize:w})},[k,w]);const Qt=s(e=>{var t;null===(t=Kt.current)||void 0===t||t.push(e)},[]),Zt=s(e=>{var t;null===(t=Kt.current)||void 0===t||t.pushMany(e)},[]),Jt=s(()=>{var e,t;null===(e=Kt.current)||void 0===e||e.clear(),null===(t=Vt.current)||void 0===t||t.clear(),xt.current=!0,Ut()},[Ut]);u(a,()=>({push:Qt,pushMany:Zt,clear:Jt,getData:()=>{var e,t,n;return null===(e=Kt.current)||void 0===e||e.flush(),null!==(n=null===(t=Vt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Vt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Vt.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Qt,Zt,Jt]),o(()=>{var e;x&&(null===(e=Kt.current)||void 0===e||e.setBoundedData(x))},[x]);const en=t(()=>{}),tn=t(()=>{});en.current=e=>{if(!ft)return;const t=mt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-dt.left,r=e.clientY-n.top-dt.top;if(0>o||o>ht||0>r||r>gt)return void(jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&(xe(null),xt.current=!0),Ut()));const i=Vt.current;if(!i||0===i.scene.length)return;const a=function(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=Ye(e,t,n);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=Ye(s,t,n);break;case"line":e=qe(s,t,n);break;case"rect":e=Ve(s,t,n);break;case"heatcell":e=Ue(s,t,n);break;case"area":if(!1===s.interactive)break;e=Qe(s,t,n);break;case"candlestick":e=Ke(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(i.scene,o,r,30,i.quadtree);if(!a)return void(jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&xe(null),Ut()));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});jt.current=l,Nt.current=a.node,Bt(l),xe&&(xe(l),xt.current=!0),Ut()},tn.current=()=>{jt.current&&(jt.current=null,Nt.current=null,Bt(null),xe&&(xe(null),xt.current=!0),Ut())},s(e=>en.current(e),[]);const nn=s(()=>tn.current(),[]),on=t(-1),ln=s(e=>{const t=Vt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum});break;case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n]});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n]});break}case"rect":case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=0>on.current?-1:on.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return on.current=-1,jt.current=null,Nt.current=null,Bt(null),xe&&xe(null),void Ut();const i=0>o?0:r;on.current=i;const a=et(n[i]);jt.current=a,Bt(a),xe&&xe(a),Ut()},[xe,Ut]),dn=s(e=>{on.current=-1,en.current(e)},[]);Yt.current=()=>{var e,t;bt.current=0;const n=mt.current,o=vt.current;if(!n||!o)return;const r=Vt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=xt.current||a;s&&!a&&r.computeScene({width:ht,height:gt});const l=zt(),c=function(e){if(!e)return sn;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||sn.axisStroke,tickText:i||sn.tickText,crosshair:i?i+"66":sn.crosshair,hoverFill:l?l+"4D":sn.hoverFill,hoverStroke:i?i+"99":sn.hoverStroke,pointRing:l||sn.pointRing}:sn}(n),u=null!==(e=null==ze?void 0:ze.threshold)&&void 0!==e?e:5e3,d=ze&&r.lastIngestTime>0&&i-r.lastIngestTime>u;if(s){const e=$t(n,ut,dt,l);if(e){e.clearRect(-dt.left,-dt.top,ut[0],ut[1]),d&&(e.globalAlpha=null!==(t=null==ze?void 0:ze.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=q||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-dt.left,-dt.top,ut[0],ut[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ht,gt),e.clip()),De&&r.scales)for(const t of De)e.save(),t(e,r.scene,r.scales,{width:ht,height:gt}),e.restore();const a=rn[v];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:ht,height:gt});e.restore(),d&&(e.globalAlpha=1)}}{const e=$t(o,ut,dt,l);if(e&&(e.clearRect(-dt.left,-dt.top,ut[0],ut[1]),ft&&jt.current&&r.scales&&function(e,t,n,o,r,i,a){if(!1===r.crosshair)return;e.save();const s="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=s.stroke||a.crosshair,e.lineWidth=s.strokeWidth||1,e.setLineDash(s.strokeDasharray?s.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}(e,jt.current,ht,gt,"object"==typeof ft?ft:{},0,c),Nt.current&&Array.isArray(me))){const t=me.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,Nt.current,t)}}s&&n&&n.setAttribute("aria-label",Mt(r.scene,v+" chart"));const h=xt.current;if(xt.current=!1,h&&r.scales&&((!Et||Et.x.domain()[0]!==r.scales.x.domain()[0]||Et.x.domain()[1]!==r.scales.x.domain()[1]||Et.y.domain()[0]!==r.scales.y.domain()[0]||Et.y.domain()[1]!==r.scales.y.domain()[1]||Et.x.range()[0]!==r.scales.x.range()[0]||Et.x.range()[1]!==r.scales.x.range()[1]||Et.y.range()[0]!==r.scales.y.range()[0]||Et.y.range()[1]!==r.scales.y.range()[1])&&Lt(r.scales),rt)){const e=r.getData(),t="function"==typeof A?A:e=>e[A||"x"],n="function"==typeof S?S:e=>e[S||"y"];Rt(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Gt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}h&&we&&we.length>0&&St(e=>e+1),(null==ze?void 0:ze.showBadge)&&Wt(!!d),(a||r.hasActivePulses)&&(bt.current=requestAnimationFrame(()=>Yt.current()))},o(()=>(Ut(),()=>{bt.current&&(cancelAnimationFrame(bt.current),bt.current=0)}),[Ut]),o(()=>{xt.current=!0,Ut()},[v,ht,gt,ce,q,X,De,Ut]),nt(ze,Vt,xt,Ut,Ht,Wt);const hn=ft&&_t?be?be(_t):e.createElement(cn,{hover:_t}):null,gn=hn?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:dt.left+_t.x,top:dt.top+_t.y,transform:`translate(${_t.x>.7*ht?"calc(-100% - 12px)":"12px"}, ${.3*gt>_t.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},hn):null,yn=on.current>=0&&_t?e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:ut[0],height:ut[1],pointerEvents:"none",zIndex:2}},e.createElement("circle",{cx:_t.x+dt.left,cy:_t.y+dt.top,r:8,fill:"none",stroke:"var(--accent, #6366f1)",strokeWidth:2,strokeDasharray:"4,2"})):null;if(Pt){const t=Vt.current;t&&x&&(t.ingest({inserts:x,bounded:!0}),t.computeScene({width:ht,height:gt}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null;return e.createElement("div",{className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof _e?_e:"XY chart",style:{position:"relative",width:ut[0],height:ut[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:ut[0],height:ut[1],style:{position:"absolute",left:0,top:0}},pt,e.createElement("g",{transform:`translate(${dt.left},${dt.top})`},q&&e.createElement("rect",{x:0,y:0,width:ht,height:gt,fill:q}),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:i.style.fill||"#4e79a7",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":return e.createElement("circle",{key:"point-"+n,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",opacity:null!==(i=t.style.opacity)&&void 0!==i?i:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"rect":return e.createElement("rect",{key:"rect-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.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(Ot,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:o,showAxes:ce,axes:ue,xLabel:de,yLabel:he,xFormat:ge||pe,yFormat:ye||fe,showGrid:Se,title:_e,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,foregroundGraphics:yt,marginalGraphics:rt,xValues:[],yValues:[],annotations:we,svgAnnotationRules:Ae,annotationFrame:0,xAccessor:"string"==typeof A?A:"string"==typeof H?H:void 0,yAccessor:"string"==typeof S?S:"string"==typeof N?N:void 0,annotationData:null==t?void 0:t.getData(),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof M?M:void 0}))}return e.createElement("div",{ref:ct,className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof _e?_e:"XY chart",tabIndex:0,style:{position:"relative",width:R?"100%":ut[0],height:F?"100%":ut[1],overflow:"visible"},onMouseMove:ft?dn:void 0,onMouseLeave:ft?nn:void 0,onKeyDown:ln},pt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:ut[0],height:ut[1],pointerEvents:"none"}},pt),e.createElement(At,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:Et,showAxes:ce,axes:ue,showGrid:Se,xFormat:ge||pe,yFormat:ye||fe}),e.createElement("canvas",{ref:mt,"aria-label":Mt(null!==(h=null===(d=Vt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:vt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Dt,{hoverPoint:_t}),lt&&e.createElement(Ct,{scene:null!==(y=null===(g=Vt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:v+" chart"}),e.createElement(Ot,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,scales:Et,showAxes:ce,axes:ue,xLabel:de,yLabel:he,xFormat:ge||pe,yFormat:ye||fe,showGrid:Se,title:_e,legend:Ee,legendHoverBehavior:Oe,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Me,legendPosition:je,foregroundGraphics:yt,marginalGraphics:rt,xValues:Tt,yValues:Ft,annotations:we,svgAnnotationRules:Ae,annotationFrame:wt,xAccessor:"string"==typeof A?A:"string"==typeof H?H:void 0,yAccessor:"string"==typeof S?S:"string"==typeof N?N:void 0,annotationData:null===(p=Vt.current)||void 0===p?void 0:p.getData(),pointNodes:null===(f=Vt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type),curve:"string"==typeof M?M:void 0,underlayRendered:!0}),(He||We)&&e.createElement(un,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,dimension:null!==(m=null==He?void 0:He.dimension)&&void 0!==m?m:"xy",scales:Et,onBrush:null!=We?We:()=>{}}),(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:Ht?"#dc3545":"#28a745",color:"white"})},Ht?"STALE":"LIVE"),yn,gn)});dn.displayName="StreamXYFrame";const hn=i(null);function gn({colors:t,categories:n,colorScheme:o="category10",children:i}){const a=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:je[o]||Ce,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e.createElement(hn.Provider,{value:a},i)}function yn(){return a(hn)}function pn(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 fn(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(pn(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function mn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}gn.displayName="CategoryColorProvider";const[vn,bn]=_t(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=mn(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=mn(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}})}})),[xn,kn]=_t(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 wn(e){const t=d(),n=e.clientId||t,{name:o}=e,i=bn(e=>e.selections.get(o)),a=bn(e=>e.setClause),l=bn(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?fn(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}function An(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=wn({name:t});return{onHover:s(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 Sn(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=wn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function En(e,t,n){const o=bn(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=fn(o,n);return e.filter(t)},[e,o,n])}function On(e={}){const{limit:t=50,types:n,chartId:o}=e,i=kn(e=>e.version),a=kn(e=>e.observations),s=kn(e=>e.clearObservations),l=r(()=>{let e=a;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[a,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const Pn=i(!1);function Ln({selections:e}){const t=bn(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Mn({categoryColors:r,interaction:i,selectionName:a,field:l}){const c=Object.entries(r);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=An({name:a,fields:[l]}),g=wn({name:a,clientId:"__linked-legend-isolate__"}),[y,p]=n(new Set),[f,m]=n(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(y.size>0?v.current({[l]:Array.from(y)}):b.current())},[i,y,l]);const x=s(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[l]:e.label})):(m(null),h.onHover(null)))},[i,l,h]),k=s(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(lt,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:f,isolatedCategories:y}))}function jn({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=yn(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(vn,null,e.createElement(xn,null,n&&e.createElement(Ln,{selections:n}),e.createElement(Pn.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Mn,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(Mn,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function Cn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){const a=Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}});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:a,label:""}]}}function Nn(e){return e?"string"==typeof e?{name:e}:e:null}function Dn(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 _n="#007bff";function Bn(e){return"function"==typeof e?e:t=>t[e]}function Hn(e,t,n="category10"){const o=yn();return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":He(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=He(e,t,n);return e=>o[e]||r(e)}return He(e,t,n)}},[e,t,n,o])}function Wn(e,t,n){return r(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const r=Bn(n);return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}function Tn({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a}){const l=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}:null}(t,n),c=wn({name:(null==e?void 0:e.name)||"__unused__"}),u=An({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),d=kn(e=>e.pushObservation),h=e?{isActive:c.isActive,predicate:c.predicate}:null,g=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,i,a,d]),y=s(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,i,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}function In({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40}}){const c=a(Pn),u=void 0!==o?o:!c&&!!t,d=r(()=>{if(u&&t)return Cn({data:e,colorBy:t,colorScale:n,getColor:Be})},[u,t,e,n]),h=r(()=>{const e=Object.assign(Object.assign({},l),s);return d&&("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,s,d,i]);return{legend:d,margin:h,legendPosition:i}}function $n(e,t,o){const[i,a]=n(null),[l,c]=n(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(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=r(()=>{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&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const zn={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 Rn(e,t,n){var o,r,i,a,s,l;const c=zn[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,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:c.marginDefaults}}const Fn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Gn(e,t){return"function"==typeof t?t(e):e[t]}function Yn(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 qn(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=Gn(t,o);s=Yn(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=Gn(t,o);l.push({label:n,value:Yn(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Yn(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Yn(t[e[0]],r))}}const c=Object.assign(Object.assign({},Fn),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 Xn(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=Gn(t,o);c.push({value:Yn(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=Yn(Gn(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:Yn(t[e],r)})});const u=Object.assign(Object.assign({},Fn),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 Vn(t){if(!0===t)return qn();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:Fn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?qn(t):qn())}function Un(e){return"string"==typeof e?e:"value"}function Kn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qn(e,t){return"function"==typeof t?t(e):e[t]}function Zn(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?Kn(Qn(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=Kn(Qn(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 Jn({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=Qn(l,t),u=Qn(l,n),d=o?Qn(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold"}},Kn(c)),e.createElement("div",{style:{marginTop:4}},Kn(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Un(o),": ",Kn(d)))}}function eo({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 to 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(eo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function no(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 oo(e,t,n=3){let o,r=n+1;for(const n of t){const t=no(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function ro(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function io(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=oo(e,t,3))&&void 0!==n?n:null)}function ao({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=ro(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=io(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function so({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 lo({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=ro(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=io(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const co={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"]},frameProps:{type:"object"}},uo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},ho={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},go=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],yo=["vertical","horizontal"],po={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},co),uo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:go},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({},co),uo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:go},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},co),uo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:go},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({},co),uo),{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({},co),uo),{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({},co),uo),{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({},co),uo),{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"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},co),uo),{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({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},co),ho),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:yo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},co),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},co),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},co),{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({},co),{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:yo},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({},co),{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({},co),{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({},co),{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({},co),{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({},co),{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"},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 fo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function mo(e,t){const n=[],o=po[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(po).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(!fo(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=oo(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=ao({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=so({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=lo({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}}const vo=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),bo=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),xo=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ko=new Set(["LineChart","AreaChart","StackedAreaChart"]),wo=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function Ao(e,t){const n=[],o=mo(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return po[e]?(function(e,t,n){const o=po[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=po[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){vo.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){bo.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=po[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(!xo.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(!ko.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=po[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(!wo.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),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var So;const Eo="undefined"!=typeof process&&"production"!==(null===(So=process.env)||void 0===So?void 0:So.NODE_ENV);function Oo({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(to,{fallback:i=>{let a="";if(Eo&&r)try{const e=Ao(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(eo,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const Po={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"},Lo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Mo(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({},Po),{width:n,height:o})},r||"No data available"):null}function jo(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({},Lo),{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 Co(e,t,n,o){if(!Eo)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 No(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())})}"function"==typeof SuppressedError&&SuppressedError;let Do=null;function _o(){return No(this,void 0,void 0,function*(){return Do||(Do=yield import("./semiotic-ai-statisticalOverlays-C1f7TYyD.js")),Do})}const Bo=c(function(i,a){var l,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=Rn(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:y,className:p,xFormat:f,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A="category10",curve:S="linear",showPoints:E=!1,pointRadius:O=3,fillArea:P=!1,areaOpacity:L=.3,lineWidth:M=2,tooltip:j,pointIdAccessor:C,annotations:N,directLabel:D,gapStrategy:_="break",anomaly:B,forecast:H,frameProps:W={},selection:T,linkedHover:I,onObservation:$,chartId:z,loading:R,emptyContent:F,legendInteraction:G,legendPosition:Y,xScaleType:q,yScaleType:X}=i,V=h.width,U=h.height,K=h.enableHover,Q=h.showGrid,Z=h.showLegend,J=h.title,ee=h.xLabel,te=h.yLabel,ne=jo(R,V,U);if(ne)return ne;const oe=Mo(g,V,U,F);if(oe)return oe;const re=g||[];Co("LineChart",re,"xAccessor",v),Co("LineChart",re,"yAccessor",b);const ie="string"==typeof v?v:"x",ae="string"==typeof b?b:"y",[se,le]=n(null),[ce,ue]=n([]);o(()=>{if(!H&&!B)return;let e=!1;return le(null),ue([]),H?function(...e){return No(this,void 0,void 0,function*(){return(yield _o()).buildForecast(...e)})}(re,ie,ae,H,B).then(t=>{e||(le(t),ue(t.annotations))}).catch(()=>{e||(le(null),ue([]))}):B&&function(...e){return No(this,void 0,void 0,function*(){return(yield _o()).buildAnomalyAnnotations(...e)})}(B).then(t=>{e||(le(null),ue(t))}).catch(()=>{e||ue([])}),()=>{e=!0}},[re,H,B,ie,ae]);const de=se?se.processedData:re,he=H&&!x?"__forecastSegment":x,{activeSelectionHook:ge,customHoverBehavior:ye}=Tn({selection:T,linkedHover:I,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:$,chartType:"LineChart",chartId:z}),pe=s(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]),fe=void 0!==(null===(l=de[0])||void 0===l?void 0:l[k]),me=r(()=>{if(fe)return de;if(he){const e=de.reduce((e,t)=>{const n="function"==typeof he?he(t):t[he];if(!e[n]){const t={[k]:[]};"string"==typeof he&&(t[he]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:de}]},[de,he,k,fe]),{gapProcessedLineData:ve,hasGaps:be}=r(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of me){const o=(n[k]||[]).filter(t=>!pe(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of me){const o=n[k]||[];let r=[],i=0;const a=he&&"string"==typeof he?n[he]:void 0;for(const s of o)if(pe(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"===_){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of me){const r=o[k]||[],i=[];for(const n of r)pe(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:me,hasGaps:!1}},[me,_,k,pe,he,b]),xe=Hn(de,w,A),ke=r(()=>{if(!w)return[];const e=new Set;for(const t of de){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[de,w]),we=$n(G,w,ke),Ae=r(()=>we.legendSelectionHook?we.legendSelectionHook:ge,[we.legendSelectionHook,ge]),Se=r(()=>e=>{const t={strokeWidth:M};return w?xe&&(t.stroke=Be(e,w,xe),P&&(t.fill=t.stroke,t.fillOpacity=L)):(t.stroke=_n,P&&(t.fill=_n,t.fillOpacity=L)),t},[w,xe,M,P,L]),[Ee,Oe]=n(null);o(()=>{if(!H)return void Oe(null);let e=!1;return function(...e){return No(this,void 0,void 0,function*(){return(yield _o()).createSegmentLineStyle(...e)})}(Se,H).then(t=>{e||Oe(()=>t)}).catch(()=>{e||Oe(null)}),()=>{e=!0}},[Se,H]);const Pe=Ee||Se,Le=r(()=>Dn(Pe,Ae,T),[Pe,Ae,T]),Me=r(()=>{if(E)return e=>{const t={r:O,fillOpacity:1};return w?xe&&(t.fill=Be(e.parentLine||e,w,xe)):t.fill=_n,t}},[E,O,w,xe]),je=P?"area":"line",Ce="object"==typeof D?D:{},Ne=Ce.position||"end",De=Ce.fontSize||11,_e=r(()=>{var e,t;if(!D||!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 ve){const o=n[k]||[];if(0===o.length)continue;const a="end"===Ne?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"===Ne?6:-6,dy:0,color:xe?xe(e):_n,fontSize:De}));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];De+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=De+2)}return a},[D,w,xe,ve,k,v,b,Ne,De]),He=(!D||void 0!==Z)&&Z,We=r(()=>{if(!D)return h.marginDefaults;const e=_e.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*De);return Math.max(e,o)},0),t=e+10,n="end"===Ne?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[D,_e,De,Ne,h.marginDefaults]),{legend:Te,margin:Ie,legendPosition:$e}=In({data:ve,colorBy:w,colorScale:xe,showLegend:He,legendPosition:Y,userMargin:y,defaults:We}),ze=x||w,Re=r(()=>Zn([{label:ee||Un(v),accessor:v,role:"x"},{label:te||Un(b),accessor:b,role:"y"},...ze?[{label:Un(ze),accessor:ze,role:"group"}]:[]]),[v,b,ee,te,ze]),Fe=ao({componentName:"LineChart",data:fe?(null===(c=de[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}});if(Fe)return e.createElement(eo,{componentName:"LineChart",message:Fe,width:V,height:U});const Ge=r(()=>fe||he||be?ve.flatMap(e=>{const t=e[k]||[];return he&&"string"==typeof he?t.map(t=>Object.assign(Object.assign({},t),{[he]:e[he]})):t}):de,[ve,k,fe,he,de,be]),Ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:je},null!=g&&{data:Ge}),{xAccessor:v,yAccessor:b,xScaleType:q,yScaleType:X,groupAccessor:"break"===_&&be?"_gapSegment":he||void 0,curve:S,lineStyle:Le}),E&&{pointStyle:Me}),{size:[V,U],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:Ie,showAxes:h.showAxes,xLabel:ee,yLabel:te,xFormat:f,yFormat:m,enableHover:K,showGrid:Q}),Te&&{legend:Te,legendPosition:$e}),G&&"none"!==G&&{legendHoverBehavior:we.onLegendHover,legendClickBehavior:we.onLegendClick,legendHighlightedCategory:we.highlightedCategory,legendIsolatedCategories:we.isolatedCategories}),J&&{title:J}),p&&{className:p}),{tooltipContent:!1===j?()=>null:Vn(j)||Re}),(I||$)&&{customHoverBehavior:ye}),C&&{pointIdAccessor:C}),((null==N?void 0:N.length)||ce.length||_e.length)&&{annotations:[...N||[],...ce,..._e]}),W);return e.createElement(Oo,{componentName:"LineChart",width:V,height:U},e.createElement(dn,Object.assign({ref:d},Ye)))});Bo.displayName="LineChart";const Ho=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",areaBy:f,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k="category10",curve:w="monotoneX",areaOpacity:A=.7,showLine:S=!0,lineWidth:E=2,tooltip:O,annotations:P,frameProps:L={},selection:M,linkedHover:j,onObservation:C,chartId:N,loading:D,emptyContent:_,legendInteraction:B,legendPosition:H}=n,W=s.width,T=s.height,I=s.enableHover,$=s.showGrid,z=s.showLegend,R=s.title,F=s.xLabel,G=s.yLabel,Y=jo(D,W,T);if(Y)return Y;const q=Mo(l,W,T,_);if(q)return q;const X=l||[];Co("AreaChart",X,"xAccessor",y),Co("AreaChart",X,"yAccessor",p);const{activeSelectionHook:V,customHoverBehavior:U}=Tn({selection:M,linkedHover:j,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:C,chartType:"AreaChart",chartId:N}),K=void 0!==(null===(i=X[0])||void 0===i?void 0:i[b]),Q=r(()=>{if(K)return X;if(f){const e=X.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[b]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:X}]},[X,f,b,K]),Z=Hn(X,x,k),J=r(()=>{if(!x)return[];const e=new Set;for(const t of X){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[X,x]),ee=$n(B,x,J),te=r(()=>ee.legendSelectionHook?ee.legendSelectionHook:V,[ee.legendSelectionHook,V]),ne=r(()=>e=>{const t={};if(x){if(Z){const n=Be(e,x,Z);t.fill=n,S?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else t.fill=_n,S?(t.stroke=_n,t.strokeWidth=E):t.stroke="none";return t.fillOpacity=A,t},[x,Z,A,S,E]),oe=r(()=>Dn(ne,te,M),[ne,te,M]),{legend:re,margin:ie,legendPosition:ae}=In({data:Q,colorBy:x,colorScale:Z,showLegend:z,legendPosition:H,userMargin:c,defaults:s.marginDefaults}),se=f||x,le=r(()=>Zn([{label:F||Un(y),accessor:y,role:"x"},{label:G||Un(p),accessor:p,role:"y"},...se?[{label:Un(se),accessor:se,role:"group"}]:[]]),[y,p,F,G,se]),ce=ao({componentName:"AreaChart",data:l,accessors:{xAccessor:y,yAccessor:p}});if(ce)return e.createElement(eo,{componentName:"AreaChart",message:ce,width:W,height:T});const ue=r(()=>K||f?Q.flatMap(e=>{const t=e[b]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):X,[Q,b,K,f,X]),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ue}),{xAccessor:y,yAccessor:p,groupAccessor:f||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),{curve:w,lineStyle:oe,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,showAxes:s.showAxes,xLabel:F,yLabel:G,xFormat:h,yFormat:g,enableHover:I,showGrid:$}),re&&{legend:re,legendPosition:ae}),B&&"none"!==B&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories}),R&&{title:R}),d&&{className:d}),{tooltipContent:!1===O?()=>null:Vn(O)||le}),(j||C)&&{customHoverBehavior:U}),P&&P.length>0&&{annotations:P}),L);return e.createElement(Oo,{componentName:"AreaChart",width:W,height:T},e.createElement(dn,Object.assign({ref:a},de)))});function Wo({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:l="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=s(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),y=s(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=s(e=>t=>{y([t]),e(t)},[y]),f=s(e=>t=>{y(t),e(t)},[y]),m=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:Ne,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 Cn({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Be})},[e,o,a,i,d]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:p,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}Ho.displayName="AreaChart";const To=c(function(n,o){var i;const a=t(null),l=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:y,xAccessor:p="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,normalize:E=!1,tooltip:O,annotations:P,frameProps:L={},selection:M,linkedHover:j,onObservation:C,chartId:N,loading:D,emptyContent:_,legendInteraction:B,legendPosition:H}=n,W=l.width,T=l.height,I=l.enableHover,$=l.showGrid,z=l.showLegend,R=l.title,F=l.xLabel,G=l.yLabel,Y=jo(D,W,T);if(Y)return Y;const q=Mo(c,W,T,_);if(q)return q;const X=c||[],V=Wo({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:z,legendPosition:H}),U=s(V.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[V.wrapPush]),K=s(V.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[V.wrapPushMany]);u(o,()=>({push:U,pushMany:K,clear:()=>{var e;V.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:[]}}),[U,K,V.resetCategories]);const{activeSelectionHook:Q,customHoverBehavior:Z}=Tn({selection:M,linkedHover:j,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:C,chartType:"StackedAreaChart",chartId:N}),J=void 0!==(null===(i=X[0])||void 0===i?void 0:i[v]),ee=r(()=>{if(J)return X;if(m){const e=X.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]:X}]},[X,m,v,J]),te=Hn(X,b,x),ne=r(()=>{if(!b)return[];const e=new Set;for(const t of X){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[X,b]),oe=$n(B,b,ne),re=r(()=>oe.legendSelectionHook?oe.legendSelectionHook:Q,[oe.legendSelectionHook,Q]),ie=r(()=>e=>{const t={};if(b&&te){const n=Be(e,b,te);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else b||(t.fill=_n,t.stroke=A?_n:"none",A&&(t.strokeWidth=S));return t.fillOpacity=w,t},[b,te,w,A,S]),ae=r(()=>Dn(ie,re,M),[ie,re,M]),{legend:se,margin:le,legendPosition:ce}=In({data:ee,colorBy:b,colorScale:te,showLegend:z,legendPosition:H,userMargin:d,defaults:l.marginDefaults}),ue=V.streamingLegend||se,de=H||ce,he=r(()=>{if(V.streamingMarginAdjust){const e=Object.assign({},le);for(const[t,n]of Object.entries(V.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return le},[le,V.streamingMarginAdjust]),ge=m||b,ye=r(()=>Zn([{label:F||Un(p),accessor:p,role:"x"},{label:G||Un(f),accessor:f,role:"y"},...ge?[{label:Un(ge),accessor:ge,role:"group"}]:[]]),[p,f,F,G,ge]),pe=ao({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:f}});if(pe)return e.createElement(eo,{componentName:"StackedAreaChart",message:pe,width:W,height:T});const fe=r(()=>J||m?ee.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):X,[ee,v,J,m,X]),me=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:fe}),{xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:k,normalize:E,lineStyle:ae,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:he,showAxes:l.showAxes,xLabel:F,yLabel:G,xFormat:g,yFormat:y,enableHover:I,showGrid:$}),ue&&{legend:ue,legendPosition:de}),B&&"none"!==B&&{legendHoverBehavior:oe.onLegendHover,legendClickBehavior:oe.onLegendClick,legendHighlightedCategory:oe.highlightedCategory,legendIsolatedCategories:oe.isolatedCategories}),R&&{title:R}),h&&{className:h}),{tooltipContent:!1===O?()=>null:Vn(O)||ye}),(j||C)&&{customHoverBehavior:Z}),P&&P.length>0&&{annotations:P}),L);return e.createElement(Oo,{componentName:"StackedAreaChart",width:W,height:T},e.createElement(dn,Object.assign({ref:a},me)))});function Io(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:y,showLegend:p,userMargin:f,marginDefaults:m,loading:v,emptyContent:b,width:x,height:k}=e,{activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:S}=Tn({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:y}),E=Hn(t,o,i),O=r(()=>{if(!o)return[];const e=new Set;for(const n of t){const t="function"==typeof o?o(n):n[o];null!=t&&e.add(t+"")}return Array.from(e)},[t,o]),P=$n(a,o,O),L=r(()=>P.legendSelectionHook?P.legendSelectionHook:w,[P.legendSelectionHook,w]),{legend:M,margin:j,legendPosition:C}=In({data:t,colorBy:o,colorScale:E,showLegend:p,legendPosition:s,userMargin:f,defaults:m}),N=r(()=>{const e={};return M&&(e.legend=M,e.legendPosition=C),a&&"none"!==a&&(e.legendHoverBehavior=P.onLegendHover,e.legendClickBehavior=P.onLegendClick,e.legendHighlightedCategory=P.highlightedCategory,e.legendIsolatedCategories=P.isolatedCategories),e},[M,C,a,P.onLegendHover,P.onLegendClick,P.highlightedCategory,P.isolatedCategories]),D=jo(v,x,k),_=D?null:Mo(n,x,k,b);return{colorScale:E,allCategories:O,legendState:P,effectiveSelectionHook:L,activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:S,legend:M,margin:j,legendPosition:C,earlyReturn:D||_||null,legendBehaviorProps:N}}To.displayName="StackedAreaChart";const $o=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",colorBy:f,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:E,frameProps:O={},selection:P,linkedHover:L,linkedBrush:M,onObservation:j,chartId:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=a.width,W=a.height,T=a.enableHover,I=a.showGrid,$=a.title,z=a.xLabel,R=a.yLabel,F=l||[],G=Io({data:F,rawData:l,colorBy:f,colorScheme:m,legendInteraction:_,legendPosition:B,selection:P,linkedHover:L,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:j,chartType:"Scatterplot",chartId:C,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:N,emptyContent:D,width:H,height:W}),Y=Nn(M),q=Sn({name:(null==Y?void 0:Y.name)||"__unused_brush__",xField:(null==Y?void 0:Y.xField)||("string"==typeof y?y:void 0),yField:(null==Y?void 0:Y.yField)||("string"==typeof p?p:void 0)}),X=Y?"xyBrush"===q.brushInteraction.brush?"xy":"xBrush"===q.brushInteraction.brush?"x":"y":void 0,V=e.useRef(q.brushInteraction);V.current=q.brushInteraction;const U=s(e=>{const t=V.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(G.earlyReturn)return G.earlyReturn;Co("Scatterplot",F,"xAccessor",y),Co("Scatterplot",F,"yAccessor",p);const K=r(()=>{if(!v||0===F.length)return;const e=F.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[F,v]),Q=r(()=>e=>{const t={fillOpacity:k};return f?G.colorScale&&(t.fill=Be(e,f,G.colorScale)):t.fill=_n,t.r=v?We(e,v,b,K):x,t},[f,G.colorScale,v,b,K,x,k]),Z=r(()=>Dn(Q,G.effectiveSelectionHook,P),[Q,G.effectiveSelectionHook,P]),J=r(()=>Zn([{label:z||Un(y),accessor:y,role:"x"},{label:R||Un(p),accessor:p,role:"y"},...f?[{label:Un(f),accessor:f,role:"color"}]:[],...v?[{label:Un(v),accessor:v,role:"size"}]:[]]),[y,p,z,R,f,v]),ee=ao({componentName:"Scatterplot",data:l,accessors:{xAccessor:y,yAccessor:p}});if(ee)return e.createElement(eo,{componentName:"Scatterplot",message:ee,width:H,height:W});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({chartType:"scatter"},null!=l&&{data:F}),{xAccessor:y,yAccessor:p,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:Z,colorScheme:m,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,showAxes:a.showAxes,xLabel:z,yLabel:R,xFormat:h,yFormat:g,enableHover:T,showGrid:I}),G.legendBehaviorProps),$&&{title:$}),d&&{className:d}),{tooltipContent:!1===w?()=>null:Vn(w)||J}),(L||j)&&{customHoverBehavior:G.customHoverBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),Y&&{brush:{dimension:X},onBrush:U}),O);return e.createElement(Oo,{componentName:"Scatterplot",width:H,height:W},e.createElement(dn,Object.assign({ref:i},te)))});function zo(e,t){return w(1===t?.5:e/(t-1))}$o.displayName="Scatterplot";const Ro=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:y,orderLabel:p,pointRadius:f=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,chartId:S,loading:E,emptyContent:O,legendInteraction:P}=n,L=a.width,M=a.height,j=a.enableHover,C=a.showGrid,N=a.title,D=a.xLabel,_=a.yLabel,B=s||[],H=r(()=>{if(!y||0===B.length)return B;const e="function"==typeof y?y:e=>e[y];return[...B].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})},[B,y]);Co("ConnectedScatterplot",H,"xAccessor",h),Co("ConnectedScatterplot",H,"yAccessor",g);const{activeSelectionHook:W,customHoverBehavior:T}=Tn({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,chartType:"ConnectedScatterplot",chartId:S}),I=$n(P,void 0,[]),$=r(()=>I.legendSelectionHook?I.legendSelectionHook:W,[I.legendSelectionHook,W]),z=r(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==$?void 0:$.isActive,a=null==$?void 0:$.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=zo(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=f+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=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,$]),R=r(()=>[z],[z]),F=t({idx:0,total:0}),G=r(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];return n=>{var o,r;const a=F.current;if(0===a.idx){const n=null!==(r=null===(o=i.current)||void 0===o?void 0:o.getData())&&void 0!==r?r:H;a.total=n.filter(n=>{const o=e(n),r=t(n);return null!=o&&null!=r&&isFinite(o)&&isFinite(r)}).length}const s=a.total,l=a.idx;return a.idx++,s>a.idx||(a.idx=0),{fill:s>0?zo(l,s):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}}},[f,H.length,h,g]),Y=r(()=>Dn(G,$,k),[G,$,k]),q=Object.assign({top:50,right:40,bottom:60,left:70},n.margin),X=p||("string"==typeof y?y:"Order"),V=r(()=>Zn([{label:D||Un(h),accessor:h,role:"x"},{label:_||Un(g),accessor:g,role:"y"},...y?[{label:X,accessor:y,role:"group"}]:[]]),[h,g,D,_,y,X]),U=ao({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),K=jo(E,L,M);if(K)return K;const Q=Mo(s,L,M,O);if(Q)return Q;if(U)return e.createElement(eo,{componentName:"ConnectedScatterplot",message:U,width:L,height:M});const Z=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:H}),{xAccessor:h,yAccessor:g,pointStyle:Y,size:[L,M],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q,showAxes:a.showAxes,xLabel:D,yLabel:_,xFormat:c,yFormat:d,enableHover:j,showGrid:C}),N&&{title:N}),l&&{className:l}),{tooltipContent:!1===m?()=>null:Vn(m)||V}),(w||A)&&{customHoverBehavior:T}),v&&{pointIdAccessor:v}),{canvasPreRenderers:R}),b&&b.length>0&&{annotations:b}),x);return e.createElement(Oo,{componentName:"ConnectedScatterplot",width:L,height:M},e.createElement(dn,Object.assign({ref:i},Z)))});Ro.displayName="ConnectedScatterplot";const Fo=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:y="y",sizeBy:p,sizeRange:f=[5,40],colorBy:m,colorScheme:v="category10",bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:E,frameProps:O={},selection:P,linkedHover:L,linkedBrush:M,onObservation:j,chartId:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=a.width,W=a.height,T=a.enableHover,I=a.showGrid,$=a.showLegend,z=a.title,R=a.xLabel,F=a.yLabel,G=jo(N,H,W);if(G)return G;const Y=Mo(s,H,W,D);if(Y)return Y;const q=s||[],{activeSelectionHook:X,customHoverBehavior:V}=Tn({selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],onObservation:j,chartType:"BubbleChart",chartId:C}),U=Nn(M);Sn({name:(null==U?void 0:U.name)||"__unused_brush__",xField:(null==U?void 0:U.xField)||("string"==typeof g?g:void 0),yField:(null==U?void 0:U.yField)||("string"==typeof y?y:void 0)});const K=Hn(q,m,v),Q=r(()=>{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]),Z=$n(_,m,Q),J=r(()=>Z.legendSelectionHook?Z.legendSelectionHook:X,[Z.legendSelectionHook,X]),ee=r(()=>{const e=q.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[q,p]),te=r(()=>e=>{const t={fillOpacity:b,strokeWidth:x,stroke:k};return m?K&&(t.fill=Be(e,m,K)):t.fill=_n,t.r=We(e,p,f,ee),t},[m,K,p,f,ee,b,x,k]),ne=r(()=>Dn(te,J,P),[te,J,P]),{legend:oe,margin:re,legendPosition:ie}=In({data:q,colorBy:m,colorScale:K,showLegend:$,legendPosition:B,userMargin:l,defaults:a.marginDefaults}),ae=r(()=>Zn([{label:R||Un(g),accessor:g,role:"x"},{label:F||Un(y),accessor:y,role:"y"},{label:Un(p),accessor:p,role:"size"},...m?[{label:Un(m),accessor:m,role:"color"}]:[]]),[g,y,R,F,p,m]),se=ao({componentName:"BubbleChart",data:s,accessors:{xAccessor:g,yAccessor:y},requiredProps:{sizeBy:p}});if(se)return e.createElement(eo,{componentName:"BubbleChart",message:se,width:H,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({chartType:"bubble"},null!=s&&{data:q}),{xAccessor:g,yAccessor:y,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:f,pointStyle:ne,colorScheme:v,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re,showAxes:a.showAxes,xLabel:R,yLabel:F,xFormat:d,yFormat:h,enableHover:T,showGrid:I}),oe&&{legend:oe,legendPosition:ie}),_&&"none"!==_&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories}),z&&{title:z}),c&&{className:c}),{tooltipContent:!1===w?()=>null:Vn(w)||ae}),(L||j)&&{customHoverBehavior:V}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),O);return e.createElement(Oo,{componentName:"BubbleChart",width:H,height:W},e.createElement(dn,Object.assign({ref:i},le)))});Fo.displayName="BubbleChart";const Go=c(function(n,o){const i=t(null);u(o,()=>({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=Rn(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:y,yFormat:p,colorScheme:f="blues",customColorScale:m,showValues:b=!1,valueFormat:x,cellBorderColor:k="#fff",cellBorderWidth:A=1,tooltip:S,annotations:L,frameProps:M={},selection:j,linkedHover:C,onObservation:N,chartId:D,loading:_,emptyContent:B,showLegend:H,legendPosition:W,legendInteraction:T}=n,I=a.width,$=a.height,z=a.enableHover,R=a.title,F=a.xLabel,G=a.yLabel,Y=jo(_,I,$);if(Y)return Y;const q=Mo(s,I,$,B);if(q)return q;const X=s||[],V=null!=H&&H,U=null!=W?W:"right",{margin:K}=In({data:X,colorBy:V?"value":void 0,colorScale:void 0,showLegend:V,legendPosition:U,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:Q,customHoverBehavior:Z}=Tn({selection:j,linkedHover:C,fallbackFields:[],onObservation:N,chartType:"Heatmap",chartId:D}),J=$n(T,void 0,[]),ee=r(()=>J.legendSelectionHook?J.legendSelectionHook:Q,[J.legendSelectionHook,Q]),te=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ne=r(()=>{const e=X.map(te);return[Math.min(...e),Math.max(...e)]},[X,te]),oe=r(()=>"custom"===f&&m?m:v({blues:P,reds:O,greens:E,viridis:w}[f]||P).domain(ne),[f,m,ne]);r(()=>{const e=Bn(d),t=Bn(h);return{xBinCount:new Set(X.map(e)).size,yBinCount:new Set(X.map(t)).size}},[X,d,h]),r(()=>({coordinates:X}),[X]);const re=r(()=>e=>{const t=te(e);return{fill:oe(t),stroke:k,strokeWidth:A}},[te,oe,k,A]);r(()=>Dn(re,ee,j),[re,ee,j]);const ie=r(()=>Zn([{label:F||Un(d),accessor:d,role:"x"},{label:G||Un(h),accessor:h,role:"y"},{label:Un(g),accessor:g,role:"value"}]),[d,h,F,G,g]),ae=ao({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}});if(ae)return e.createElement(eo,{componentName:"Heatmap",message:ae,width:I,height:$});const se=r(()=>{if(V)return{gradient:{colorFn:e=>oe(e),domain:ne,label:"string"==typeof g?g:"value",format:x}}},[V,oe,ne,g,x]),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=s&&{data:X}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==f?f:void 0,showValues:b,heatmapValueFormat:x,size:[I,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,showAxes:a.showAxes,xLabel:F,yLabel:G,xFormat:y,yFormat:p,enableHover:z}),se&&{legend:se,legendPosition:U}),R&&{title:R}),c&&{className:c}),{tooltipContent:!1===S?()=>null:Vn(S)||ie}),(C||N)&&{customHoverBehavior:Z}),L&&L.length>0&&{annotations:L}),M);return e.createElement(Oo,{componentName:"Heatmap",width:I,height:$},e.createElement(dn,Object.assign({ref:i},le)))});Go.displayName="Heatmap";const Yo="__splomIdx",qo={top:4,bottom:4,left:4,right:4};function Xo({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-qo.left-qo.right,l=r-qo.top-qo.bottom;return o(()=>{if(!a.current)return;const e=p(a.current).select(".brush-g"),t=y().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(${qo.left},${qo.top})`}))}function Vo({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:y,onPointHover:p}){const f=t(null),m=wn({name:d,clientId:`splom-${o}-${r}`}),v=Sn({name:d,xField:o,yField:r}),b=wn({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=s(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=s(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[Yo];void 0!==n&&(x({[Yo]:[n]}),null==p||p(t,e.x+qo.left,e.y+qo.top))},[x,p]),A=s(e=>{const t={opacity:l,r:a};return t.fill=c?Be(e,c,u):_n,"hover"===y?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*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,a,y,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(dn,{ref:f,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:qo,showAxes:!1,enableHover:"hover"===y,customHoverBehavior:"hover"===y?w:void 0,tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&e.createElement(Xo,{frameRef:f,cellSize:i,xField:o,yField:r,onBrush:k}))}function Uo({data:t,field:n,label:o,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=wn({name:c,clientId:"splom-diag-"+n}),g=wn({name:u,clientId:`splom-diag-${n}-hover`}),y="hover"===d?g:h,p=y.isActive,f=y.predicate,m=r(()=>{const e=t.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const o=Math.min(...e),r=(Math.max(...e)-o)/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)),y=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of t){const t=e[n];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-o)/r),a-1);if(d[i]++,p&&!f(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!f(e)||y[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=y.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,n,a,i,p,f,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"},o),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):_n,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:_n,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):_n,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:_n,opacity:.7}))))}function Ko({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 Qo(t){const{data:o,fields:i,fieldLabels:a={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:y="histogram",histogramBins:p=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:E}=t,O="splom",P="splom-hover",L=m?"hover":f?"brush":"hover",M=bn(e=>e.clearSelection),[j,C]=n(null),N=s(()=>{M(P),C(null)},[M,P]),D=r(()=>(o||[]).map((e,t)=>void 0!==e[Yo]?e:Object.assign(Object.assign({},e),{[Yo]:t})),[o]),_=Hn(D,l,c),B=void 0!==k?k:!!l,H=r(()=>{if(!B||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(D.map(t=>t[e]))].map(e=>({label:e+"",color:_?_(e+""):_n})):null},[B,l,D,_]),W=r(()=>({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"}},H&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},H.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:W,onMouseLeave:"hover"===L?N: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"===y?e.createElement(Ko,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(Uo,{key:"diag-"+t,data:D,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:l,colorScale:_,brushSelectionName:O,hoverSelectionName:P,unselectedOpacity:v,mode:L}):e.createElement(Vo,{key:`cell-${t}-${o}`,data:D,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:l,colorScale:_,brushSelectionName:O,hoverSelectionName:P,unselectedOpacity:v,showGrid:b,tooltip:x,mode:L,onPointHover:"hover"===L?(e,i,a)=>{e?(C({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:E})):(C(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E}))}: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))),j&&"hover"===L&&(()=>{const t=j.datum,n=a[j.xField]||j.xField,o=a[j.yField]||j.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[Yo];return e.createElement("div",{style:{position:"absolute",left:40+j.colIndex*(u+d)+j.px,top:j.rowIndex*(u+d)+j.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[j.xField]?Number(t[j.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[j.yField]?Number(t[j.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function Zo(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(jn,{selections:r},e.createElement(Qo,Object.assign({},t)))}function Jo(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=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 er(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=D(e,.25))&&void 0!==t?t:i,median:null!==(n=D(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=D(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}Zo.displayName="ScatterplotMatrix";const tr={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;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,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(Ee(e.x,n,e.width,Math.abs(a),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(Ee(n,e.x,Math.abs(a),e.width,y,p,i)),0>t?r+=t:o+=t}}}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(Ee(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(Ee(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,y=s.length>0,p=2*Math.PI,f=-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=y&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(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),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:Jo,donut:Jo,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,y=[],p="vertical"===g,f=!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=D(t,.25))&&void 0!==n?n:s,g=null!==(o=D(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=D(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(f)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(y.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}),f)for(const e of S)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return y},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,y=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)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),y-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/f*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/f*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=D(t,.25))&&void 0!==n?n:i,l=null!==(o=D(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=D(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:er(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(Ee(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},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)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=s(e.pieceData[0],e.name),f=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]/y*f}`;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]/y*f} ${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:er(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(Ee(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(Ee(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class nr{constructor(e){this.rExtent=new xe,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 be(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=>Pe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new xe)):(this.getR=Pe(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 be(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=[];for(const e of t)n.has(e)?o.push(e):this.categories.delete(e);return o}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;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack&&this.config.normalize)a=0,s=1;else if("bar"===r&&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>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}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=tr[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:Ne,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 y=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?(y.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?(y.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)y.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:ze(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Ie(e,this.activeTransition),i=Te(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=$e(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=$e(o.x,e._targetX,i),e.y=$e(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=$e(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=$e(n.x,e._targetX,i),e.y=$e(n.y,e._targetY,i),void 0!==n.w&&(e.w=$e(n.w,e._targetW,i),e.h=$e(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){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function or(e,t,n){const o=Fe(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function rr(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function ir(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=Ge(Math.atan2(r,o)),s=Ge(e.startAngle),l=Ge(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 ar(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 sr(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 lr(t){const{width:n,height:o,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),y=r(()=>!l||h?[]:l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(d||cr)(e)})),[l,d,h]),p=u&&l&&!h,f=c&&l&&!h;return p||f?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})`},p&&e.createElement("g",{className:"ordinal-grid"},y.map((t,r)=>e.createElement("line",{key:"grid-"+r,x1:g?t.pixel:0,y1:g?0:t.pixel,x2:g?t.pixel:n,y2:g?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),f&&e.createElement(e.Fragment,null,g?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function cr(e){return Math.round(100*e)/100+""}function ur(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,oLabel:g,rLabel:y,oFormat:p,rFormat:f,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:S="right",foregroundGraphics:E,annotations:O,svgAnnotationRules:P,xAccessor:L,yAccessor:M,annotationData:j,underlayRendered:C,children:N}=n,D="radial"===(null==d?void 0:d.projection),_="horizontal"===(null==d?void 0:d.projection),B=r(()=>h&&d&&!D?d.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2,label:p?p(e):e}}):[],[h,d,p,D]),H=r(()=>h&&d&&!D?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(f||cr)(e)})):[],[h,d,f,D]),W=t(new Map),T=t(null!==(o=null==O?void 0:O.length)&&void 0!==o?o:0),I=null!==(i=null==O?void 0:O.length)&&void 0!==i?i:0;T.current!==I&&(T.current=I,W.current=new Map);const $=r(()=>{if(!O||0===O.length)return null;const e=kt(),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}:null,timeAxis:"x",xAccessor:L,yAccessor:M,width:a,height:s,data:j,frameType:"ordinal",stickyPositionCache:W.current};return O.map((t,n)=>{if(P){const r=P(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[O,P,a,s,d,L,M,j]);return h||v||b||E||$&&$.length>0||m||N?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof v?v:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},m&&d&&!D&&!C&&e.createElement("g",{className:"ordinal-grid"},H.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:_?t.pixel:0,y1:_?0:t.pixel,x2:_?t.pixel:a,y2:_?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!D&&e.createElement("g",{className:"ordinal-axes"},_?e.createElement(e.Fragment,null,!C&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.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}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&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"}},g),!C&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.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))),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!C&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.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}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},g),!C&&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:"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))),y&&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"}},y))),$,E,N),v&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof v?v:null),ct({legend:b,totalWidth:l,totalHeight:c,margin:u,legendPosition:S,title:v,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A})):null}function dr(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 hr=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)dr(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&&(dr(e,t),Vt(e,t)),e.globalAlpha=1},gr=(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()}},yr=(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}},pr=e=>[yr,...e],fr={bar:pr([en]),clusterbar:pr([en]),point:pr([Jt]),swarm:pr([Jt]),pie:[hr],donut:[hr],boxplot:pr([(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()}},Jt]),violin:pr([gr]),histogram:pr([en]),ridgeline:pr([gr]),timeline:pr([en])},mr={top:50,right:40,bottom:60,left:70},vr={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 br({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:vr},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:vr},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:vr},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:vr},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const y=(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(!y&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:vr},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:vr},y&&e.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const xr=c(function(i,a){var l,c,d,h,g,y,p;const{chartType:f,runtimeMode:m,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:k,stackBy:w,groupBy:A,multiAxis:S,timeAccessor:E,valueAccessor:O,categoryAccessor:P,projection:L="vertical",size:M=[600,400],responsiveWidth:j,responsiveHeight:C,margin:N,barPadding:D,innerRadius:_,normalize:B,startAngle:H,dynamicColumnWidth:W,bins:T,showOutliers:I,showIQR:$,amplitude:z,connectorAccessor:R,connectorStyle:F,rExtent:G,oExtent:Y,extentPadding:q=.05,oSort:X,windowMode:V="sliding",windowSize:U=200,pieceStyle:K,summaryStyle:Q,colorScheme:Z,barColors:J,showAxes:ee=!0,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,enableHover:ae=!0,hoverAnnotation:se,tooltipContent:le,customHoverBehavior:ce,annotations:ue,svgAnnotationRules:de,showGrid:he=!1,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,backgroundGraphics:xe,foregroundGraphics:ke,title:we,className:Ae,background:Se,centerContent:Ee,decay:Oe,pulse:Pe,transition:Le,staleness:Me,accessibleTable:je}=i,[Ce,Ne]=tt(M,j,C),De=r(()=>Object.assign(Object.assign({},mr),N),[N]),_e=Ne[0]-De.left-De.right,Be=Ne[1]-De.top-De.bottom,He="function"==typeof ke?ke({size:Ne,margin:De}):ke,We=t(null),Te=t(!0),Ie=It(e=>e.theme),$e=t(0),ze=t(null),Re=t(()=>{}),[Fe,Ge]=n(null),[Ye,qe]=n(null),[Xe,Ve]=n(0),[Ue,Ke]=n(!1),Qe=ae||se,Ze="streaming"===m,ot=r(()=>({chartType:f,runtimeMode:Ze?"streaming":"bounded",windowSize:U,windowMode:V,extentPadding:q,projection:L,oAccessor:Ze?void 0:b,rAccessor:Ze?void 0:x,colorAccessor:k,stackBy:w,groupBy:A,multiAxis:S,timeAccessor:Ze?E:void 0,valueAccessor:Ze?O||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:Ze?P||b:void 0,rExtent:G,oExtent:Y,barPadding:D,innerRadius:_,normalize:B,startAngle:H,dynamicColumnWidth:W,bins:T,showOutliers:I,showIQR:$,amplitude:z,connectorAccessor:R,connectorStyle:F,oSort:X,pieceStyle:K,summaryStyle:Q,colorScheme:Z,barColors:J,decay:Oe,pulse:Pe,transition:Le,staleness:Me}),[f,U,V,q,L,b,x,k,w,A,S,E,O,P,G,Y,D,_,B,H,W,T,I,$,z,R,F,X,K,Q,Z,J,Oe,Pe,Le,Me,Ze]),rt=t(null);rt.current||(rt.current=new nr(ot));const it=s(()=>{$e.current||($e.current=requestAnimationFrame(()=>Re.current()))},[]);o(()=>{var e;null===(e=rt.current)||void 0===e||e.updateConfig(ot),Te.current=!0,it()},[ot,it]),o(()=>{Te.current=!0,it()},[Ie,it]);const at=t(null);at.current||(at.current=new ve(e=>{const t=rt.current;t&&t.ingest(e)&&(Te.current=!0,it())}));const st=s(e=>{var t;null===(t=at.current)||void 0===t||t.push(e)},[]),lt=s(e=>{var t;null===(t=at.current)||void 0===t||t.pushMany(e)},[]),ct=s(()=>{var e,t;null===(e=at.current)||void 0===e||e.clear(),null===(t=rt.current)||void 0===t||t.clear(),Te.current=!0,it()},[it]);u(a,()=>({push:st,pushMany:lt,clear:ct,getData:()=>{var e,t,n;return null===(e=at.current)||void 0===e||e.flush(),null!==(n=null===(t=rt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[st,lt,ct]),o(()=>{var e;v&&(null===(e=at.current)||void 0===e||e.setBoundedData(v))},[v]);const ut=t(()=>{}),dt=t(()=>{});ut.current=e=>{if(!Qe)return;const t=We.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-De.left,r=e.clientY-n.top-De.top;if(0>o||o>_e||0>r||r>Be)return void(ze.current&&(ze.current=null,Ge(null),ce&&ce(null),it()));const i=rt.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=or(i,t,n);break;case"point":e=rr(i,t,n);break;case"wedge":e=ir(i,t,n);break;case"boxplot":e=ar(i,t,n);break;case"violin":e=sr(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-_e/2:o,a?r-Be/2:r);if(!s)return void(ze.current&&(ze.current=null,Ge(null),ce&&ce(null),it()));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 b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});ze.current=c,Ge(c),ce&&(ce(c),Te.current=!0),it()},dt.current=()=>{ze.current&&(ze.current=null,Ge(null),ce&&(ce(null),Te.current=!0),it())},s(e=>ut.current(e),[]);const ht=s(()=>dt.current(),[]),gt=t(-1),yt=s(e=>{const t=rt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=gt.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return gt.current=-1,ze.current=null,Ge(null),ce&&ce(null),void it();const i=0>o?0:r;gt.current=i;const a=Object.assign(Object.assign({},et(n[i])),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});ze.current=a,Ge(a),ce&&ce(a),it()},[ce,it]),pt=s(e=>{gt.current=-1,ut.current(e)},[]);Re.current=()=>{var e,t;$e.current=0;const n=We.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=rt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=Te.current;s&&!a&&(r.computeScene({width:_e,height:Be}),Te.current=!1),(s||a)&&n.setAttribute("aria-label",Mt(r.scene,f+" chart"));const l=zt(),c=Ne[0]*l,u=Ne[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=Ne[0]+"px",n.style.height=Ne[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,Ne[0],Ne[1]);const d=null!==(e=null==Me?void 0:Me.threshold)&&void 0!==e?e:5e3,h=Me&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==Me?void 0:Me.dimOpacity)&&void 0!==t?t:.5);const g=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=Se||(g&&"transparent"!==g?g:null);y&&(o.fillStyle=y,o.fillRect(0,0,Ne[0],Ne[1]));const p="radial"===L;p?(o.save(),o.translate(De.left+_e/2,De.top+Be/2)):o.translate(De.left,De.top);const m=fr[f]||[],v={width:_e,height:Be};for(const e of m)e(o,r.scene,r.scales,v);p&&o.restore(),h&&(o.globalAlpha=1),s&&r.scales&&(qe(r.scales),Ve(e=>e+1)),(null==Me?void 0:Me.showBadge)&&Ke(!!h),(a||r.hasActivePulses)&&($e.current=requestAnimationFrame(()=>Re.current()))},o(()=>(it(),()=>{$e.current&&(cancelAnimationFrame($e.current),$e.current=0)}),[it]),o(()=>{Te.current=!0,it()},[f,_e,Be,ee,Se,it]),nt(Me,rt,Te,it,Ue,Ke);const ft=Qe&&Fe?le?le(Fe):e.createElement(br,{hover:Fe}):null,mt="radial"===L,vt=Fe?mt?Fe.x+_e/2:Fe.x:0,bt=Fe?mt?Fe.y+Be/2:Fe.y:0,xt=ft?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:De.left+vt,top:De.top+bt,transform:`translate(${vt>.7*_e?"calc(-100% - 12px)":"12px"}, ${.3*Be>bt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},ft):null;if(Pt){const t=rt.current;t&&v&&(t.ingest({inserts:v,bounded:!0}),t.computeScene({width:_e,height:Be}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===L,i=r?De.left+_e/2:De.left,a=r?De.top+Be/2:De.top;return e.createElement("div",{className:"stream-ordinal-frame"+(Ae?" "+Ae:""),role:"img","aria-label":"string"==typeof we?we:"Ordinal chart",style:{position:"relative",width:Ne[0],height:Ne[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ne[0],height:Ne[1],style:{position:"absolute",left:0,top:0}},xe&&e.createElement("g",{transform:`translate(${De.left},${De.top})`},xe),e.createElement("g",{transform:`translate(${i},${a})`},Se&&e.createElement("rect",{x:0,y:0,width:_e,height:Be,fill:Se}),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":return e.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"point":return e.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",opacity:null!==(o=t.style.opacity)&&void 0!==o?o:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"wedge":{const n=t,o=re().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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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:n.style.fill||"#4e79a7",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});default:return null}}(t,n)).filter(Boolean))),e.createElement(ur,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:o,showAxes:ee,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,showGrid:he,title:we,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,foregroundGraphics:He,annotations:ue,svgAnnotationRules:de,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==t?void 0:t.getData()}),Ee&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:De.left+_e/2,top:De.top+Be/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ee))}return e.createElement("div",{ref:Ce,className:"stream-ordinal-frame"+(Ae?" "+Ae:""),role:"img","aria-label":"string"==typeof we?we:"Ordinal chart",tabIndex:0,style:{position:"relative",width:j?"100%":Ne[0],height:C?"100%":Ne[1],overflow:"visible"},onMouseMove:Qe?pt:void 0,onMouseLeave:Qe?ht:void 0,onKeyDown:yt},xe&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ne[0],height:Ne[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${De.left},${De.top})`},xe)),e.createElement(lr,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:Ye,showAxes:ee,showGrid:he,rFormat:ie}),e.createElement("canvas",{ref:We,"aria-label":Mt(null!==(h=null===(d=rt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],f+" chart"),style:{position:"absolute",top:0,left:0,width:Ne[0],height:Ne[1]}}),e.createElement(Dt,{hoverPoint:Fe}),je&&e.createElement(Ct,{scene:null!==(y=null===(g=rt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:f+" chart"}),e.createElement(ur,{width:_e,height:Be,totalWidth:Ne[0],totalHeight:Ne[1],margin:De,scales:Ye,showAxes:ee,oLabel:te,rLabel:ne,oFormat:oe,rFormat:ie,showGrid:he,title:we,legend:ge,legendHoverBehavior:ye,legendClickBehavior:pe,legendHighlightedCategory:fe,legendIsolatedCategories:me,legendPosition:be,foregroundGraphics:He,annotations:ue,svgAnnotationRules:de,annotationFrame:Xe,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(p=rt.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),Ee&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:De.left+_e/2,top:De.top+Be/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ee),(null==Me?void 0:Me.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Me.badgePosition?{top:4,left:4}:"bottom-left"===Me.badgePosition?{bottom:4,left:4}:"bottom-right"===Me.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ue?"#dc3545":"#28a745",color:"white"})},Ue?"STALE":"LIVE"),xt)});xr.displayName="StreamOrdinalFrame";const kr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",sort:m=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Io({data:W,rawData:s,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:S,chartType:"BarChart",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;Co("BarChart",W,"categoryAccessor",d),Co("BarChart",W,"valueAccessor",h);const I=Wn(W,m,h),$=r(()=>e=>{const t={};return t.fill=p?Be(e,p,T.colorScale):_n,t},[p,T.colorScale]),z=r(()=>Dn($,T.effectiveSelectionHook,w),[$,T.effectiveSelectionHook,w]),R=r(()=>Jn({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),F=ao({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return e.createElement(eo,{componentName:"BarChart",message:F,width:j,height:C});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:I}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:z,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:v,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:y,showGrid:D,oSort:m}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||R}),(A||S)&&{customHoverBehavior:T.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(Oo,{componentName:"BarChart",width:j,height:C},e.createElement(xr,Object.assign({ref:a},G)))});kr.displayName="BarChart";const wr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",stackBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:f,colorBy:m,colorScheme:v="category10",normalize:b=!1,barPadding:x=40,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=i.width,D=i.height,_=i.enableHover,B=i.showGrid,H=i.showLegend,W=i.title,T=i.categoryLabel,I=i.valueLabel,$=l||[],z=m||g,R=Wo({isPushMode:void 0===l,colorBy:z,colorScheme:v,showLegend:H,legendPosition:C}),F=s(R.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[R.wrapPush]),G=s(R.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[R.wrapPushMany]);u(o,()=>({push:F,pushMany:G,clear:()=>{var e;R.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:[]}}),[F,G,R.resetCategories]);const Y=Io({data:$,rawData:l,colorBy:z,colorScheme:v,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:O,chartType:"StackedBarChart",chartId:P,showLegend:H,userMargin:c,marginDefaults:i.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;const q=r(()=>e=>z?Y.colorScale?{fill:Be(e,z,Y.colorScale)}:{}:{fill:_n},[z,Y.colorScale]),X=r(()=>Dn(q,Y.effectiveSelectionHook,S),[q,Y.effectiveSelectionHook,S]),V=r(()=>Jn({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),U=ao({componentName:"StackedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{stackBy:g}});if(U)return e.createElement(eo,{componentName:"StackedBarChart",message:U,width:N,height:D});const K=r(()=>R.streamingLegend?Object.assign(Object.assign({},Y.legendBehaviorProps),{legend:R.streamingLegend,legendPosition:C||Y.legendPosition}):Y.legendBehaviorProps,[Y.legendBehaviorProps,Y.legendPosition,R.streamingLegend,C]),Q=r(()=>{if(R.streamingMarginAdjust){const e=Object.assign({},Y.margin);for(const[t,n]of Object.entries(R.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Y.margin},[Y.margin,R.streamingMarginAdjust]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:$}),{oAccessor:h,rAccessor:y,stackBy:g,normalize:b,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:X,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,barPadding:x,enableHover:_,showAxes:i.showAxes,oLabel:T,rLabel:I,rFormat:f,showGrid:B}),K),W&&{title:W}),d&&{className:d}),{tooltipContent:!1===k?()=>null:Vn(k)||V}),(E||O)&&{customHoverBehavior:Y.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(Oo,{componentName:"StackedBarChart",width:N,height:D},e.createElement(xr,Object.assign({ref:a},Z)))});wr.displayName="StackedBarChart";const Ar=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",groupBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:f,colorBy:m,colorScheme:v="category10",barPadding:b=60,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:E,chartId:O,loading:P,emptyContent:L,legendInteraction:M,legendPosition:j}=n,C=i.width,N=i.height,D=i.enableHover,_=i.showGrid,B=i.showLegend,H=i.title,W=i.categoryLabel,T=i.valueLabel,I=l||[],$=m||g,z=Wo({isPushMode:void 0===l,colorBy:$,colorScheme:v,showLegend:B,legendPosition:j}),R=s(z.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),F=s(z.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);u(o,()=>({push:R,pushMany:F,clear:()=>{var e;z.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:[]}}),[R,F,z.resetCategories]);const G=Io({data:I,rawData:l,colorBy:$,colorScheme:v,legendInteraction:M,legendPosition:j,selection:A,linkedHover:S,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:E,chartType:"GroupedBarChart",chartId:O,showLegend:B,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:C,height:N});if(G.earlyReturn)return G.earlyReturn;const Y=r(()=>e=>$?G.colorScale?{fill:Be(e,$,G.colorScale)}:{}:{fill:_n},[$,G.colorScale]),q=r(()=>Dn(Y,G.effectiveSelectionHook,A),[Y,G.effectiveSelectionHook,A]),X=r(()=>Jn({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),V=ao({componentName:"GroupedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{groupBy:g}});if(V)return e.createElement(eo,{componentName:"GroupedBarChart",message:V,width:C,height:N});const U=r(()=>z.streamingLegend?Object.assign(Object.assign({},G.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:j||G.legendPosition}):G.legendBehaviorProps,[G.legendBehaviorProps,G.legendPosition,z.streamingLegend,j]),K=r(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},G.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return G.margin},[G.margin,z.streamingMarginAdjust]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=l&&{data:I}),{oAccessor:h,rAccessor:y,groupBy:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:q,size:[C,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,barPadding:b,enableHover:D,showAxes:i.showAxes,oLabel:W,rLabel:T,rFormat:f,showGrid:_}),U),H&&{title:H}),d&&{className:d}),{tooltipContent:!1===x?()=>null:Vn(x)||X}),(S||E)&&{customHoverBehavior:G.customHoverBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(Oo,{componentName:"GroupedBarChart",width:C,height:N},e.createElement(xr,Object.assign({ref:a},Q)))});Ar.displayName="GroupedBarChart";const Sr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,frameProps:S={},selection:E,linkedHover:O,onObservation:P,chartId:L,loading:M,emptyContent:j,legendInteraction:C,legendPosition:N}=n,D=i.width,_=i.height,B=i.enableHover,H=i.showGrid,W=i.title,T=i.categoryLabel,I=i.valueLabel,$=s||[],z=Io({data:$,rawData:s,colorBy:p,colorScheme:f,legendInteraction:C,legendPosition:N,selection:E,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,chartType:"SwarmPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:j,width:D,height:_});if(z.earlyReturn)return z.earlyReturn;const R=r(()=>{if(!m)return;const e=$.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[$,m]),F=r(()=>e=>{const t={fillOpacity:x};return t.fill=p?Be(e,p,z.colorScale):_n,t.r=m?We(e,m,v,R):b,t},[p,z.colorScale,m,v,R,b,x]),G=r(()=>Dn(F,z.effectiveSelectionHook,E),[F,z.effectiveSelectionHook,E]),Y=r(()=>Jn({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),q=ao({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(q)return e.createElement(eo,{componentName:"SwarmPlot",message:q,width:D,height:_});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:$}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:G,size:[D,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:k,enableHover:B,showAxes:i.showAxes,oLabel:T,rLabel:I,rFormat:y,showGrid:H}),z.legendBehaviorProps),W&&{title:W}),c&&{className:c}),{tooltipContent:!1===w?()=>null:Vn(w)||Y}),(O||P)&&{customHoverBehavior:z.customHoverBehavior}),A&&A.length>0&&{annotations:A}),S);return e.createElement(Oo,{componentName:"SwarmPlot",width:D,height:_},e.createElement(xr,Object.assign({ref:a},X)))});Sr.displayName="SwarmPlot";const Er=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y,colorBy:p,colorScheme:f="category10",showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Io({data:W,rawData:s,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"BoxPlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;const I=r(()=>e=>{const t=p?Be(e,p,T.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.8}},[p,T.colorScale]),$=r(()=>Dn(I,T.effectiveSelectionHook,w),[I,T.effectiveSelectionHook,w]),z=r(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||(t.data||t).category||"")+""),null!=n.median&&e.createElement(e.Fragment,null,null!=n.n&&e.createElement("div",null,"n = ",n.n),e.createElement("div",null,"Median: ",n.median.toLocaleString()),e.createElement("div",null,"Q1: ",n.q1.toLocaleString()),e.createElement("div",null,"Q3: ",n.q3.toLocaleString()),e.createElement("div",null,"Min: ",n.min.toLocaleString()),e.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),R=ao({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(R)return e.createElement(eo,{componentName:"BoxPlot",message:R,width:j,height:C});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:$,showOutliers:m,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:v,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:y,showGrid:D}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||z}),(A||S)&&{customHoverBehavior:T.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(Oo,{componentName:"BoxPlot",width:j,height:C},e.createElement(xr,Object.assign({ref:a},F)))});Er.displayName="BoxPlot";const Or=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y=!1,valueFormat:p,colorBy:f,colorScheme:m="category10",categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendPosition:L}=n,M=i.width,j=i.height,C=i.enableHover,N=i.showGrid,D=i.title,_=i.categoryLabel,B=i.valueLabel,H=s||[],W=Io({data:H,rawData:s,colorBy:f,colorScheme:m,legendInteraction:void 0,legendPosition:L,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"Histogram",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:M,height:j});if(W.earlyReturn)return W.earlyReturn;const T=r(()=>e=>{const t=f?Be(e,f,W.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.8}},[f,W.colorScale]),I=r(()=>Dn(T,W.activeSelectionHook,w),[T,W.activeSelectionHook,w]),$=r(()=>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:Fn},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)))},[]),z=ao({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(z)return e.createElement(eo,{componentName:"Histogram",message:z,width:M,height:j});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:H}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:I,bins:g,normalize:y,size:[M,j],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:v,enableHover:C,showAxes:i.showAxes,oLabel:_,rLabel:B,rFormat:p,showGrid:N}),W.legendBehaviorProps),D&&{title:D}),c&&{className:c}),{tooltipContent:!1===b?()=>null:Vn(b)||$}),(A||S)&&{customHoverBehavior:W.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(Oo,{componentName:"Histogram",width:M,height:j},e.createElement(xr,Object.assign({ref:a},R)))});Or.displayName="Histogram";const Pr=c(function(n,o){const i=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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:y=25,showIQR:p=!0,valueFormat:f,colorBy:m,colorScheme:v="category10",categoryPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:E,chartId:O,loading:P,emptyContent:L,legendPosition:M}=n,j=i.width,C=i.height,N=i.enableHover,D=i.showGrid,_=i.title,B=i.categoryLabel,H=i.valueLabel,W=s||[],T=Io({data:W,rawData:s,colorBy:m,colorScheme:v,legendInteraction:void 0,legendPosition:M,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,chartType:"ViolinPlot",chartId:O,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:j,height:C});if(T.earlyReturn)return T.earlyReturn;const I=r(()=>e=>{const t=m?Be(e,m,T.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.6}},[m,T.colorScale]),$=r(()=>Dn(I,T.activeSelectionHook,A),[I,T.activeSelectionHook,A]),z=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;if(r)return e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(t.data)?t.data:[]).map(e=>{const t="function"==typeof h?h(e):e[h];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),a=i.length,s=a>0?i[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[h]),R=ao({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(R)return e.createElement(eo,{componentName:"ViolinPlot",message:R,width:j,height:C});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:$,bins:y,showIQR:p,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:T.margin,barPadding:b,enableHover:N,showAxes:i.showAxes,oLabel:B,rLabel:H,rFormat:f,showGrid:D}),T.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===x?()=>null:Vn(x)||z}),(S||E)&&{customHoverBehavior:T.customHoverBehavior}),k&&k.length>0&&{annotations:k}),w);return e.createElement(Oo,{componentName:"ViolinPlot",width:j,height:C},e.createElement(xr,Object.assign({ref:a},F)))});Pr.displayName="ViolinPlot";const Lr=c(function(n,o){var i;const a=Rn(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),s=t(null);u(o,()=>({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:y="horizontal",valueFormat:p,colorBy:f,colorScheme:m="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=a.width,D=a.height,_=a.enableHover,B=a.showGrid,H=a.title,W=a.categoryLabel,T=a.valueLabel,I=l||[],$=Io({data:I,rawData:l,colorBy:f,colorScheme:m,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if($.earlyReturn)return $.earlyReturn;const z=Wn(I,v,g),R=r(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=f?Be(e,f,$.colorScale):_n,t},[f,$.colorScale,b]),F=r(()=>Dn(R,$.effectiveSelectionHook,S),[R,$.effectiveSelectionHook,S]),G=r(()=>Jn({categoryAccessor:h,valueAccessor:g}),[h,g]),Y=ao({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(Y)return e.createElement(eo,{componentName:"DotPlot",message:Y,width:N,height:D});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:z}),{oAccessor:h,rAccessor:g,projection:"horizontal"===y?"horizontal":"vertical",pieceStyle:F,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:$.margin,barPadding:x,enableHover:_,showAxes:a.showAxes,oLabel:W,rLabel:T,rFormat:p,showGrid:B,oSort:v}),$.legendBehaviorProps),H&&{title:H}),d&&{className:d}),{tooltipContent:!1===k?()=>null:Vn(k)||G}),(E||O)&&{customHoverBehavior:$.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(Oo,{componentName:"DotPlot",width:N,height:D},e.createElement(xr,Object.assign({ref:s},q)))});function Mr(t){const n=Rn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:k,chartId:w,loading:A,emptyContent:S,legendPosition:E}=t,O=n.width,P=n.height,L=n.enableHover,M=n.showGrid,j=n.title,C=n.categoryLabel,N=n.valueLabel,D=o||[],_=Io({data:D,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:E,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:k,chartType:"RidgelinePlot",chartId:w,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:A,emptyContent:S,width:O,height:P});if(_.earlyReturn)return _.earlyReturn;const B=r(()=>e=>{const t=g?Be(e,g,_.colorScale):_n;return{fill:t,stroke:t,fillOpacity:.5}},[g,_.colorScale]),H=r(()=>Dn(B,_.activeSelectionHook,b),[B,_.activeSelectionHook,b]),W=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;return r?e.createElement("div",{className:"semiotic-tooltip",style:Fn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:Fn},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),T=ao({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:s,valueAccessor:l}});if(T)return e.createElement(eo,{componentName:"RidgelinePlot",message:T,width:O,height:P});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:D}),{oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:H,bins:u,size:[O,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_.margin,barPadding:p,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:N,rFormat:h,showGrid:M,oSort:!1,amplitude:d}),_.legendBehaviorProps),j&&{title:j}),a&&{className:a}),{tooltipContent:!1===f?()=>null:Vn(f)||W}),(x||k)&&{customHoverBehavior:_.customHoverBehavior}),m&&m.length>0&&{annotations:m}),v);return e.createElement(Oo,{componentName:"RidgelinePlot",width:O,height:P},e.createElement(xr,Object.assign({},I)))}Lr.displayName="DotPlot",Mr.displayName="RidgelinePlot";const jr=c(function(n,o){var i,a;const l=Rn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",colorBy:f,colorScheme:m="category10",startAngle:v=0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,chartId:E,loading:O,emptyContent:P,legendInteraction:L,legendPosition:M}=n,j=l.width,C=l.height,N=l.enableHover,D=l.showLegend,_=l.title,B=d||[],H=f||y,W=Wo({isPushMode:void 0===d,colorBy:H,colorScheme:m,showLegend:D,legendPosition:M}),T=s(W.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[W.wrapPush]),I=s(W.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[W.wrapPushMany]);u(o,()=>({push:T,pushMany:I,clear:()=>{var e;W.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[T,I,W.resetCategories]);const $=Io({data:B,rawData:d,colorBy:H,colorScheme:m,legendInteraction:L,legendPosition:M,selection:w,linkedHover:A,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:S,chartType:"PieChart",chartId:E,showLegend:D,userMargin:h,marginDefaults:l.marginDefaults,loading:O,emptyContent:P,width:j,height:C});if($.earlyReturn)return $.earlyReturn;const z=r(()=>e=>H?$.colorScale?{fill:Be(e,H,$.colorScale)}:{}:{fill:_n},[H,$.colorScale]),R=r(()=>Dn(z,$.effectiveSelectionHook,w),[z,$.effectiveSelectionHook,w]),F=r(()=>Jn({categoryAccessor:y,valueAccessor:p,groupAccessor:f&&f!==y?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[y,p,f]),G=ao({componentName:"PieChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(G)return e.createElement(eo,{componentName:"PieChart",message:G,width:j,height:C});const Y=r(()=>W.streamingLegend?Object.assign(Object.assign({},$.legendBehaviorProps),{legend:W.streamingLegend,legendPosition:M||$.legendPosition}):$.legendBehaviorProps,[$.legendBehaviorProps,$.legendPosition,W.streamingLegend,M]),q=r(()=>{if(W.streamingMarginAdjust){const e=Object.assign({},$.margin);for(const[t,n]of Object.entries(W.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return $.margin},[$.margin,W.streamingMarginAdjust]),X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=d&&{data:B}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:R,startAngle:v,size:[j,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q,enableHover:N,showAxes:!1}),Y),_&&{title:_}),g&&{className:g}),{tooltipContent:!1===b?()=>null:Vn(b)||F}),(A||S)&&{customHoverBehavior:$.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return e.createElement(Oo,{componentName:"PieChart",width:j,height:C},e.createElement(xr,Object.assign({ref:c},X)))});jr.displayName="PieChart";const Cr=c(function(n,o){var i,a;const l=Rn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,linkedHover:n.linkedHover}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",innerRadius:f=60,centerContent:m,colorBy:v,colorScheme:b="category10",startAngle:x=0,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:P,loading:L,emptyContent:M,legendInteraction:j,legendPosition:C}=n,N=l.width,D=l.height,_=l.enableHover,B=l.showLegend,H=l.title,W=d||[],T=v||y,I=Wo({isPushMode:void 0===d,colorBy:T,colorScheme:b,showLegend:B,legendPosition:C}),$=s(I.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[I.wrapPush]),z=s(I.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[I.wrapPushMany]);u(o,()=>({push:$,pushMany:z,clear:()=>{var e;I.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[$,z,I.resetCategories]);const R=Io({data:W,rawData:d,colorBy:T,colorScheme:b,legendInteraction:j,legendPosition:C,selection:S,linkedHover:E,fallbackFields:T?["string"==typeof T?T:""]:[],unwrapData:!0,onObservation:O,chartType:"DonutChart",chartId:P,showLegend:B,userMargin:h,marginDefaults:l.marginDefaults,loading:L,emptyContent:M,width:N,height:D});if(R.earlyReturn)return R.earlyReturn;const F=r(()=>e=>T?R.colorScale?{fill:Be(e,T,R.colorScale)}:{}:{fill:_n},[T,R.colorScale]),G=r(()=>Dn(F,R.effectiveSelectionHook,S),[F,R.effectiveSelectionHook,S]),Y=r(()=>Jn({categoryAccessor:y,valueAccessor:p,groupAccessor:v&&v!==y?v:void 0,groupLabel:"string"==typeof v?v:"group",pieData:!0}),[y,p,v]),q=ao({componentName:"DonutChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(q)return e.createElement(eo,{componentName:"DonutChart",message:q,width:N,height:D});const X=r(()=>I.streamingLegend?Object.assign(Object.assign({},R.legendBehaviorProps),{legend:I.streamingLegend,legendPosition:C||R.legendPosition}):R.legendBehaviorProps,[R.legendBehaviorProps,R.legendPosition,I.streamingLegend,C]),V=r(()=>{if(I.streamingMarginAdjust){const e=Object.assign({},R.margin);for(const[t,n]of Object.entries(I.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return R.margin},[R.margin,I.streamingMarginAdjust]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=d&&{data:W}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:G,innerRadius:f,startAngle:x,centerContent:m,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,enableHover:_,showAxes:!1}),X),H&&{title:H}),g&&{className:g}),{tooltipContent:!1===k?()=>null:Vn(k)||Y}),(E||O)&&{customHoverBehavior:R.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(Oo,{componentName:"DonutChart",width:N,height:D},e.createElement(xr,Object.assign({ref:c},U)))});Cr.displayName="DonutChart";const Nr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Dr={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class _r{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=Br(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 Br(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=Hr(l,c,u,d,s),g=d.x-l.x,y=d.y-l.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;h.x+=-y/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=Hr(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 Hr(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 Wr(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Tr(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 y=i[t];g.length>y;++y){var p=g[y];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]=y}else{if(o[t]===n[t]){var f=[],m=[],v=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(r[b]=!1,f.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=y;break}}d.push(f);var x=Array(v);for(y=0;m.length>y;y++)for(var k=0;m[y].length>k;k++)x[--v]=m[y][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 y=h[l];if(0!==y.length){y.sort(function(e,t){return e-t}),c=[y[0]];for(var p=1;y.length>p;p++)y[p]!==y[p-1]&&c.push(y[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 y=0;s.length>y;y++)for(var p=0;s[y].length>p;p++){var f=s[y][p];i[+f]=!1,a[f]={}}c(n),n+=1}else n=h}return o}function Ir(e){return e.y0-e.y1>0?"up":"down"}function $r(e,t){return t(e.source)==t(e.target)}function zr(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 Rr(e){return e.target.x0-e.source.x1}function Fr(e,t){var n=Yr(e),o=Rr(t)/Math.tan(n);return"up"==Ir(e)?e.y1-o:e.y1+o}function Gr(e,t){var n=Yr(e),o=Rr(t)/Math.tan(n);return"up"==Ir(e)?e.y1+o:e.y1-o}function Yr(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function qr(e,t){return t(e)}function Xr(e){return Ur(e.source)}function Vr(e){return Ur(e.target)}function Ur(e){return(e.y0+e.y1)/2}function Kr(e){return e.virtual?0:e.value}function Qr(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!$r(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!$r(e,t)?o+1:o}),n+o}function Zr(e){return e.target.depth}function Jr(e,t){return e.sourceLinks.length?e.depth:t-1}function ei(e,t){return e.y0-t.y0}function ti(e,t){return t.y0-e.y0}function ni(e,t){return e.y1-t.y1}function oi(e,t){return t.y1-e.y1}function ri(e,t){return ai(e.source,t.source)||e.index-t.index}function ii(e,t){return ai(e.target,t.target)||e.index-t.index}function ai(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function si(e,t){return li(e)==li(t)?"bottom"==e.circularLinkType?ti(e,t):ei(e,t):li(t)-li(e)}function li(e){return e.target.column-e.source.column}function ci(e,t){return ui(e)==ui(t)}function ui(e){return e.y0-e.y1>0?"up":"down"}function di(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=_(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}),hi(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),hi(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,$r(e,t)&&zr(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?ti:ei);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?oi:ni),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 hi(e,t,n){e.sort(si);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($r(e,t)&&zr(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&&gi(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 gi(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function yi(e){return function(){return e}}function pi(e){return e.index}function fi(e){return e.nodes}function mi(e){return e.links}function vi(e,t,n){var o=B(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+=Ur(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Ur(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?Qr(t,n)-Qr(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==Qr(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 bi(e,t,n,o,r,i){var a=B(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&&Qr(r,n)>0){var l=T(r.sourceLinks,Vr),c=T(r.targetLinks,Xr),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Ur(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=T(r.sourceLinks,Vr),g=T(r.targetLinks,Xr),y=((h&&g?(h+g)/2:h||g)-Ur(r))*t;r.y0+=y,r.y1+=y}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||ai),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 xi(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ii),e.targetLinks.sort(ri)}),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 ki(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=pi,l=Jr,c=void 0,u=32,d=2,h=fi,g=mi;function y(){var y={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 I(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=Wr(n,o)),"object"!=typeof r&&(r=e.target=Wr(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=Tr(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){qr(e,t)!=qr(r.source,t)&&qr(e,t)!=qr(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),$r(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(W(e.sourceLinks,Kr),W(e.targetLinks,Kr)),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 y=B(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=H(y,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=B(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=_(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/W(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),vi(h,c,s),bi(h,c,s,g,g,u),xi(h),di(h,s,d,10,8),vi(h,c,s),bi(h,c,s,g,g,u),xi(h),di(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 qr(n.source,t)==qr(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(!ci(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Fr(t,e);return e.y1-n}if(t.target.column>e.target.column)return Fr(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 qr(n.target,t)==qr(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(!ci(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Gr(t,e);return e.y0-n}if(t.source.column>e.source.column)return Gr(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=_(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),di(h,s,d,10,8)}(y),y}return y.update=function(e){return xi(e),di(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(r=+e,y):r},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:yi(e),y):h},y.links=function(e){return arguments.length?(g="function"==typeof e?e:yi(e),y):g},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:yi(e),y):s},y.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:yi(e),y):l},y.nodeSort=function(e){return arguments.length?(c=e,y):c},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],y):[[e,t],[n,o]]},y.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],y):[n-e,o-t]},y}const wi=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.y1,a=e.target.y0,s=ce(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=ce(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 Ai(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 Si={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(Zr))-1:0},justify:Jr},Ei={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,y=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,f=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=ki().extent(v).links(m).nodes(f).nodeAlign(Si[h]||Jr).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(y),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of f)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 f)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 f){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(`${"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(`${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:j,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const p=[],f=[],m=[];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(t):{},r={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};p.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const v=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of v){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";u?o=u(e).fill||o:"target"===h&&n?o=y.get(n.id)||o:t&&(o=y.get(t.id)||o);const r=u?u(e):{};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;f.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}}),f.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?Ai(e):wi(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};f.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(b=n.nodeLabel)?"function"==typeof b?b:e=>e[b]||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.x0+e/2,s=n.y1+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 b;return{sceneNodes:p,sceneEdges:f,labels:m}}},Oi={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=Pi(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=Li(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=Li(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)))),y=h?40:g,p=Mi(n.nodeSize,n.nodeSizeRange,e),f=e=>p(e),m=ue().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),v=de().force("charge",he().strength(e=>-25*f(e))).force("center",ge(s,l).strength(.8)).force("x",ye(s).strength(.15)).force("y",pe(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;y>e;++e)v.tick();for(const t of e){if(null==t.x||null==t.y)continue;const e=f(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=Mi(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:j,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=s?s(t):{},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(e):{},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=(f=n.nodeLabel)?"function"==typeof f?f:e=>e[f]||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(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:h,sceneEdges:g,labels:y}}};function Pi(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 Li(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 Mi(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=_(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 ji=j,Ci={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 y=e.length,p=Array.from({length:y},()=>Array.from({length:y},()=>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 f=me().padAngle(r);a&&f.sortGroups(a);const m=f(p),v=m.groups,b=re().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,y=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:ji,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const m=fe().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(n).fill||f.get(n.id)||p[t%p.length]:f.get(n.id)||p[t%p.length];const a=h?h(n):{},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=Ni(n,u,d);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=f.get(n.id)||r:t&&(r=f.get(t.id)||r)}const a=g?g(e):{},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 Ni(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(" ")}function Di(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"}const _i={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=z(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=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"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=q();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=G().size([n,o]).tile(Y).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;F().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 y=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:Ii(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?Bi(i,o,n):"treemap"===a||"partition"===a?Hi(i,o):"circlepack"===a&&Wi(i,o),i.__hierarchyNode=o,e.push(i),y.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.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=[],y=n.treeOrientation||"vertical",p="radial"===y,f=o[0]/2,m=o[1]/2,v="number"==typeof(x=n.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const t of e){let e=t.x,o=t.y;p&&(e+=f,o+=m);const i=r(t);let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=b[t.depth%b.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 k=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+=f,r+=m,a+=f,s+=m);const u=Ti(o,r,a,s,y),d=i(e),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:k};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=$i(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+=f,s+=m),p){const e=a-f,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"===y?((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=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];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(n);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,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:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=$i(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const d=!((null===(i=c.data)||void 0===i?void 0:i.children)&&c.data.children.length>0);if(!a){if("leaf"===r&&!d)continue;if("parent"===r&&d)continue}const h=n?n(c):c.id;if(!h)continue;if((d?30:40)>e||(d?16:14)>u)continue;let g=o(c).fill||"#4d430c";t.colorByDepth&&void 0!==c.depth&&(g=l[c.depth%l.length]);const y=Di(g);s.push(d?{x:c.x0+e/2,y:c.y0+u/2,text:h+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:h+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}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=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(n);let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.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=$i(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(r).fill||"#4d430c";if(t.colorByDepth&&void 0!==r.depth&&(c=d[r.depth%d.length]),a){const t=Di(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 Bi(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 Hi(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 Wi(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 Ti(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}`}}function Ii(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 $i(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 zi(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const Ri={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,y=zi(n);y.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function f(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=f(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}),y.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},E=p?u/h(S)*A:u*A,O=se().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),P=O(k),L=g(S);for(let t=0;k.length>t;t++){const s=(P[t].startAngle+P[t].endAngle)/2,c=k[t],u=f(l(c)),h=i+E*Math.sin(s),g=a+E*Math.cos(s)*L;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}),y.metaMap.set(u,{ring:E,angle:s,depth:d,parentId:n,eccentricity:L}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,E,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=[],y=[];if(!1!==n.orbitShowRings){const t=zi(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(t),n=c?c(t):{},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(n);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;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:y}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=zi(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:Ei,force:Oi,chord:Ci,tree:_i,cluster:_i,treemap:_i,circlepack:_i,partition:_i,orbit:Ri};function Gi(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({},Nr),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new _r(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({},Nr),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new _r(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({},qi(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},qi(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},qi(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}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,qi(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,qi(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange):(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||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=Gi(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(const e of c)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}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=Gi(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=Gi(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Gi(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=Ie(e,this.transition),n=Te(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=$e(e._prevX0,e._targetX0,n),e.x1=$e(e._prevX1,e._targetX1,n),e.y0=$e(e._prevY0,e._targetY0,n),e.y1=$e(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=$e(e._prevY0,e._targetY0,n),e.y1=$e(e._prevY1,e._targetY1,n),e.sankeyWidth=$e(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.y1,i=n.y0,a=ce(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=ce(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 qi(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 Xi(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=Vi(t,n,o);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=Zi(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function Vi(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){const o=Fe(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=Ge(Math.atan2(r,o)),s=Ge(e.startAngle),l=Ge(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 Ui=null,Ki=null;function Qi(){return Ki||(Ui=document.createElement("canvas"),Ui.width=1,Ui.height=1,Ki=Ui.getContext("2d")),Ki}function Zi(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=Qi();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=Qi();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 Ji(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:y="right",foregroundGraphics:p,sceneNodes:f,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:f});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,ct({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:y,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&f).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=f.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 y=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:y+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function ea(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=t.style.fill;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 ta(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 na(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 oa(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()}Ji.displayName="NetworkSVGOverlay";const ra={top:20,right:80,bottom:20,left:80},ia={top:40,right:40,bottom:40,left:40},aa=new Set(["chord","force","circlepack","orbit"]),sa=[800,600],la={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 ca({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:la},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:la},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:la},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 ua=c(function(i,a){var l,c,d,h,g,y,p,f,m,v,b;const{chartType:x,nodes:k,edges:w,data:A,initialEdges:S,nodeIDAccessor:E="id",sourceAccessor:O="source",targetAccessor:P="target",valueAccessor:L="value",childrenAccessor:M,hierarchySum:j,orientation:C="horizontal",nodeAlign:N="justify",nodePaddingRatio:D=.05,nodeWidth:_=15,iterations:B=300,forceStrength:H=.1,padAngle:W=.01,groupWidth:T=20,sortGroups:I,edgeSort:$,treeOrientation:z="vertical",edgeType:R="curve",padding:F,paddingTop:G,tensionConfig:Y,showParticles:q=!1,particleStyle:X,nodeStyle:V,edgeStyle:U,colorBy:K,colorScheme:Q="category10",edgeColorBy:Z="source",edgeOpacity:J=.5,colorByDepth:ee=!1,nodeSize:te=8,nodeSizeRange:ne=[5,20],nodeLabel:oe,showLabels:ie=!0,labelMode:ae,size:se=sa,responsiveWidth:le,responsiveHeight:ce,margin:ue,className:de,background:he,enableHover:ge=!0,tooltipContent:ye,customHoverBehavior:pe,customClickBehavior:fe,onObservation:me,chartId:ve,onTopologyChange:be,annotations:xe,svgAnnotationRules:ke,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,title:Le,foregroundGraphics:Me,backgroundGraphics:je,decay:Ne,pulse:De,staleness:_e,thresholds:Be,accessibleTable:He,orbitMode:We,orbitSize:Te,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:ze,orbitEccentricity:Re,orbitShowRings:Fe,orbitAnimated:Ge}=i,Ye=aa.has(x)?ia:ra,[qe,Xe]=tt(se,le,ce),Ve=Object.assign(Object.assign({},Ye),ue),Ue=Xe[0]-Ve.left-Ve.right,Ke=Xe[1]-Ve.top-Ve.bottom,Qe="function"==typeof Me?Me({size:Xe,margin:Ve}):Me,Ze=r(()=>Object.assign(Object.assign({},Nr),Y),[Y]),et=r(()=>Object.assign(Object.assign({},Dr),X),[X]),ot=r(()=>({chartType:x,nodeIDAccessor:E,sourceAccessor:O,targetAccessor:P,valueAccessor:L,childrenAccessor:M,hierarchySum:j,orientation:C,nodeAlign:N,nodePaddingRatio:D,nodeWidth:_,iterations:B,forceStrength:H,padAngle:W,groupWidth:T,sortGroups:I,edgeSort:$,treeOrientation:z,edgeType:R,padding:F,paddingTop:G,tensionConfig:Ze,showParticles:q,particleStyle:et,nodeStyle:V,edgeStyle:U,nodeLabel:oe,showLabels:ie,labelMode:ae,colorBy:K,colorScheme:Q,edgeColorBy:Z,edgeOpacity:J,colorByDepth:ee,nodeSize:te,nodeSizeRange:ne,decay:Ne,pulse:De,staleness:_e,thresholds:Be,orbitMode:We,orbitSize:Te,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:ze,orbitEccentricity:Re,orbitShowRings:Fe,orbitAnimated:Ge}),[x,E,O,P,L,M,j,C,N,D,_,B,H,W,T,I,$,z,R,F,G,Ze,q,et,V,U,oe,ie,ae,K,Q,Z,J,ee,te,ne,Ne,De,_e,Be,We,Te,Ie,$e,ze,Re,Fe,Ge]),rt=t(null),it=t(0),at=t(0),st=t(!0),lt=It(e=>e.theme),ct=t(()=>{}),ut=t(null);ut.current||(ut.current=new Yi(ot));const[dt,ht]=n(null),[gt,yt]=n(0),[pt,ft]=n(0),[mt,vt]=n(!1),bt=t(null),xt=t(new Map),kt=t(0),wt=s(e=>{if("function"==typeof K)return K(e)+"";if("string"==typeof K&&e.data){const t=e.data[K];if(void 0!==t){if(!xt.current.has(t+"")){const e=Array.isArray(Q)?Q:Ce;xt.current.set(t+"",e[kt.current++%e.length])}return xt.current.get(t+"")}}if(!xt.current.has(e.id)){const t=Array.isArray(Q)?Q:Ce;xt.current.set(e.id,t[kt.current++%t.length])}return xt.current.get(e.id)},[K,Q]),At=s(e=>{if("function"==typeof Z)return Z(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===Z&&n?wt(n):t?wt(t):"#999"},[Z,wt]),St=s(e=>{if(!(null==X?void 0:X.colorBy))return At(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===et.colorBy&&n?wt(n):t?wt(t):"#999"},[null==X?void 0:X.colorBy,et.colorBy,wt,At]),Et="sankey"===x&&q||!!De||null!==(c=null===(l=ut.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c,Ot=s(()=>{it.current&&!Et||it.current||(it.current=requestAnimationFrame(()=>ct.current()))},[Et]);o(()=>{var e;null===(e=ut.current)||void 0===e||e.updateConfig(ot),st.current=!0,Ot()},[ot,Ot]),o(()=>{st.current=!0,Ot()},[lt,Ot]);const Lt=s(()=>{const e=ut.current;if(!e)return;e.runLayout([Ue,Ke]),e.buildScene([Ue,Ke]),st.current=!0;const t=Array.isArray(Q)?Q:Ce,n=Array.from(e.nodes.values());for(let e=0;n.length>e;e++){const o=n[e];xt.current.has(o.id)||xt.current.set(o.id,t[e%t.length])}if(kt.current=n.length,yt(e.layoutVersion),be){const{nodes:t,edges:n}=e.getLayoutData();be(t,n)}},[Ue,Ke,be,Q]),Mt=s(e=>{const t=ut.current;t&&(t.ingestEdge(e)&&Lt(),Ot())},[Lt,Ot]),Ct=s(e=>{const t=ut.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Lt(),Ot()},[Lt,Ot]),_t=s(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),xt.current.clear(),kt.current=0,yt(0),ht(null),bt.current=null,st.current=!0,Ot()},[Ot]),Bt=s(()=>{const e=ut.current;e&&(e.tension+=999,Lt(),Ot())},[Lt,Ot]);u(a,()=>({push:Mt,pushMany:Ct,clear:_t,getTopology:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=ut.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:Bt,getTension:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Mt,Ct,_t,Bt]);const Ht=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),Wt=Ht?A||(Array.isArray(w)?void 0:w):void 0;o(()=>{const e=ut.current;if(e)if(Ht&&Wt)e.ingestHierarchy(Wt,[Ue,Ke]),e.buildScene([Ue,Ke]),st.current=!0,Ot();else{const t=k||[],n=Array.isArray(w)?w:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[Ue,Ke]),e.buildScene([Ue,Ke]);const o=Array.isArray(Q)?Q:Ce,r=Array.from(e.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];xt.current.has(t.id)||xt.current.set(t.id,o[e%o.length])}kt.current=r.length,st.current=!0,Ot()}},[k,w,A,Wt,Ht,Ue,Ke,ot,Ot,Q]),o(()=>{S&&S.length>0&&Ct(S)},[]);const Tt=s(e=>{if(pe&&pe(e),me){const t=Date.now();me(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ve}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ve})}},[pe,me,ve]),Rt=s(e=>{if(fe&&fe(e),me){const t=Date.now();me(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ve}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ve})}},[fe,me,ve]),Ft=t(()=>{}),Gt=t(()=>{});Ft.current=e=>{if(!ge)return;const t=rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,r=e.clientY-n.top-Ve.top;if(0>o||o>Ue||0>r||r>Ke)return void(bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot()));const i=ut.current;if(!i)return;const a=Xi(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot()));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});bt.current=l,ht(l),Tt&&(Tt(l),st.current=!0),Ot()},Gt.current=()=>{bt.current&&(bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),Ot())};const Yt=t(()=>{});Yt.current=e=>{if(!fe&&!me)return;const t=rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,r=e.clientY-n.top-Ve.top;if(0>o||o>Ue||0>r||r>Ke)return;const i=ut.current;if(!i)return;const a=Xi(i.sceneNodes,i.sceneEdges,o,r);if(a){const e=a.datum||{};Rt(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 Rt(null)},s(e=>Ft.current(e),[]);const Vt=s(()=>Gt.current(),[]),Ut=s(e=>Yt.current(e),[]),Kt=t(-1),Qt=s(e=>{const t=ut.current;if(!t)return;const n=function(e){const t=[];for(const n of e)"circle"===n.type&&null!=n.cx?t.push({x:n.cx,y:n.cy,datum:n.datum}):"rect"===n.type&&null!=n.x?t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum}):"arc"===n.type&&null!=n.cx&&t.push({x:n.cx,y:n.cy,datum:n.datum});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===n.length)return;const o=Kt.current,r=Je(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Kt.current=-1,bt.current=null,ht(null),Tt&&(Tt(null),st.current=!0),void Ot();const i=0>o?0:r;Kt.current=i;const a=n[i],s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:"node",data:s,x:a.x,y:a.y});bt.current=l,ht(l),Tt&&(Tt(l),st.current=!0),Ot()},[Tt,Ot]),Zt=s(e=>{Kt.current=-1,Ft.current(e)},[]);ct.current=()=>{var e,t,n,o,r,i,a;it.current=0;const s=rt.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=ut.current;if(!c)return;const u=performance.now(),d=at.current?Math.min((u-at.current)/1e3,.1):.016;at.current=u;const h=c.advanceTransition(u),g=c.tickAnimation([Ue,Ke],d);(h||st.current||g)&&c.buildScene([Ue,Ke]);const y=zt();if(!$t(s,Xe,Ve,y))return;l.clearRect(-Ve.left,-Ve.top,Xe[0],Xe[1]),he&&(l.fillStyle=he,l.fillRect(0,0,Ue,Ke)),Ne&&c.applyDecay(),De&&c.applyPulse(u),Be&&c.applyThresholds(u),c.applyTopologyDiff(u);const p=null!==(e=null==_e?void 0:_e.threshold)&&void 0!==e?e:5e3,f=_e&&c.lastIngestTime>0&&u-c.lastIngestTime>p;if(f&&(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":ea(e,n);break;case"line":ta(e,n);break;case"ribbon":na(e,n);break;case"curved":oa(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)),qt(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()),Xt(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),q&&c.particlePool&&!f){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:Dr.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:Dr.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,et);const t=.5*(null!==(n=et.speedMultiplier)&&void 0!==n?n:1);let o;if(et.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:Dr.radius,l=null!==(a=o.opacity)&&void 0!==a?a:Dr.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,et,St)}}f&&(l.globalAlpha=1);const m=st.current;if(st.current=!1,m||h||g){const e=rt.current;e&&e.setAttribute("aria-label",jt(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"))}(m||h||g)&&ft(e=>e+1),(Et||h||g||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(it.current=requestAnimationFrame(()=>ct.current()))},o(()=>(Ot(),()=>{it.current&&(cancelAnimationFrame(it.current),it.current=0)}),[Ot]),o(()=>{st.current=!0,Ot()},[x,Ue,Ke,he,Ot]),nt(_e,ut,st,Ot,mt,vt);const Jt=ge&&dt?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:Ve.left+dt.x,top:Ve.top+dt.y,transform:`translate(${dt.x>.6*Ue?"calc(-100% - 12px)":"12px"}, ${.3*Ke>dt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2,width:"max-content"}},ye?ye(dt):e.createElement(ca,{data:dt})):null;if(Pt){const t=ut.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),n=e?A||(Array.isArray(w)?void 0:w):void 0;if(e&&n)t.ingestHierarchy(n,[Ue,Ke]),t.buildScene([Ue,Ke]);else{const e=k||[],n=Array.isArray(w)?w:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[Ue,Ke]),t.buildScene([Ue,Ke]))}}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"+(de?" "+de:""),role:"img","aria-label":"string"==typeof Le?Le:"Network chart",style:{position:"relative",width:Xe[0],height:Xe[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Xe[0],height:Xe[1],style:{position:"absolute",left:0,top:0}},je&&e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},je),e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},he&&e.createElement("rect",{x:0,y:0,width:Ue,height:Ke,fill:he}),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":case"ribbon":return e.createElement("path",{key:"net-edge-"+n,d:t.pathD,fill:t.style.fill||"#999",fillOpacity:t.style.fillOpacity,stroke:t.style.stroke||"none",strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"curved":return e.createElement("path",{key:"net-edge-"+n,d:t.pathD,fill:t.style.fill||"none",stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":return e.createElement("circle",{key:"net-circle-"+n,cx:t.cx,cy:t.cy,r:t.r,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"rect":return e.createElement("rect",{key:"net-rect-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity});case"arc":{const o=t,r=re().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:o.style.fill||"#4e79a7",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(Ji,{width:Ue,height:Ke,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ve,labels:r,sceneNodes:n,title:Le,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,foregroundGraphics:Qe,annotations:xe,svgAnnotationRules:ke,annotationFrame:0}))}const en=ut.current;return e.createElement("div",{ref:qe,className:"stream-network-frame"+(de?" "+de:""),role:"img","aria-label":"string"==typeof Le?Le:"Network chart",tabIndex:0,style:{position:"relative",width:le?"100%":Xe[0],height:ce?"100%":Xe[1],overflow:"visible"},onMouseMove:ge?Zt:void 0,onMouseLeave:ge?Vt:void 0,onClick:fe||me?Ut:void 0,onKeyDown:Qt},je&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Xe[0],height:Xe[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},je)),e.createElement("canvas",{ref:rt,"aria-label":jt(null!==(p=null===(y=null==en?void 0:en.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==p?p:0,null!==(m=null===(f=null==en?void 0:en.sceneEdges)||void 0===f?void 0:f.length)&&void 0!==m?m:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(Dt,{hoverPoint:dt}),He&&e.createElement(Nt,{nodes:null!==(v=null==en?void 0:en.sceneNodes)&&void 0!==v?v:[],edges:null!==(b=null==en?void 0:en.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart"}),e.createElement(Ji,{width:Ue,height:Ke,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ve,labels:(null==en?void 0:en.labels)||[],sceneNodes:null==en?void 0:en.sceneNodes,title:Le,legend:we,legendPosition:Ae,legendHoverBehavior:Se,legendClickBehavior:Ee,legendHighlightedCategory:Oe,legendIsolatedCategories:Pe,foregroundGraphics:Qe,annotations:xe,svgAnnotationRules:ke,annotationFrame:pt}),Jt,(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:mt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},mt?"STALE":"LIVE"))});ua.displayName="StreamNetworkFrame";const da=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:y="source",targetAccessor:p="target",nodeLabel:f,colorBy:m,colorScheme:v="category10",nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:E=.1,tooltip:O,frameProps:P={},onObservation:L,chartId:M,selection:j,linkedHover:C,loading:N,emptyContent:D,legendInteraction:_,legendPosition:B}=n,H=s.width,W=s.height,T=s.enableHover,I=s.showLegend,$=null!==(i=s.showLabels)&&void 0!==i&&i,z=s.title,R=jo(N,H,W);if(R)return R;const F=Mo(l,H,W,D);if(F)return F;const G=l||[],Y=c||[],q=Hn(G,m,v),X=r(()=>{if(!m)return[];const e=new Set;for(const t of G){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[G,m]),V=$n(_,m,X),U=r(()=>e=>{const t={};return t.fill=m?Be(e.data||e,m,q):_n,"number"==typeof b&&(t.r=b),t},[m,q,b]),K=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),Q=r(()=>{if($&&f)return"function"==typeof f?f:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[f])&&void 0!==n?n:e[f])&&void 0!==o?o:e.id}},[$,f]),{legend:Z,margin:J,legendPosition:ee}=In({data:G,colorBy:m,colorScale:q,showLegend:I,legendPosition:B,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:te}=Tn({selection:j,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:L,chartType:"ForceDirectedGraph",chartId:M}),ne=lo({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ne?e.createElement(eo,{componentName:"ForceDirectedGraph",message:ne,width:H,height:W}):e.createElement(Oo,{componentName:"ForceDirectedGraph",width:H,height:W},e.createElement(ua,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:G},null!=c&&{edges:Y},{size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,nodeIDAccessor:g,sourceAccessor:y,targetAccessor:p,iterations:S,forceStrength:E,nodeStyle:U,edgeStyle:K,colorBy:m,colorScheme:v,nodeSize:b,nodeSizeRange:x,nodeLabel:Q,showLabels:$,enableHover:T,tooltipContent:!1===O?()=>null:Vn(O)||void 0,customHoverBehavior:C||L?te:void 0,legend:Z,legendPosition:ee},_&&"none"!==_&&{legendHoverBehavior:V.onLegendHover,legendClickBehavior:V.onLegendClick,legendHighlightedCategory:V.highlightedCategory,legendIsolatedCategories:V.isolatedCategories},{className:h,title:z},P)))});function ha(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 ga(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 ya(e){return"function"==typeof e?e:t=>t[e]||1}function pa({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=Be(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=Be(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}}da.displayName="ForceDirectedGraph";const fa=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:y="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:E,frameProps:O={},onObservation:P,chartId:L,selection:M,linkedHover:j,loading:C,emptyContent:N,legendInteraction:D}=n,_=s.width,B=s.height,H=s.enableHover,W=null===(i=s.showLabels)||void 0===i||i,T=s.title,I=jo(C,_,B);if(I)return I;const $=Mo(c,_,B,N);if($)return $;const z=c||[],R=r(()=>ga(l,z,g,y),[l,z,g,y]),F=Hn(R,m,v),G=r(()=>{if(!m)return[];const e=new Set;for(const t of R){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[R,m]),Y=$n(D,m,G),q=R.length>0,X=r(()=>{if(q)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Be(e.data||e,m,F);else{const i=Array.isArray(v)?v:je[v]||Ce,a=Array.isArray(i)?i:Ce,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}},[q,m,F,v]),V=r(()=>{if(q)return pa({edgeColorBy:b,colorBy:m,colorScale:F,nodeStyleFn:X||(e=>({fill:_n})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[q,b,m,F,X,S]),U=r(()=>{if(!W)return;const e=A||f;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,A,f]),K=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:Q}=Tn({selection:M,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:P,chartType:"ChordDiagram",chartId:L}),Z=lo({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return Z?e.createElement(eo,{componentName:"ChordDiagram",message:Z,width:_,height:B}):e.createElement(Oo,{componentName:"ChordDiagram",width:_,height:B},e.createElement(ua,Object.assign({ref:a,chartType:"chord"},R.length>0&&{nodes:R},null!=c&&{edges:z},{size:[_,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:y,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:X,edgeStyle:V,colorBy:m,colorScheme:v,edgeColorBy:b,edgeOpacity:S,nodeLabel:U,showLabels:W,enableHover:H,tooltipContent:!1===E?()=>null:Vn(E)||void 0,customHoverBehavior:j||P?Q:void 0},D&&"none"!==D&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories},{className:h,title:T},O)))});fa.displayName="ChordDiagram";const ma=c(function(n,o){var i;const a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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=Rn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:y="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:E=.5,edgeSort:O,tooltip:P,frameProps:L={},onObservation:M,chartId:j,selection:C,linkedHover:N,loading:D,emptyContent:_,legendInteraction:B}=n,H=s.width,W=s.height,T=s.enableHover,I=null===(i=s.showLabels)||void 0===i||i,$=s.title,z=jo(D,H,W);if(z)return z;const R=Mo(c,H,W,_);if(R)return R;const F=c||[],G=r(()=>ga(l,F,g,y),[l,F,g,y]),Y=Hn(G,m,v),q=r(()=>{if(!m)return[];const e=new Set;for(const t of G){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[G,m]),X=$n(B,m,q),V=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Be(e.data||e,m,Y):"#4d430c",t},[m,Y]),U=r(()=>pa({edgeColorBy:b,colorBy:m,colorScale:Y,nodeStyleFn:V,edgeOpacity:E,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,Y,V,E]),K=r(()=>{if(!I)return;const e=S||f;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}},[I,S,f]),Q=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:Z,customClickBehavior:J}=Tn({selection:C,linkedHover:N,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,chartType:"SankeyDiagram",chartId:j}),ee=lo({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return ee?e.createElement(eo,{componentName:"SankeyDiagram",message:ee,width:H,height:W}):e.createElement(Oo,{componentName:"SankeyDiagram",width:H,height:W},e.createElement(ua,Object.assign({ref:a,chartType:"sankey"},G.length>0&&{nodes:G},null!=c&&{edges:F},{size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:y,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:V,edgeStyle:U,colorBy:m,colorScheme:v,edgeColorBy:b,edgeOpacity:E,edgeSort:O,nodeLabel:K,showLabels:I,enableHover:T,tooltipContent:!1===P?()=>null:Vn(P)||void 0,customHoverBehavior:N||M?Z:void 0,customClickBehavior:M?J:void 0},B&&"none"!==B&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories},{className:h,title:$},L)))});function va(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{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:y="category10",colorByDepth:p=!1,edgeStyle:f="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,chartId:w,selection:A,linkedHover:S,loading:E,legendInteraction:O}=t,P=o.width,L=o.height,M=o.enableHover,j=null===(n=o.showLabels)||void 0===n||n,C=o.title,N=jo(E,P,L);if(N)return N;const D=r(()=>ha(null!=i?i:null,u),[i,u]),_=Hn(D,p?void 0:g,y),B=r(()=>{if(!g||p)return[];const e=new Set;for(const t of D){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[D,g,p]),H=$n(O,p?void 0:g,B),W=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?De[(e.depth||0)%De.length]:g?Be(e.data||e,g,_):_n,t},[g,p,_]),T=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),I=r(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return ya(d)},[l,d]),$=Object.assign(Object.assign({},o.marginDefaults),a),{customHoverBehavior:z}=Tn({selection:A,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,chartType:"TreeDiagram",chartId:w}),R=so({componentName:"TreeDiagram",data:i});return R?e.createElement(eo,{componentName:"TreeDiagram",message:R,width:P,height:L}):e.createElement(Oo,{componentName:"TreeDiagram",width:P,height:L},e.createElement(ua,Object.assign({chartType:l},null!=i&&{data:i},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:I,treeOrientation:c,edgeType:f,nodeStyle:W,edgeStyle:T,colorBy:g,colorScheme:y,colorByDepth:p,nodeSize:v,nodeLabel:j?m||h:void 0,showLabels:j,enableHover:M,tooltipContent:!1===b?()=>null:Vn(b)||void 0,customHoverBehavior:S||k?z:void 0},O&&"none"!==O&&{legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:H.isolatedCategories},{className:s,title:C},x)))}function ba(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,labelMode:p="leaf",nodeLabel:f,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,chartId:S,loading:E,legendInteraction:O}=t,P=o.width,L=o.height,M=o.enableHover,j=null===(n=o.showLabels)||void 0===n||n,C=o.title,N=jo(E,P,L);if(N)return N;const{activeSelectionHook:D,customHoverBehavior:_}=Tn({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,chartType:"Treemap",chartId:S}),B=s(e=>{if(!e)return _(null);const t=e.data||e;_({data:(null==t?void 0:t.data)||t})},[_]),H=r(()=>ha(null!=i?i:null,c),[i,c]),W=Hn(H,y?void 0:h,g),T=r(()=>{if(!h||y)return[];const e=new Set;for(const t of H){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[H,h,y]),I=$n(O,y?void 0:h,T),$=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=y?De[(e.depth||0)%De.length]:h?Be(e.data||e,h,W):_n,t},[h,y,W]),z=r(()=>D?e=>{var t;const n=Object.assign({},$(e));if(D.isActive)if(D.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}:$,[$,D,k]),R=r(()=>ya(u),[u]),F=void 0!==v?v:j&&"parent"===p?18:void 0,G=Object.assign(Object.assign({},o.marginDefaults),a),Y=so({componentName:"Treemap",data:i});return Y?e.createElement(eo,{componentName:"Treemap",message:Y,width:P,height:L}):e.createElement(Oo,{componentName:"Treemap",width:P,height:L},e.createElement(ua,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:R,padding:m,paddingTop:F,nodeStyle:z,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:j?f||d:void 0,showLabels:j,labelMode:p,enableHover:M,tooltipContent:!1===b?()=>null:Vn(b)||void 0},(w||A)&&{customHoverBehavior:B},O&&"none"!==O&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories},{className:l,title:C},x)))}function xa(t){var n;const o=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:g=!1,nodeLabel:y,circleOpacity:p=.7,padding:f=4,tooltip:m,frameProps:v={},onObservation:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S}=t,E=o.width,O=o.height,P=o.enableHover,L=null===(n=o.showLabels)||void 0===n||n,M=o.title,j=jo(A,E,O);if(j)return j;const C=r(()=>ha(null!=i?i:null,l),[i,l]),N=Hn(C,g?void 0:d,h),D=r(()=>{if(!d||g)return[];const e=new Set;for(const t of C){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[C,d,g]),_=$n(S,g?void 0:d,D),B=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?De[(e.depth||0)%De.length]:d?Be(e.data||e,d,N):_n,t},[d,g,N,p]),H=r(()=>ya(c),[c]),W=Object.assign(Object.assign({},o.marginDefaults),a),{customHoverBehavior:T}=Tn({selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,chartType:"CirclePack",chartId:x}),I=so({componentName:"CirclePack",data:i});return I?e.createElement(eo,{componentName:"CirclePack",message:I,width:E,height:O}):e.createElement(Oo,{componentName:"CirclePack",width:E,height:O},e.createElement(ua,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:H,padding:f,nodeStyle:B,colorBy:d,colorScheme:h,colorByDepth:g,nodeLabel:L?y||u:void 0,showLabels:L,enableHover:P,tooltipContent:!1===m?()=>null:Vn(m)||void 0,customHoverBehavior:w||b?T:void 0},S&&"none"!==S&&{legendHoverBehavior:_.onLegendHover,legendClickBehavior:_.onLegendClick,legendHighlightedCategory:_.highlightedCategory,legendIsolatedCategories:_.isolatedCategories},{className:s,title:M},v)))}ma.displayName="SankeyDiagram",va.displayName="TreeDiagram",ba.displayName="Treemap",xa.displayName="CirclePack";const ka=De;function wa(t){const n=Rn(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u="category10",colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:y=.25,revolution:p,revolutionStyle:f,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:E={},onObservation:O,chartId:P,selection:L,linkedHover:M,loading:j}=t,C=n.width,N=n.height,D=n.enableHover,_=n.title,B=jo(j,C,N);if(B)return B;const H=Hn(r(()=>ha(o,s),[o,s]),d?void 0:c,u),W=r(()=>{if(Array.isArray(u))return u;const e=je[u];return Array.isArray(e)?e:Ce},[u]),T=r(()=>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?W[0]:ka[(e.depth||0)%ka.length]:c?Be(e.data||e,c,H):_n,n.opacity=o?1:.85,n},[c,d,H,W]),I=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),$=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:z}=Tn({selection:L,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:O,chartType:"OrbitDiagram",chartId:P}),R=r(()=>{if(z)return e=>{z(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z]),F=so({componentName:"OrbitDiagram",data:o});return F?e.createElement(eo,{componentName:"OrbitDiagram",message:F,width:C,height:N}):e.createElement(Oo,{componentName:"OrbitDiagram",width:C,height:N},e.createElement(ua,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[C,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:T,edgeStyle:I,colorBy:c,colorScheme:u,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:Vn(w)||void 0,customHoverBehavior:M||O?R:void 0,foregroundGraphics:A,annotations:S,className:a,title:_,orbitMode:h,orbitSize:g,orbitSpeed:y,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k},E)))}wa.displayName="OrbitDiagram";const Aa=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:E,background:O,tooltipContent:P,tooltip:L,onHover:M,annotations:j,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:D,decay:_,pulse:B,staleness:H,transition:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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!=P?P:L,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:z}),J=s(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=jo(R,U[0],U[1]);if(ee)return ee;const te=Mo(m,U[0],U[1],F);if(te)return te;const ne={stroke:A,strokeWidth:S,strokeDasharray:E};return e.createElement(dn,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:O,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:j,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:D,decay:_,pulse:B,staleness:H,transition:W,legendPosition:Y})});Aa.displayName="RealtimeLineChart";const Sa=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:y,arrowOfTime:p="right",windowMode:f="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:E,fill:O,stroke:P,strokeWidth:L,gap:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,decay:$,pulse:z,staleness:R,transition:F,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U}=n,K=c.showAxes,Q=c.enableHover,Z=null!=g?g:c.marginDefaults,J=null!=h?h:[c.width,c.height],ee=null!=C?C:N,te=t(null),{customHoverBehavior:ne}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),oe=s(e=>{D&&D(e),ne(e)},[D,ne]);u(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const re=jo(q,J[0],J[1]);if(re)return re;const ie=Mo(v,J[0],J[1],X);if(ie)return ie;const ae={};return null!=O&&(ae.fill=O),null!=P&&(ae.stroke=P),null!=L&&(ae.strokeWidth=L),null!=M&&(ae.gap=M),e.createElement(dn,{ref:te,chartType:"bar",runtimeMode:"streaming",size:J,margin:Z,className:V?`${y||""} semiotic-emphasis-${V}`.trim():y,arrowOfTime:p,windowMode:f,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:E,barStyle:ae,showAxes:K,background:j,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:oe,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,decay:$,pulse:z,staleness:R,transition:F,legendPosition:U})});Sa.displayName="RealtimeTemporalHistogram";const Ea=Sa,Oa=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:E,fill:O,opacity:P,stroke:L,strokeWidth:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:N,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeSwarmChart",chartId:z}),J=s(e=>{D&&D(e),Z(e)},[D,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=jo(R,U[0],U[1]);if(ee)return ee;const te=Mo(m,U[0],U[1],F);if(te)return te;const ne={};return null!=E&&(ne.radius=E),null!=O&&(ne.fill=O),null!=P&&(ne.opacity=P),null!=L&&(ne.stroke=L),null!=M&&(ne.strokeWidth=M),e.createElement(dn,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,legendPosition:Y})});Oa.displayName="RealtimeSwarmChart";const Pa=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:E,connectorWidth:O,gap:P,stroke:L,strokeWidth:M,background:j,tooltipContent:C,tooltip:N,onHover:D,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:N,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:z}),J=s(e=>{D&&D(e),Z(e)},[D,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=jo(R,U[0],U[1]);if(ee)return ee;const te=Mo(m,U[0],U[1],F);if(te)return te;const ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=E&&(ne.connectorStroke=E),null!=O&&(ne.connectorWidth=O),null!=P&&(ne.gap=P),null!=L&&(ne.stroke=L),null!=M&&(ne.strokeWidth=M),e.createElement(dn,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:_,svgAnnotationRules:B,tickFormatTime:H,tickFormatValue:W,legendPosition:Y})});Pa.displayName="RealtimeWaterfallChart";const La=c(function(n,o){var r,i,a,l;const c=Rn(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:p="sliding",windowSize:f=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:E=20,aggregation:O="count",background:P,tooltipContent:L,tooltip:M,onHover:j,annotations:C,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:_,decay:B,pulse:H,staleness:W,linkedHover:T,selection:I,onObservation:$,chartId:z,loading:R,emptyContent:F,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:M,Q=t(null),{customHoverBehavior:Z}=Tn({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeHeatmap",chartId:z}),J=s(e=>{j&&j(e),Z(e)},[j,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=jo(R,U[0],U[1]);if(ee)return ee;const te=Mo(m,U[0],U[1],F);return te||e.createElement(dn,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:y,windowMode:p,windowSize:f,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:E,heatmapAggregation:O,showAxes:q,background:P,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:C,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:_,decay:B,pulse:H,staleness:W,legendPosition:Y})});La.displayName="RealtimeHeatmap";let[Ma]=_t(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function ja({theme:t}){const n=It(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function Ca({children:t}){const n=It(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function Na({theme:t,children:n}){return e.createElement(Tt,null,e.createElement(ja,{theme:t}),e.createElement(Ca,null,n))}function Da(){return It(e=>e.theme)}function _a(e,t){return No(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"),Ba(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Ha(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),y=new Image;y.width=l.width,y.height=l.height,yield new Promise((e,t)=>{y.onload=()=>{c.drawImage(y,0,0),a.toBlob(n=>{n?(Ha(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},y.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},y.src=g})}})}function Ba(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++)Ba(o[e],r[e])}function Ha(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 Wa=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"]),Ta=new Set(["data","nodes","edges"]),Ia="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function $a(e,t,n){if(!po[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(po).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Wa.has(e)||!o&&Ta.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Ia(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function za(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!po[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Ia(e.props)}}function Ra(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Fa(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 Ga(e){return No(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Ya(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 Ya(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")}const qa={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 Xa({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 Va({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 Ua=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:y,style:p},f){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="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",O=e.useCallback(e=>No(this,void 0,void 0,function*(){v.current&&(yield _a(v.current,Object.assign(Object.assign({},S),e)))}),[S]),P=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),L=e.useCallback(e=>No(this,void 0,void 0,function*(){s&&(yield Ga(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(f,()=>({export:O,toggleFullscreen:P,copyConfig:L,element:m.current}),[O,P,L]);const M=t||n||l||k||w||A||h,j=c?e.createElement(Xa,{height:i}):u?e.createElement(Va,{error:u}):d?e.createElement(to,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"+(y?" "+y:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:8,overflow:"hidden",background:"var(--semiotic-bg, #fff)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},M&&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:()=>O(),title:"Export chart","aria-label":"Export chart",style:Ka},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"}))),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:P,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:Ka},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:()=>L(),title:"Copy config","aria-label":"Copy chart configuration",style:Ka},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:qa[h].bg,color:qa[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})},j,g)))}),Ka={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 Qa({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 Za({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))}Qa.displayName="ChartGrid",Za.displayName="ContextLayout";function Ja({children:r,position:i="right",size:a=300,trigger:l="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:y,style:p}){const[f,m]=n(null),[v,b]=n(null),[x,k]=n(!1),[w,A]=n(!1),S=t(null),E=t(),O="click"===l?["click","click-end"]:["hover","hover-end"],{latest:P}=On({types:O,chartId:c,limit:1}),L=void 0!==u?u:P;o(()=>{if(L)if("click"===L.type||"hover"===L.type){const e=L;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(E.current),E.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==L.type&&"hover-end"!==L.type||M()},[L]),o(()=>{null==g||g(x)},[x,g]);const M=s(()=>{A(!0),k(!1),clearTimeout(E.current),E.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(E.current),[]),!f&&!w)return null;const j=f&&v?r(f,v):null;if(null===j&&!w)return null;const C=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}${y?" "+y:""}`,style:Object.assign(Object.assign({},C),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:es},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}},j))}const es={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};function ts(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 ns(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 os(e){return"nominal"===e||"ordinal"===e}function rs(e){return"quantitative"===e||"temporal"===e}Ja.displayName="DetailsPanel";const is={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"},as={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"},ss={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function ls(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,y;const p=[],{type:f,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 E;(null===(t=e.data)||void 0===t?void 0:t.values)?E=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 O={};e.width&&(O.width=e.width),e.height&&(O.height=e.height);const P=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(P&&(O.title=P),(null==k?void 0:k.field)&&(O.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=is[k.scale.scheme];e&&(O.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(O.pointOpacity=S.value);const L=null==b?void 0:b.aggregate,M=null==x?void 0:x.aggregate;if(E&&(L||M)){const e=M?x:b,t=M?b:x,n=ss[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)E=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}(E,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&E){const e=new Map;for(const n of E){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}E=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";E&&(O.data=E),(null==b?void 0:b.bin)?(O.valueAccessor=b.field,(null==x?void 0:x.field)&&(O.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(O.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(O.valueAccessor=x.field,(null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(O.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&&(O.bins=t),us(e,O,p)}let j;switch(f){case"bar":j=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",os(null==e?void 0:e.type)&&rs(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)):rs(null==e?void 0:e.type)&&os(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,O,E,L,M);break;case"line":if(j="LineChart",cs(b,x,O,L,M),(null==k?void 0:k.field)&&(O.lineBy=k.field),m.interpolate){const e=as[m.interpolate];e&&(O.curve=e)}!0===m.point&&(O.showPoints=!0),E&&(O.data=E);break;case"area":if((null==k?void 0:k.field)?(j="StackedAreaChart",O.areaBy=k.field):j="AreaChart",cs(b,x,O,L,M),m.interpolate){const e=as[m.interpolate];e&&(O.curve=e)}void 0!==m.opacity&&(O.areaOpacity=m.opacity),E&&(O.data=E);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(j="BubbleChart",O.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(O.sizeRange=w.scale.range)):j="Scatterplot",cs(b,x,O,L,M),E&&(O.data=E);break;case"rect":j="Heatmap",(null==b?void 0:b.field)&&(O.xAccessor=b.field),(null==x?void 0:x.field)&&(O.yAccessor=x.field),(null==k?void 0:k.field)&&(O.valueAccessor=k.field,delete O.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(O.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(O.yLabel=x.axis.title),E&&(O.data=E);break;case"arc":m.innerRadius&&m.innerRadius>0?(j="DonutChart",O.innerRadius=m.innerRadius):j="PieChart",(null==A?void 0:A.field)?O.valueAccessor=A.field:(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field),(null==k?void 0:k.field)&&(O.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(O.categoryAccessor=b.field),E&&(O.data=E);break;case"tick":j="DotPlot",os(null==b?void 0:b.type)?(O.categoryAccessor=b.field,(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(O.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(O.valueLabel=x.axis.title)):os(null==x?void 0:x.type)?(O.categoryAccessor=x.field,(null==b?void 0:b.field)&&(O.valueAccessor=L?"value":b.field),O.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(O.categoryLabel=x.axis.title),(null===(y=null==b?void 0:b.axis)||void 0===y?void 0:y.title)&&(O.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null==x?void 0:x.field)&&(O.valueAccessor=M?"value":x.field)),E&&(O.data=E);break;default:p.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),j="Scatterplot",cs(b,x,O,L,M),E&&(O.data=E)}return us(j,O,p)}function cs(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 us(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}export{Ho as AreaChart,kr as BarChart,Er as BoxPlot,Fo as BubbleChart,gn as CategoryColorProvider,Ua as ChartContainer,Qa as ChartGrid,fa as ChordDiagram,xa as CirclePack,Ro as ConnectedScatterplot,Za as ContextLayout,Ja as DetailsPanel,Cr as DonutChart,Lr as DotPlot,da as ForceDirectedGraph,Ar as GroupedBarChart,Go as Heatmap,Or as Histogram,Bo as LineChart,jn as LinkedCharts,Xn as MultiLineTooltip,wa as OrbitDiagram,jr as PieChart,La as RealtimeHeatmap,Ea as RealtimeHistogram,Aa as RealtimeLineChart,Oa as RealtimeSwarmChart,Pa as RealtimeWaterfallChart,Mr as RidgelinePlot,ma as SankeyDiagram,$o as Scatterplot,Zo as ScatterplotMatrix,To as StackedAreaChart,wr as StackedBarChart,Sr as SwarmPlot,Na as ThemeProvider,Ma as TooltipProvider,va as TreeDiagram,ba as Treemap,Pr as ViolinPlot,Ya as configToJSX,Ga as copyConfig,ns as deserializeSelections,Ao as diagnoseConfig,_a as exportChart,za as fromConfig,Fa as fromURL,ls as fromVegaLite,ts as serializeSelections,$a as toConfig,Ra as toURL,Sn as useBrushSelection,yn as useCategoryColors,On as useChartObserver,En as useFilteredData,An as useLinkedHover,wn as useSelection,Da as useTheme,mo as validateProps};
|