semiotic 3.5.3 → 3.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +5 -5
  3. package/ai/componentMetadata.cjs +9 -2
  4. package/ai/dist/mcp-server.js +4 -1
  5. package/ai/examples.md +27 -0
  6. package/ai/schema.json +286 -41
  7. package/ai/system-prompt.md +1 -1
  8. package/dist/components/charts/index.d.ts +3 -3
  9. package/dist/components/charts/network/Treemap.d.ts +8 -0
  10. package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
  11. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +22 -0
  12. package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
  13. package/dist/components/charts/shared/hooks.d.ts +2 -2
  14. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
  15. package/dist/components/charts/shared/types.d.ts +11 -2
  16. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  17. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
  18. package/dist/components/charts/xy/AreaChart.d.ts +15 -0
  19. package/dist/components/semiotic-ai.d.ts +1 -1
  20. package/dist/components/semiotic-realtime.d.ts +3 -3
  21. package/dist/components/semiotic-server.d.ts +1 -0
  22. package/dist/components/semiotic-xy.d.ts +1 -1
  23. package/dist/components/semiotic.d.ts +5 -4
  24. package/dist/components/server/renderToStaticSVG.d.ts +2 -0
  25. package/dist/components/server/staticLegend.d.ts +35 -0
  26. package/dist/components/store/ThemeStore.d.ts +2 -0
  27. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
  28. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
  29. package/dist/components/stream/SVGOverlay.d.ts +2 -1
  30. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  31. package/dist/components/stream/geoTypes.d.ts +2 -1
  32. package/dist/components/stream/hoverUtils.d.ts +1 -0
  33. package/dist/components/stream/legendRenderer.d.ts +2 -1
  34. package/dist/components/stream/networkTypes.d.ts +2 -1
  35. package/dist/components/stream/ordinalTypes.d.ts +16 -2
  36. package/dist/components/stream/renderers/wedgePathBuilder.d.ts +31 -0
  37. package/dist/components/stream/types.d.ts +2 -1
  38. package/dist/components/types/legendTypes.d.ts +15 -0
  39. package/dist/components/types/marginType.d.ts +17 -3
  40. package/dist/geo.min.js +1 -1
  41. package/dist/geo.module.min.js +1 -1
  42. package/dist/network.min.js +1 -1
  43. package/dist/network.module.min.js +1 -1
  44. package/dist/ordinal.min.js +1 -1
  45. package/dist/ordinal.module.min.js +1 -1
  46. package/dist/realtime.min.js +1 -1
  47. package/dist/realtime.module.min.js +1 -1
  48. package/dist/semiotic-ai.d.ts +1 -1
  49. package/dist/semiotic-ai.min.js +1 -1
  50. package/dist/semiotic-ai.module.min.js +1 -1
  51. package/dist/semiotic-realtime.d.ts +3 -3
  52. package/dist/semiotic-server.d.ts +1 -0
  53. package/dist/semiotic-utils.min.js +1 -1
  54. package/dist/semiotic-utils.module.min.js +1 -1
  55. package/dist/semiotic-xy.d.ts +1 -1
  56. package/dist/semiotic.d.ts +5 -4
  57. package/dist/semiotic.min.js +1 -1
  58. package/dist/semiotic.module.min.js +1 -1
  59. package/dist/server.min.js +1 -1
  60. package/dist/server.module.min.js +1 -1
  61. package/dist/xy.min.js +1 -1
  62. package/dist/xy.module.min.js +1 -1
  63. package/package.json +13 -21
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRef as o,useMemo as r,useEffect as l,useContext as s,useCallback as a,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as f,useId as g,useImperativeHandle as y}from"react";import{select as p}from"d3-selection";import{brushX as v,brushY as m,brush as x}from"d3-brush";import{scaleLinear as b,scaleLog as k,scaleTime as w}from"d3-scale";import{quadtree as A}from"d3-quadtree";import{curveNatural as _,curveBasis as S,curveStepAfter as M,curveStepBefore as P,curveStep as C,curveCatmullRom as T,curveCardinal as E,curveMonotoneY as O,curveMonotoneX as D,line as L,area as N,curveLinear as $,arc as I,pie as W}from"d3-shape";import{bin as z,min as R,groups as F,max as Y,sum as j,mean as B,group as H}from"d3-array";import{packEnclose as X,hierarchy as G,partition as V,pack as q,treemap as U,treemapBinary as K,cluster as Z,tree as Q}from"d3-hierarchy";import J from"regression";import{interpolateNumber as tt}from"d3-interpolate";import{forceLink as et,forceSimulation as nt,forceManyBody as it,forceCenter as ot,forceX as rt,forceY as lt}from"d3-force";import{ribbon as st,chord as at}from"d3-chord";function ct(t,e){let n=0,i=e.length-1;for(;i>n;){const o=n+i+1>>1;e[o]>t?i=o-1:n=o}return e[n]}function ut(t,e){let n=0,i=e.length-1;for(;i>n;){const o=n+i>>1;t>e[o]?n=o+1:i=o}return e[n]}function dt({width:e,height:n,totalWidth:i,totalHeight:s,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:g,snapDuring:y,streaming:b}){const k=o(null),w=o(null),A=o(d);A.current=d;const _=o(u);_.current=u;const S=r(()=>g?[...g].sort((t,e)=>t-e):void 0,[g]),M=o(S);M.current=S;const P=o(!1),C=o(null);return l(()=>{if(!k.current)return;const t=p(k.current).select(".brush-g"),i="x"===c?v():"y"===c?m():x();return i.extent([[0,0],[e,n]]),i.on("brush end",o=>{if(P.current)return;const r=_.current;if(!r)return;if(!o.selection)return C.current=null,void A.current(null);let l,s;if("x"===c){const[t,e]=o.selection;l=[r.x.invert(t),r.x.invert(e)],s=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[t,n]=o.selection;l=[r.x.invert(0),r.x.invert(e)],s=[r.y.invert(n),r.y.invert(t)]}else{const[[t,e],[n,i]]=o.selection;l=[r.x.invert(t),r.x.invert(n)],s=[r.y.invert(i),r.y.invert(e)]}if("bin"===f&&"y"!==c&&("end"===o.type||"brush"===o.type&&y)){const e=M.current;e&&e.length>0?l=function(t,e){return 0===e.length?t:[ct(t[0],e),ut(t[1],e)]}(l,e):h&&h>0&&(l=[Math.floor(l[0]/h)*h,Math.ceil(l[1]/h)*h]);const n=r.x(l[0]),s=r.x(l[1]);if(P.current=!0,"x"===c)t.call(i.move,[n,s]);else if("xy"===c){const e=o.selection;t.call(i.move,[[n,e[0][1]],[s,e[1][1]]])}P.current=!1}const a={x:l,y:s};C.current=a,A.current(a)}),t.call(i),w.current=i,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null),w.current=null}},[e,n,c,f,h,y]),l(()=>{if(!(b&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const t=C.current,e=u.x.domain()[0],n=p(k.current).select(".brush-g");if(e>=t.x[1])return P.current=!0,n.call(w.current.move,null),P.current=!1,C.current=null,void A.current(null);let i=t.x[0],o=!1;if(e>t.x[0]){if(i=e,"bin"===f){const t=M.current;t&&t.length>0?i=ut(e,t):h&&h>0&&(i=Math.ceil(e/h)*h)}if(i>=t.x[1])return P.current=!0,n.call(w.current.move,null),P.current=!1,C.current=null,void A.current(null);o=!0}const r=u.x(i),l=u.x(t.x[1]);if(P.current=!0,"x"===c)n.call(w.current.move,[r,l]);else{const e=u.y(t.y[1]),i=u.y(t.y[0]);n.call(w.current.move,[[r,e],[l,i]])}if(P.current=!1,o){const e={x:[i,t.x[1]],y:t.y};C.current=e,A.current(e)}},[u,b,c,f,h]),t("svg",{ref:k,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const ht=Object.freeze([]);function ft(t){if(!t)return ht;let e=!1;for(let n=0;t.length>n;n++){const i=t[n];if(null==i||"object"!=typeof i){e=!0;break}}if(!e)return t;const n=[];for(const e of t)null!=e&&"object"==typeof e&&n.push(e);return n}class gt{constructor(t,e){var n,i;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=null!==(n=null==e?void 0:e.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(i=null==e?void 0:e.chunkSize)&&void 0!==i?i:5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=ft(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=ft(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const i=t[n];null!=i&&"object"==typeof i&&(this.pushBuffer.push(i),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function yt(e){let n=null;const i=()=>(n||(n=u(null)),n),l=pt(e);return[function({children:n,initialState:l}){const s=o(l),a=r(()=>pt(e,s.current),[]),c=i();return t(c.Provider,{value:a,children:n})},t=>{var e;const n=i(),r=null!==(e=s(n))&&void 0!==e?e:l,u=o(t);u.current=t;const d=a(()=>u.current(r.getState()),[r]),h=a(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function pt(t,e){const n=new EventTarget;let i=Object.assign(Object.assign({},t(function(t){i=Object.assign(Object.assign({},i),t(i)),n.dispatchEvent(new Event("update"))})),null!=e?e:{});return{getState:()=>i,subscribe:function(t){return n.addEventListener("update",t),()=>n.removeEventListener("update",t)}}}function vt(t){if(!(null==t?void 0:t.colors))return;const e=t.colors;return{primary:e.primary,secondary:e.secondary||e.primary,surface:e.surface||e.background,success:e.success,danger:e.danger,warning:e.warning,error:e.error,info:e.info,text:e.text,textSecondary:e.textSecondary,border:e.border,grid:e.grid}}function mt(t){if(!t.accessibility)return t;let e=t;if(t.accessibility.colorBlindSafe&&(e=Object.assign(Object.assign({},e),{colors:Object.assign(Object.assign({},e.colors),{categorical:xt})})),t.accessibility.highContrast){const t="dark"===e.mode;e=Object.assign(Object.assign({},e),{colors:Object.assign(Object.assign({},e.colors),{text:t?"#ffffff":"#000000",textSecondary:t?"#cccccc":"#333333",grid:t?"#666666":"#999999",border:t?"#888888":"#000000"})})}return e}const xt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],bt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},wt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function At(t,e){if("light"===e)return bt;if("dark"===e)return kt;if("high-contrast"===e)return wt;if("string"==typeof e)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${e}". Keeping current theme.`),t;if(e.mode&&"auto"!==e.mode){const t="dark"===e.mode?kt:bt;return mt(Object.assign(Object.assign(Object.assign({},t),e),{colors:Object.assign(Object.assign({},t.colors),e.colors||{}),typography:Object.assign(Object.assign({},t.typography),e.typography||{})}))}return mt(Object.assign(Object.assign(Object.assign({},t),e),{colors:Object.assign(Object.assign({},t.colors),e.colors||{}),typography:Object.assign(Object.assign({},t.typography),e.typography||{})}))}const[_t,St]=yt(t=>({theme:bt,setTheme(e){t(t=>({theme:At(t.theme,e)}))}}));class Mt{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const n of t){const t=this.push(n);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+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 t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const e=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)t(this.buffer[(e+n)%this._capacity],n)}toArray(){const t=Array(this._size),e=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)t[n]=this.buffer[(e+n)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray(),n=[];for(;e.length>t;)n.push(e.shift());this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(const t of e)this.push(t);return n}update(t,e){const n=[],i=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const r=(i+o)%this._capacity,l=this.buffer[r];if(t(l)){let t;t="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(t),this.buffer[r]=e(l)}}return n}remove(t){const e=[],n=[];if(this.forEach(i=>{t(i)?n.push(i):e.push(i)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of e)this.push(t);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 Pt{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}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 Ct(t,e,n,i,o){const r=new Map;for(const l of t){const t=e(l),s=n(l);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const a=Math.floor(t/i)*i;let c=r.get(a);if(c||(c={start:a,end:a+i,total:0,categories:new Map},r.set(a,c)),c.total+=s,o){const t=o(l);c.categories.set(t,(c.categories.get(t)||0)+s)}}return r}function Tt(t,e,n,i,o,r){const l=[];for(const o of t){const t=n(o),r=i(o);Number.isFinite(t)&&Number.isFinite(r)&&l.push({px:e.x(t),py:e.y(r),rawY:r,d:o})}l.sort((t,e)=>t.px-e.px);const s=Array(l.length),a=Array(l.length),c=Array(l.length);for(let t=0;l.length>t;t++){const e=l[t];s[t]=[e.px,e.py],a[t]=e.rawY,c[t]=e.d}return{type:"line",path:s,rawValues:a,style:o,datum:c,group:r}}function Et(t,e,n,i,o,r,l,s){const a=[];for(const r of t){const t=n(r),l=i(r);if(!Number.isFinite(t)||!Number.isFinite(l))continue;const c=e.x(t),u=s?s(r):o;a.push({px:c,topY:e.y(l),botY:e.y(u)})}a.sort((t,e)=>t.px-e.px);const c=Array(a.length),u=Array(a.length);for(let t=0;a.length>t;t++){const e=a[t];c[t]=[e.px,e.topY],u[t]=[e.px,e.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:t,group:l}}function Ot(t,e,n,i){var o,r,l;const s=new Map;if("silhouette"===i)for(const i of t){let t=0;for(const o of e)t+=n(o,i)||0;s.set(i,-t/2)}else if("wiggle"===i){t.length>0&&s.set(t[0],0);for(let i=1;t.length>i;i++){const r=t[i-1],l=t[i];let a=0,c=0,u=0;for(const t of e){const e=n(t,l)||0;a+=(2*u+e)*(e-(n(t,r)||0)),c+=e,u+=e}const d=null!==(o=s.get(r))&&void 0!==o?o:0;s.set(l,d-(c>0?a/(2*c):0))}if(t.length>0){let i=0;for(const o of t){let t=0;for(const i of e)t+=n(i,o)||0;i+=(null!==(r=s.get(o))&&void 0!==r?r:0)+t/2}const o=i/t.length;for(const e of t)s.set(e,(null!==(l=s.get(e))&&void 0!==l?l:0)-o)}}else for(const e of t)s.set(e,0);return s}function Dt(t,e,n,i,o,r,l){const s=n(t),a=i(t);if(!Number.isFinite(s)||!Number.isFinite(a))return null;const c={type:"point",x:e.x(s),y:e.y(a),r:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function Lt(t,e,n,i,o,r,l){return{type:"rect",x:t,y:e,w:n,h:i,style:o,datum:r,group:l}}function Nt(t,e,n,i,o,r,l){const s={type:"heatcell",x:t,y:e,w:n,h:i,fill:o,datum:r};return(null==l?void 0:l.showValues)&&(s.showValues=!0,s.value=l.value,l.valueFormat&&(s.valueFormat=l.valueFormat)),s}function $t(t,e){return t===e||typeof t==typeof e&&"function"==typeof t&&"function"==typeof e&&""+t==""+e}function It(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function Wt(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function zt(t,e){return"function"==typeof t?t:t?e=>e[t]+"":void 0}function Rt(t){return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]}function Ft(t,e,n){const i=t=>t.toString(16).padStart(2,"0");return`#${i(t)}${i(e)}${i(n)}`}function Yt(t){const e=t.map(Rt),n=e.length-1;return t=>{if(0>=t){const[t,n,i]=e[0];return Ft(t,n,i)}if(t>=1){const[t,i,o]=e[n];return Ft(t,i,o)}const i=t*n,o=Math.floor(i),r=i-o,[l,s,a]=e[o],[c,u,d]=e[o+1];return Ft(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}const jt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Bt=Yt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ht=Yt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Xt=Yt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Gt=Yt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Vt=Yt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),qt=Yt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Ut=Yt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Kt=Yt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Zt=Yt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Qt=Yt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Jt=Yt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),te=Yt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Yt(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Yt(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Yt(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Yt(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Yt(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const ee={category10:jt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Bt,reds:Ht,greens:Xt,oranges:Gt,purples:Vt,viridis:Ut,plasma:Kt},ne=jt,ie=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function oe(t,e,n){var i,o,r;if(1>=n)return 1;const l=null!==(i=t.minOpacity)&&void 0!==i?i:.1,s=n-1-e;switch(t.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const e=null!==(o=t.halfLife)&&void 0!==o?o:n/2;return l+Math.pow(.5,s/e)*(1-l)}case"step":return(null!==(r=t.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}function re(t,e,n){var i;const o=null!==(i=t.duration)&&void 0!==i?i:500,r=n-e;return o>r?1-r/o:0}function le(t,e="ease-out-cubic"){return"linear"===e?t:1-Math.pow(1-t,3)}function se(t,e){return Math.min((t-e.startTime)/e.duration,1)}function ae(t,e,n){return t+(e-t)*n}function ce(t,e,n){var i,o,r,l;if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const n=t.getX(e.datum),i=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${n}:${i}`;if(null!=n&&null!=i)return`p:${n}:${i}`}return"p:"+n;case"rect":return`r:${e.group||""}:${null!==(l=null!==(o=null===(i=e.datum)||void 0===i?void 0:i.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:n}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+n:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function ue(t,e,n,i){return"function"==typeof e.style?e.style(i||{},n):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(n,i)}function de(t,e,n,i){if(!t.scales)return null;const o=[],r=[];for(const n of e){const e=t.getX(n);if(!Number.isFinite(e))continue;const l=i.getTop(n),s=i.getBottom(n);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a=t.scales.x(e),c=t.scales.y(l),u=t.scales.y(s);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(o.push([a,c]),r.push([a,u]))}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:ue(t,i,n,e[0]),datum:e,group:n,interactive:i.interactive}}function he(t){const e=[],n=[];if(!t)return{perSeries:e,aggregate:n};for(const i of t)i.perSeries?e.push(i):n.push(i);return{perSeries:e,aggregate:n}}function fe(t,e,n){const i=[];for(const o of n){const n=de(t,e,"__ribbon_aggregate",o);n&&i.push(n)}return i}function ge(t,e,n,i){const o=[];for(const r of i){const i=de(t,e,n,r);i&&o.push(i)}return o}function ye(t,e){if(!t)return{};if(!e||0===e.length)return t;const n=[];for(const i of e){if("band"!==i.kind)continue;const e=i.getTop(t),o=i.getBottom(t);Number.isFinite(o)&&Number.isFinite(e)&&n.push({y0:o,y1:e})}return 0===n.length?t:Object.assign(Object.assign({},t),{band:n[0],bands:n})}function pe(t,e,n,i){var o;if(!t.config.pointStyle)return;const r=null!=i?i:t.getY;for(const i of e){const e=t.resolveGroupColor(i.key);for(const l of i.data){let i=t.config.pointStyle(l);!i.fill&&e&&(i=Object.assign(Object.assign({},i),{fill:e}));const s=null!==(o=i.r)&&void 0!==o?o:3,a=t.getPointId?t.getPointId(l)+"":void 0,c=Dt(l,t.scales,t.getX,r,s,i,a);c&&n.push(c)}}}const ve={topOpacity:.8,bottomOpacity:.05};function me(t){var e,n;if(t)return!0===t?ve:"colorStops"in t?t:{topOpacity:null!==(e=t.topOpacity)&&void 0!==e?e:ve.topOpacity,bottomOpacity:null!==(n=t.bottomOpacity)&&void 0!==n?n:ve.bottomOpacity}}const xe={blues:Bt,reds:Ht,greens:Xt,viridis:Ut,oranges:Gt,purples:Vt,greys:qt,plasma:Kt,inferno:Zt,magma:Qt,cividis:Jt,turbo:te},be=new Map;function ke(t,e){const n="function"==typeof t?t:n=>n[t||e];return t=>{const e=n(t);return null==e?NaN:+e}}function we(t){const e=[],n=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,i=ke(n&&t.valueAccessor||t.yAccessor,n?"value":"y");if(t.boundsAccessor){const n=It(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e+o:e},getBottom:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e-o:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const n=Array.isArray(t.band)?t.band:[t.band];for(const t of n)e.push({kind:"band",getTop:ke(t.y1Accessor,"y1"),getBottom:ke(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}class Ae{constructor(t){if(this.xExtent=new Pt,this.yExtent=new Pt,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=t,this.buffer=new Mt(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=It(t.timeAccessor||t.xAccessor,"time"),this.getY=It(t.valueAccessor||t.yAccessor,"value")):(this.getX=It(t.xAccessor,"x"),this.getY=It(t.yAccessor,"y")),this.getGroup=zt(t.groupAccessor),this.getCategory=zt(t.categoryAccessor),this.getSize=t.sizeAccessor?It(t.sizeAccessor,"size"):void 0,this.getColor=zt(t.colorAccessor),this.getY0=t.y0Accessor?It(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=we(t),this.getPointId=zt(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,n=null!=t.closeAccessor;this.getOpen=e?It(t.openAccessor,"open"):void 0,this.getHigh=It(t.highAccessor,"high"),this.getLow=It(t.lowAccessor,"low"),this.getClose=n?It(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!n}t.pulse&&(this.timestampBuffer=new Mt(t.windowSize))}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(i)&&this.yExtent.push(i)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return!1;const e="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){if(this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?It(this.config.timeAccessor||this.config.xAccessor,"time"):It(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],n=this.config.xAccessor,i="function"==typeof n?n(e):e[n||"x"],o=i instanceof Date,r="string"==typeof i&&i.length>=10&&!isNaN(new Date(i).getTime())&&isNaN(Number(i));if(this.xIsDate=o||r,r){const t="string"==typeof n?n:void 0;this.getX=t?e=>+new Date(e[t]):t=>+(n(t)instanceof Date?n(t):new Date(n(t)))}}const n=t.totalSize||t.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of t.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(e),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));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const t of this.resolvedRibbons){const e=t.getTop(n),i=t.getBottom(n);Number.isFinite(e)&&this.yExtent.push(e),Number.isFinite(i)&&this.yExtent.push(i)}}}else for(const n of t.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity||1e6;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const t=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(e),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));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const t of this.resolvedRibbons){const e=t.getTop(n),i=t.getBottom(n);Number.isFinite(e)&&this.yExtent.push(e),Number.isFinite(i)&&this.yExtent.push(i)}}if(null!=t)if(this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t));else{this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(i)&&this.yExtent.evict(i)}}}return!0}computeScene(t){var e,n,i,o,r,l,s,a,c,u,d,h,f,g;const{config:y,buffer:p}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(e=this.config.scalePadding)&&void 0!==e?e:0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(p,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),m=this.xExtent.extent,x=this.yExtent.extent;let A=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:m[0],null!==(i=y.xExtent[1])&&void 0!==i?i:m[1]]:m,_=y.yExtent?[null!==(o=y.yExtent[0])&&void 0!==o?o:x[0],null!==(r=y.yExtent[1])&&void 0!==r?r:x[1]]:x;const S=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],M="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!S&&p.size>0)if(y.normalize)_=[0,M?1:1+y.extentPadding];else{const t=`${p.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(s=y.stackOrder)&&void 0!==s?s:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===t)_=this._stackExtentCache.yDomain;else{const e=this.groupData(v),n=new Map,i=new Set;let o=0;const r=new Map,l=new Map;for(const t of e){const e=new Map;let s=0;for(const n of t.data){const t=this.getX(n),l=this.getY(n);if(!Number.isFinite(t)||!Number.isFinite(l))continue;e.set(t,(e.get(t)||0)+l),i.add(t),s+=l;const a=(r.get(t)||0)+l;r.set(t,a),a>o&&(o=a)}n.set(t.key,e),l.set(t.key,s)}const s=null!==(a=y.stackOrder)&&void 0!==a?a:"key",f=(t,e)=>e>t?-1:t>e?1:0;let g;if("insideOut"===s){const t=[...e].map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(e))&&void 0!==n?n:0)-(null!==(i=l.get(t))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}),n=[],i=[];let o=0,r=0;for(const e of t)r>o?(n.push(e),o+=null!==(c=l.get(e))&&void 0!==c?c:0):(i.push(e),r+=null!==(u=l.get(e))&&void 0!==u?u:0);g=[...i.reverse(),...n]}else g="asc"===s?e.map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(t))&&void 0!==n?n:0)-(null!==(i=l.get(e))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}):"desc"===s?e.map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(e))&&void 0!==n?n:0)-(null!==(i=l.get(t))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}):e.map(t=>t.key).sort(f);if("wiggle"===y.baseline||"silhouette"===y.baseline){const t=Array.from(i).sort((t,e)=>t-e),e=Ot(t,g,(t,e)=>{var i;return(null===(i=n.get(t))||void 0===i?void 0:i.get(e))||0},y.baseline);let o=1/0,l=-1/0;for(const n of t){const t=null!==(d=e.get(n))&&void 0!==d?d:0,i=null!==(h=r.get(n))&&void 0!==h?h:0;o>t&&(o=t),t+i>l&&(l=t+i)}Number.isFinite(o)&&Number.isFinite(l)||(o=0,l=0);const s=l-o,a=M?0:s>0?s*y.extentPadding:1;_=[o-a,l+a]}else _=[0,o+(M?0:o>0?o*y.extentPadding:1)];this._stackExtentCache={key:t,yDomain:_}}}else if("bar"===y.chartType&&y.binSize&&!S&&p.size>0){const[,t]=function(t,e,n,i,o){const r=Ct(t,e,n,i,o);if(0===r.size)return[0,0];let l=0;for(const t of r.values())t.total>l&&(l=t.total);return[0,l]}(p,this.getX,this.getY,y.binSize,this.getCategory);_=[0,M?t:t+t*y.extentPadding]}else if("waterfall"===y.chartType&&!S&&p.size>0){const[t,e]=function(t,e){let n=0,i=0,o=0;for(const r of t){const t=e(r);null==t||Number.isNaN(t)||(o+=t,n>o&&(n=o),o>i&&(i=o))}return[n,i]}(p,this.getY),n=e-t,i=M?0:n>0?n*y.extentPadding:1;_=[Math.min(0,t-Math.abs(i)),Math.max(0,e+Math.abs(i))]}else if(!S&&_[0]!==1/0){if(this.resolvedRibbons.length>0)for(const t of v)for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&(_[0]>n&&(_[0]=n),n>_[1]&&(_[1]=n)),Number.isFinite(i)&&(_[0]>i&&(_[0]=i),i>_[1]&&(_[1]=i))}const t=_[1]-_[0],e=M?0:t>0?t*y.extentPadding:1,n=null===(f=y.yExtent)||void 0===f?void 0:f[0],i=null===(g=y.yExtent)||void 0===g?void 0:g[1];_=[null!=n?_[0]:_[0]-e,null!=i?_[1]:_[1]+e],"log"!==y.yScaleType||_[0]>0||0>=x[0]||M||(_[0]=null!=n?_[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!S){const t=y.yExtent[0],e=y.yExtent[1];null==t&&null==e||(_=[null!=t?t:_[0],null!=e?e:_[1]])}if(A[0]===1/0||A[1]===-1/0)if("time"===y.xScaleType){const t=Date.now();A=[t-864e5,t]}else A=[0,1];_[0]!==1/0&&_[1]!==-1/0||(_=[0,1]);const P="streaming"===y.runtimeMode,C=Math.max(0,Math.min(y.scalePadding||0,Math.min(t.width,t.height)/2-1));if(P)if("x"==("up"===(T=y.arrowOfTime)||"down"===T?"y":"x")){const e="right"===y.arrowOfTime?[C,t.width-C]:[t.width-C,C];this.scales={x:b().domain(A).range(e),y:b().domain(_).range([t.height-C,C])}}else{const e="down"===y.arrowOfTime?[C,t.height-C]:[t.height-C,C];this.scales={x:b().domain(_).range([C,t.width-C]),y:b().domain(A).range(e)}}else{const e=(t,e,n)=>{if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return k().domain(t).range(n).clamp(!0)}return"time"===t?w().domain([new Date(e[0]),new Date(e[1])]).range(n):b().domain(e).range(n)};this.scales={x:e(y.xScaleType,A,[C,t.width-C]),y:e(y.yScaleType,_,[t.height-C,C])}}var T;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(t,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}rebuildQuadtree(){const t=this.config.chartType;if("scatter"!==t&&"bubble"!==t)return this._quadtree=null,void(this._maxPointRadius=0);let e=0,n=0;for(const t of this.scene)"point"===t.type&&(e++,t.r>n&&(n=t.r));if(this._maxPointRadius=n,Ae.QUADTREE_THRESHOLD>=e)return void(this._quadtree=null);const i=Array(e);let o=0;for(const t of this.scene)"point"===t.type&&(i[o++]=t);this._quadtree=A().x(t=>t.x).y(t=>t.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,n=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const i of t.path)i[0]*=e,i[1]*=n;break;case"area":for(const i of t.topPath)i[0]*=e,i[1]*=n;for(const i of t.bottomPath)i[0]*=e,i[1]*=n;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*n,width:t.clipRect.width*e,height:t.clipRect.height*n});break;case"point":t.x*=e,t.y*=n;break;case"rect":case"heatcell":t.x*=e,t.y*=n,t.w*=e,t.h*=n;break;case"candlestick":t.x*=e,t.openY*=n,t.closeY*=n,t.highY*=n,t.lowY*=n}const i=this.scales.x.domain(),o=this.scales.y.domain(),r=this.scales.x.range(),l=this.scales.y.range(),s=(t,e,n)=>{if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return k().domain(t).range(n).clamp(!0)}return"time"===t?w().domain([new Date(e[0]),new Date(e[1])]).range(n):b().domain(e).range(n)},a=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=l[1]>l[0];this.scales={x:s(this.config.xScaleType,i,r[0]>r[1]?[t.width-a,a]:[a,t.width-a]),y:s(this.config.yScaleType,o,c?[a,t.height-a]:[t.height-a,a])},this.lastLayout={width:t.width,height:t.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(t,e){var n,i,o,r,l,s,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},d={data:e,scales:u,dimensions:{width:t.width,height:t.height,margin:a,plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(i=c.themeSemantic)&&void 0!==i?i:{},categorical:null!==(o=c.themeCategorical)&&void 0!==o?o:ie},resolveColor:(t,e)=>{var n,i;const o=this.resolveGroupColor(t);if(o)return o;const r=this.resolveLineStyle(t,e);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(i=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==i?i:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(t){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(l=h.overlays)&&void 0!==l?l:null,null!==(s=h.nodes)&&void 0!==s?s:[]}if(this.customLayoutOverlays=null,0===e.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(t,e){var n;const i=t.groupData(e),o=[],r=null===(n=t.config.annotations)||void 0===n?void 0:n.filter(t=>"threshold"===t.type&&t.color).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:n,aggregate:r}=he(t.ribbons);if(r.length>0&&o.push(...fe(t,e,r)),n.length>0)for(const e of i)o.push(...ge(t,e.data,e.key,n))}for(const e of i){const n=t.resolveLineStyle(e.key,e.data[0]),i=Tt(e.data,t.scales,t.getX,t.getY,n,e.key);r&&r.length>0&&(i.colorThresholds=r),t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),o.push(i)}return pe(t,i,o),o}(d,e);case"area":return function(t,e){const n=t.groupData(e),i=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:r}=he(t.ribbons);if(r.length>0&&i.push(...fe(t,e,r)),o.length>0)for(const e of n)i.push(...ge(t,e.data,e.key,o))}const o=t.scales.y.domain()[0],r=t.getY0?e=>{const n=t.getY0(e);return null==n?o:n}:void 0;for(const e of n){const n=t.resolveAreaStyle(e.key,e.data[0]),l=Et(e.data,t.scales,t.getX,t.getY,o,n,e.key,r),s=me(t.config.gradientFill);s&&(l.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(l.curve=t.config.curve),t.config.lineGradient&&(l.strokeGradient=t.config.lineGradient),i.push(l)}return pe(t,n,i),i}(d,e);case"mixed":return function(t,e){const n=t.groupData(e),i=[],o=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:r}=he(t.ribbons);if(r.length>0&&i.push(...fe(t,e,r)),o.length>0)for(const e of n)i.push(...ge(t,e.data,e.key,o))}const r=t.scales.y.domain()[0],l=t.getY0?e=>{const n=t.getY0(e);return null==n?r:n}:void 0;for(const e of n)if(o.has(e.key)){const n=t.resolveAreaStyle(e.key,e.data[0]),o=Et(e.data,t.scales,t.getX,t.getY,r,n,e.key,l),s=me(t.config.gradientFill);s&&(o.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),i.push(o)}else{const n=t.resolveLineStyle(e.key,e.data[0]),o=Tt(e.data,t.scales,t.getX,t.getY,n,e.key);t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),i.push(o)}return pe(t,n,i),i}(d,e);case"stackedarea":return function(t,e){var n,i,o,r;const l=t.groupData(e),s=null!==(n=t.config.stackOrder)&&void 0!==n?n:"key",a=()=>l.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("key"===s)a();else if("asc"===s||"desc"===s||"insideOut"===s){const e=new Map;for(const n of l){let i=0;for(const e of n.data){const n=t.getX(e),o=t.getY(e);Number.isFinite(n)&&Number.isFinite(o)&&(i+=o)}e.set(n.key,i)}const n=(t,e)=>e>t?-1:t>e?1:0;if("asc"===s)l.sort((t,i)=>{var o,r;const l=(null!==(o=e.get(t.key))&&void 0!==o?o:0)-(null!==(r=e.get(i.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)});else if("desc"===s)l.sort((t,i)=>{var o,r;const l=(null!==(o=e.get(i.key))&&void 0!==o?o:0)-(null!==(r=e.get(t.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)});else{const t=[...l].sort((t,i)=>{var o,r;const l=(null!==(o=e.get(i.key))&&void 0!==o?o:0)-(null!==(r=e.get(t.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)}),r=[],s=[];let a=0,c=0;for(const n of t)c>a?(r.push(n),a+=null!==(i=e.get(n.key))&&void 0!==i?i:0):(s.push(n),c+=null!==(o=e.get(n.key))&&void 0!==o?o:0);l.length=0,l.push(...s.reverse(),...r)}}else a();const c=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,u=t.config.normalize?"zero":null!==(r=t.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(t,e,n,i,o,r,l,s="zero"){var a,c;const u=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&u.add(e)}const d=Array.from(u).sort((t,e)=>t-e),h=new Map;for(const e of t){const t=new Map;for(const o of e.data){const e=n(o),r=i(o);Number.isFinite(e)&&Number.isFinite(r)&&t.set(e,(t.get(e)||0)+r)}h.set(e.key,t)}let f;if(r){f=new Map;for(const e of d){let n=0;for(const i of t)n+=(null===(a=h.get(i.key))||void 0===a?void 0:a.get(e))||0;f.set(e,n||1)}}const g=Ot(d,t.map(t=>t.key),(t,e)=>{var n;return(null===(n=h.get(t))||void 0===n?void 0:n.get(e))||0},s),y=[],p=new Map,v=new Map;for(const t of d)v.set(t,null!==(c=g.get(t))&&void 0!==c?c:0);for(const n of t){const t=h.get(n.key),i=[],s=[],a=new Map;for(const n of d){let o=t.get(n)||0;const l=v.get(n);r&&(o/=f.get(n));const c=l+o,u=e.x(n);s.push([u,e.y(l)]),i.push([u,e.y(c)]),v.set(n,c),a.set(n,c)}p.set(n.key,a);const c={type:"area",topPath:i,bottomPath:s,style:o(n.key,n.data[0]),datum:n.data,group:n.key};l&&(c.curve=l),y.push(c)}return{nodes:y,stackedTops:p}}(l,t.scales,t.getX,t.getY,(e,n)=>t.resolveAreaStyle(e,n),t.config.normalize,c,u),f=d;if(t.config.pointStyle){const e=new WeakMap;for(const n of l){const i=h.get(n.key);if(i)for(const o of n.data){const n=t.getX(o),r=t.getY(o);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!i.has(n)||e.set(o,i.get(n))}}const n=n=>{var i;return null!==(i=e.get(n))&&void 0!==i?i:t.getY(n)};pe(t,l,f,n)}return f}(d,e);case"scatter":case"bubble":return function(t,e){var n;const i=[],o="bubble"===t.config.chartType?10:5,r=t.config.sizeRange||[3,15];let l=null;if(t.getSize&&!t.config.pointStyle){const n=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(n.length>0){let t=1/0,e=-1/0;for(const i of n)t>i&&(t=i),i>e&&(e=i);l=n=>t===e?(r[0]+r[1])/2:r[0]+(n-t)/(e-t)*(r[1]-r[0])}}const s=t.getColor?t.resolveColorMap(e):null,a=(null===(n=t.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of e){let e=t.config.pointStyle?t.config.pointStyle(n):{fill:a,opacity:.8},r=e.r||o;if(l&&t.getSize){const e=t.getSize(n);null==e||Number.isNaN(e)||(r=l(e))}if(s&&t.getColor&&!e.fill){const i=t.getColor(n);i&&s.has(i)&&(e=Object.assign(Object.assign({},e),{fill:s.get(i)}))}const c=t.getPointId?t.getPointId(n)+"":void 0,u=Dt(n,t.scales,t.getX,t.getY,r,e,c);u&&i.push(u)}return i}(d,e);case"heatmap":return function(t,e,n){if(t.config.heatmapAggregation)return function(t,e,n){var i,o,r;const l=Math.max(1,Math.floor(null!==(i=t.config.heatmapXBins)&&void 0!==i?i:20)),s=Math.max(1,Math.floor(null!==(o=t.config.heatmapYBins)&&void 0!==o?o:20)),a=null!==(r=t.config.heatmapAggregation)&&void 0!==r?r:"count",c=It(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[u,d]=t.scales.x.domain(),[h,f]=t.scales.y.domain(),g=(d-u||1)/l,y=(f-h||1)/s,p=l*s;if(p>1e6)return[];const v=new Int32Array(p),m=new Float64Array(p);for(let n=0;e.length>n;n++){const i=e[n],o=t.getX(i),r=t.getY(i);if(!isFinite(o)||!isFinite(r))continue;const a=Math.min(Math.floor((o-u)/g),l-1),d=Math.min(Math.floor((r-h)/y),s-1);if(0>a||0>d)continue;const f=d*l+a;v[f]++;const p=c(i);m[f]+=isFinite(p)?p:0}let x=1/0,b=-1/0;for(let t=0;p>t;t++){if(0===v[t])continue;let e;switch(a){case"sum":e=m[t];break;case"mean":e=m[t]/v[t];break;default:e=v[t]}x>e&&(x=e),e>b&&(b=e)}if(!isFinite(x))return[];const k=b-x||1,w=n.width/l,A=n.height/s,_=t.config.showValues,S=t.config.heatmapValueFormat,M=[];for(let t=0;s>t;t++){const e=t*l;for(let n=0;l>n;n++){const i=e+n;if(0===v[i])continue;let o;switch(a){case"sum":o=m[i];break;case"mean":o=m[i]/v[i];break;default:o=v[i]}const r=(o-x)/k;M.push(Nt(n*w,(s-1-t)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:t,value:o,count:v[i],sum:m[i],xCenter:u+(n+.5)*g,yCenter:h+(t+.5)*y,agg:a},_?{value:o,showValues:!0,valueFormat:S}:void 0))}}return M}(t,e,n);if(0===e.length)return[];const i=It(t.config.valueAccessor,"value"),o=Wt(t.config.xAccessor,"x"),r=Wt(t.config.yAccessor,"y"),l=new Map,s=new Map,a=Array(e.length),c=Array(e.length);for(let t=0;e.length>t;t++){const n=e[t],i=o(n),u=r(n);a[t]=i,c[t]=u,l.has(i)||l.set(i,l.size),s.has(u)||s.set(u,s.size)}const u=l.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(l.keys()),f=Array.from(s.keys()),g=h.every(t=>"number"==typeof t&&!isNaN(t)),y=f.every(t=>"number"==typeof t&&!isNaN(t));if(g){h.sort((t,e)=>t-e),l.clear();for(let t=0;h.length>t;t++)l.set(h[t],t)}if(y){f.sort((t,e)=>t-e),s.clear();for(let t=0;f.length>t;t++)s.set(f[t],t)}const p=new Float64Array(e.length),v=new Float64Array(e.length),m=Array(e.length),x=new Map;let b=0;for(let t=0;e.length>t;t++){const n=e[t],o=l.get(a[t]),r=s.get(c[t]);if(void 0===o||void 0===r)continue;const d=i(n),h=r*u+o,f=x.get(h);let g;void 0!==f?g=f:(g=b++,x.set(h,g)),p[g]=h,v[g]=d,m[g]=n}let k=1/0,w=-1/0;for(let t=0;b>t;t++){const e=v[t];isFinite(e)&&(k>e&&(k=e),e>w&&(w=e))}if(!isFinite(k)||!isFinite(w))return[];const A=function(t){const e=t in xe?t:"blues";let n=be.get(e);if(n)return n;n=Array(256);const i=xe[e]||Bt;for(let t=0;256>t;t++)n[t]=i(t/255);return be.set(e,n),n}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),_=255/(w-k||1),S=n.width/u,M=n.height/d,P=t.config.showValues,C=t.config.heatmapValueFormat,T=[];for(let t=0;b>t;t++){const e=v[t];if(!isFinite(e))continue;const n=p[t],i=n%u;T.push(Nt(i*S,(d-1-(n-i)/u)*M,S,M,A[Math.min((e-k)*_+.5|0,255)],m[t],P?{value:e,showValues:!0,valueFormat:C}:void 0))}return T}(d,e,t);case"bar":{const t=function(t,e){var n,i;if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const o=Ct(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(t.getCategory){const e=new Set;for(const t of o.values())for(const n of t.categories.keys())e.add(n);const n=t.config.barColors?Object.keys(t.config.barColors):[],i=new Set(n),l=Array.from(e).filter(t=>!i.has(t)).sort(),s=n.filter(t=>e.has(t)),a=s.join("\0")+""+l.join("\0");t.barCategoryCache&&t.barCategoryCache.key===a?r=t.barCategoryCache.order:(r=[...s,...l],t.barCategoryCache={key:a,order:r})}const l=[],s=t.scales,[a,c]=s.x.domain(),u=t.config.barStyle,d=null===(n=t.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const e of o.values()){const n=Math.max(e.start,a),o=Math.min(e.end,c);if(n>=o)continue;const h=s.x(n),y=s.x(o),p=Math.abs(y-h),v=p>f+1?f:0,m=Math.min(h,y)+v/2,x=Math.max(p-v,1);if(x>0)if(r&&e.categories.size>0){let n=0;for(const o of r){const r=e.categories.get(o)||0;if(0===r)continue;const a=s.y(n),c=s.y(n+r),h=(null===(i=t.config.barColors)||void 0===i?void 0:i[o])||(null==u?void 0:u.fill)||d||"#4e79a7";l.push(Lt(m,Math.min(a,c),x,Math.abs(a-c),Object.assign({fill:h},g),{binStart:e.start,binEnd:e.end,total:e.total,category:o,categoryValue:r},o)),n+=r}}else{const t=s.y(0),n=s.y(e.total);l.push(Lt(m,Math.min(t,n),x,Math.abs(t-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:e.start,binEnd:e.end,total:e.total}))}}const y=new Set;for(const t of o.values())y.add(t.start),y.add(t.end);return{nodes:l,binBoundaries:Array.from(y).sort((t,e)=>t-e)}}(d,e);return this._barCategoryCache=null!==(a=d.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){var n,i,o,r,l,s;const a=[],c=t.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(i=c.fill)&&void 0!==i?i:null===(o=t.config.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==r?r:"#007bff",h=null!==(l=c.opacity)&&void 0!==l?l:.7,f=c.stroke,g=c.strokeWidth;for(const n of e){const e=t.getX(n),i=t.getY(n);if(null==i||Number.isNaN(i))continue;const o=t.scales.x(e),r=t.scales.y(i);let l=d;if(t.getCategory){const e=t.getCategory(n);l=(null===(s=t.config.barColors)||void 0===s?void 0:s[e])||l}const c={type:"point",x:o,y:r,r:u,style:{fill:l,opacity:h,stroke:f,strokeWidth:g},datum:n};t.getPointId&&(c.pointId=t.getPointId(n)+""),a.push(c)}return a}(d,e);case"waterfall":return function(t,e,n){var i,o,r,l,s,a,c;const u=[],d=t.scales,h=t.config.waterfallStyle,f=e.filter(e=>{const n=t.getY(e),i=t.getX(e);return null!=n&&!Number.isNaN(n)&&null!=i&&isFinite(i)});if(0===f.length)return u;const g=null!==(r=null!==(i=null==h?void 0:h.positiveColor)&&void 0!==i?i:null===(o=t.config.themeSemantic)||void 0===o?void 0:o.success)&&void 0!==r?r:"#28a745",y=null!==(a=null!==(l=null==h?void 0:h.negativeColor)&&void 0!==l?l:null===(s=t.config.themeSemantic)||void 0===s?void 0:s.danger)&&void 0!==a?a:"#dc3545",p=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,v=null==h?void 0:h.stroke,m=null==h?void 0:h.strokeWidth,x=null==h?void 0:h.opacity;let b=0;for(let e=0;f.length>e;e++){const i=f[e],o=t.getX(i),r=t.getY(i),l=b+r;let s;s=f.length-1>e?t.getX(f[e+1])-o:e>0?o-t.getX(f[e-1]):0;const a=d.x(o),c=0!==s?d.x(o+s):a+n.width/10,k=Math.min(a,c)+p/2,w=Math.max(a,c)-p/2-k;if(0>=w){b=l;continue}const A=d.y(b),_=d.y(l),S=Math.min(A,_),M=Math.abs(A-_),P={fill:0>r?y:g,stroke:v,strokeWidth:m};null!=x&&(P.opacity=x),u.push(Lt(k,S,w,M,P,Object.assign(Object.assign({},i),{baseline:b,cumEnd:l,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),b=l}return u}(d,e,t);case"candlestick":return function(t,e){var n,i;if(!t.getHigh||!t.getLow||!t.scales)return[];const o=null!==(n=t.config.candlestickRangeMode)&&void 0!==n&&n;if(!(o||t.getOpen&&t.getClose))return[];const r=[],l=t.config.candlestickStyle||{},s=l.rangeColor||"#6366f1",a=o?s:l.upColor||"#28a745",c=o?s:l.downColor||"#dc3545",u=o?s:l.wickColor||"#333",d=l.wickWidth||(o?2:1),h=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let f=null!==(i=l.bodyWidth)&&void 0!==i?i:0;if(null==l.bodyWidth)if(h.length>1){let e=1/0;for(let n=1;h.length>n;n++){const i=Math.abs(t.scales.x(h[n])-t.scales.x(h[n-1]));i>0&&e>i&&(e=i)}f=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else f=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const i=t.getHigh(n),l=t.getLow(n);if(null==i||Number.isNaN(i)||null==l||Number.isNaN(l))continue;const s=o?i:t.getOpen(n),h=o?l:t.getClose(n);if(!o&&[s,h].some(t=>null==t||Number.isNaN(t)))continue;const g=h>=s,y={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(s),closeY:t.scales.y(h),highY:t.scales.y(i),lowY:t.scales.y(l),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};o&&(y.isRange=!0),r.push(y)}return r}(d,e);default:return[]}}resolveBoundsStyle(t,e){var n;const i=this.config.boundsStyle;return"function"==typeof i?i(e||{},t):i&&"object"==typeof i?i:{fill:this.resolveLineStyle(t,e).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(t,e){const n=this.config.decay;return n&&e>1?oe(n,t,e):1}applyDecay(t,e){this.config.decay&&function(t,e,n){var i,o;const r=n.length;if(1>=r)return;const l=new Map;for(let t=0;n.length>t;t++)l.set(n[t],t);for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const i=Array(e.length);let o=!1;for(let n=0;e.length>n;n++){const s=l.get(e[n]);null!=s?(i[n]=oe(t,s,r),1>i[n]&&(o=!0)):i[n]=1}o&&(n._decayOpacities=i);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:e.length;if(2>i)continue;if(e.length===i){const o=Array(i);let s=!1;for(let n=0;e.length>n;n++){const i=l.get(e[n]);null!=i?(o[n]=oe(t,i,r),1>o[n]&&(s=!0)):o[n]=1}s&&(n._decayOpacities=o)}else{let o=1;for(const n of e){const e=l.get(n);if(null!=e){const n=oe(t,e,r);o>n&&(o=n)}}if(1>o){const t=Array(i);t.fill(o),n._decayOpacities=t}}continue}const e=l.get(n.datum);if(null==e)continue;const s=oe(t,e,r);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const t=null!==(o=null===(i=n.style)||void 0===i?void 0:i.opacity)&&void 0!==o?o:1;n.style=Object.assign(Object.assign({},n.style),{opacity:t*s})}}}(this.config.decay,t,e)}applyPulse(t,e){this.config.pulse&&this.timestampBuffer&&function(t,e,n,i){var o,r;const l="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=t.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",a=null!==(r=t.glowRadius)&&void 0!==r?r:4,c=new Map;for(let t=0;n.length>t;t++)c.set(n[t],t);for(const n of e){if("line"===n.type)continue;if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[n.datum];let o=0;for(const n of e){const e=c.get(n);if(null==e)continue;const r=i.get(e);if(null==r)continue;const s=re(t,r,l);s>o&&(o=s)}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=i.get(e);if(null==o)continue;const r=re(t,o,l);r>0&&(n._pulseIntensity=r,n._pulseColor=s,n._pulseGlowRadius=a)}}(this.config.pulse,t,e,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(t,e){var n;if(!e||0===e.size)return!1;const i="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(n=t.duration)&&void 0!==n?n:500,r=e.peek();return null!=r&&o>i-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,n,i){var o,r,l,s;n.clear(),i.clear();for(let a=0;e.length>a;a++){const c=e[a],u=ce(t,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(o=c.style)||void 0===o?void 0:o.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?i.set(u,{path:c.path.map(t=>[t[0],t[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}):"area"===c.type&&i.set(u,{topPath:c.topPath.map(t=>[t[0],t[1]]),bottomPath:c.bottomPath.map(t=>[t[0],t[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var t,e,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const i=null!==(e=null===(t=this.scales)||void 0===t?void 0:t.y(0))&&void 0!==e?e:0;for(let t=0;this.scene.length>t;t++){const e=this.scene[t],o=ce(this.transitionContext,e,t);o&&("point"===e.type?this.prevPositionMap.set(o,{x:e.x,y:e.y,r:0,opacity:0}):"rect"===e.type?this.prevPositionMap.set(o,{x:e.x,y:i,w:e.w,h:0,opacity:null!==(n=e.style.opacity)&&void 0!==n?n:1}):"heatcell"===e.type?this.prevPositionMap.set(o,{x:e.x,y:e.y,w:e.w,h:e.h,opacity:0}):"line"===e.type?(e._introClipFraction=0,this.prevPathMap.set(o,{path:e.path.map(t=>[t[0],t[1]]),opacity:e.style.opacity})):"area"===e.type&&(e._introClipFraction=0,this.prevPathMap.set(o,{topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),opacity:e.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,n,i,o){var r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,_,S,M,P,C,T,E,O,D,L,N,$,I,W,z,R,F,Y,j,B,H,X;if(0===i.size&&0===o.size)return n;const G=null!==(r=e.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let e=0;n.scene.length>e;e++){const r=n.scene[e],E=ce(t,r,e);if(!E)continue;if(r._transitionKey=E,"line"===r.type||"area"===r.type){const t=o.get(E);if(t){if(U.add(E),"line"===r.type&&t.path&&t.path.length===r.path.length){r._targetPath=r.path.map(t=>[t[0],t[1]]),r._prevPath=t.path;for(let e=0;r.path.length>e;e++)r.path[e]=[t.path[e][0],t.path[e][1]];V=!0}else if("area"===r.type&&t.topPath&&t.bottomPath&&t.topPath.length===r.topPath.length&&t.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(t=>[t[0],t[1]]),r._targetBottomPath=r.bottomPath.map(t=>[t[0],t[1]]),r._prevTopPath=t.topPath,r._prevBottomPath=t.bottomPath;for(let e=0;r.topPath.length>e;e++)r.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;r.bottomPath.length>e;e++)r.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];V=!0}r._targetOpacity=null!==(l=r.style.opacity)&&void 0!==l?l:1,r._startOpacity=null!==(a=null!==(s=t.opacity)&&void 0!==s?s:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const O=i.get(E);if("point"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,O.x===t.x&&O.y===t.y&&O.r===t.r||(r._targetX=t.x,r._targetY=t.y,r._targetR=t.r,r.x=O.x,r.y=O.y,r.r=null!==(d=O.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,O.x===t.x&&O.y===t.y&&O.w===t.w&&O.h===t.h||(r._targetX=t.x,r._targetY=t.y,r._targetW=t.w,r._targetH=t.h,r.x=O.x,r.y=O.y,r.w=null!==(g=O.w)&&void 0!==g?g:r.w,r.h=null!==(y=O.h)&&void 0!==y?y:r.h,V=!0)}else r._targetOpacity=null!==(p=r.style.opacity)&&void 0!==p?p:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m:1,O.x===t.x&&O.y===t.y&&O.w===t.w&&O.h===t.h||(r._targetX=t.x,r._targetY=t.y,r._targetW=t.w,r._targetH=t.h,r.x=O.x,r.y=O.y,r.w=null!==(x=O.w)&&void 0!==x?x:r.w,r.h=null!==(b=O.h)&&void 0!==b?b:r.h,V=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(O&&null!=O.openY){q.add(E);const t={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(_=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==_?_:1,(O.x!==t.x||O.openY!==t.openY||O.closeY!==t.closeY||O.highY!==t.highY||O.lowY!==t.lowY)&&(r._targetX=t.x,r._targetOpenY=t.openY,r._targetCloseY=t.closeY,r._targetHighY=t.highY,r._targetLowY=t.lowY,r.x=O.x,r.openY=O.openY,r.closeY=null!==(S=O.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(M=O.highY)&&void 0!==M?M:r.highY,r.lowY=null!==(P=O.lowY)&&void 0!==P?P:r.lowY,V=!0)}else r._targetOpacity=null!==(T=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==T?T:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[t,e]of o)if(!U.has(t))if(t.startsWith("l:")&&e.path){const i={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(E=e.opacity)&&void 0!==E?E:1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(i),V=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const i={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:null!==(O=e.opacity)&&void 0!==O?O:1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(i),V=!0}for(const[t,e]of i)if(!q.has(t)){if(t.startsWith("p:")){const i={type:"point",x:e.x,y:e.y,r:null!==(D=e.r)&&void 0!==D?D:3,style:{opacity:null!==(L=e.opacity)&&void 0!==L?L:1},datum:null,_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("r:")){const i={type:"rect",x:e.x,y:e.y,w:null!==(N=e.w)&&void 0!==N?N:0,h:null!==($=e.h)&&void 0!==$?$:0,style:{opacity:null!==(I=e.opacity)&&void 0!==I?I:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("h:")){const i={type:"heatcell",x:e.x,y:e.y,w:null!==(W=e.w)&&void 0!==W?W:0,h:null!==(z=e.h)&&void 0!==z?z:0,fill:"#999",datum:null,style:{opacity:null!==(R=e.opacity)&&void 0!==R?R:1},_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("c:")){const i=null!==(F=e.openY)&&void 0!==F?F:e.y,o={type:"candlestick",x:e.x,openY:i,closeY:null!==(Y=e.closeY)&&void 0!==Y?Y:i,highY:null!==(j=e.highY)&&void 0!==j?j:i,lowY:null!==(B=e.lowY)&&void 0!==B?B:i,bodyWidth:null!==(H=e.w)&&void 0!==H?H:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(X=e.opacity)&&void 0!==X?X:1},_targetOpacity:0,_transitionKey:t};n.exitNodes.push(o)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:G}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(t,e,n,i){var o,r,l,s,a,c;if(!n.activeTransition)return!1;const u=se(t,n.activeTransition),d=le(u,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of n.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;t.style.opacity=ae(r,t._targetOpacity,d)}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==t._targetR&&void 0!==n.r&&(t.r=ae(n.r,t._targetR,d))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;t.style.opacity=ae(o,t._targetOpacity,d)}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==n.w&&(t.w=ae(n.w,t._targetW,d)),void 0!==n.h&&(t.h=ae(n.h,t._targetH,d))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;t.style=Object.assign(Object.assign({},t.style||{}),{opacity:ae(o,t._targetOpacity,d)})}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==n.w&&(t.w=ae(n.w,t._targetW,d)),void 0!==n.h&&(t.h=ae(n.h,t._targetH,d))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;t.style=Object.assign(Object.assign({},t.style||{}),{opacity:ae(o,t._targetOpacity,d)})}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),void 0!==n.openY&&(t.openY=ae(n.openY,t._targetOpenY,d)),void 0!==n.closeY&&(t.closeY=ae(n.closeY,t._targetCloseY,d)),void 0!==n.highY&&(t.highY=ae(n.highY,t._targetHighY,d)),void 0!==n.lowY&&(t.lowY=ae(n.lowY,t._targetLowY,d))}else if("line"===t.type){if(void 0!==t._targetOpacity){const e=null!==(a=t._startOpacity)&&void 0!==a?a:0;t.style=Object.assign(Object.assign({},t.style),{opacity:ae(e,t._targetOpacity,d)})}void 0!==t._introClipFraction&&(t._introClipFraction=d);const e=t._prevPath,n=t._targetPath;if(e&&n&&e.length===t.path.length)for(let i=0;t.path.length>i;i++)t.path[i][0]=ae(e[i][0],n[i][0],d),t.path[i][1]=ae(e[i][1],n[i][1],d)}else if("area"===t.type){if(void 0!==t._targetOpacity){const e=null!==(c=t._startOpacity)&&void 0!==c?c:0;t.style=Object.assign(Object.assign({},t.style),{opacity:ae(e,t._targetOpacity,d)})}void 0!==t._introClipFraction&&(t._introClipFraction=d);const e=t._prevTopPath,n=t._prevBottomPath,i=t._targetTopPath,o=t._targetBottomPath;if(e&&i&&e.length===t.topPath.length)for(let n=0;t.topPath.length>n;n++)t.topPath[n][0]=ae(e[n][0],i[n][0],d),t.topPath[n][1]=ae(e[n][1],i[n][1],d);if(n&&o&&n.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=ae(n[e][0],o[e][0],d),t.bottomPath[e][1]=ae(n[e][1],o[e][1],d)}}if(u>=1){for(const t of n.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style=Object.assign(Object.assign({},"line"===t.type||"area"===t.type?t.style:t.style||{}),{opacity:0===e?0:e}),t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let n=0;t.path.length>n;n++)t.path[n]=e[n];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,n=t._targetBottomPath;if(e)for(let n=0;t.topPath.length>n;n++)t.topPath[n]=e[n];if(n)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=n[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const t of this.scene)"line"!==t.type&&"area"!==t.type||(t._introClipFraction=void 0)}groupData(t){if(!this.getGroup)return[{key:"_default",data:t}];const e=new Map;for(const n of t){const t=this.getGroup(n);e.has(t)||e.set(t,[]),e.get(t).push(n)}return Array.from(e.entries()).map(([t,e])=>({key:t,data:e}))}resolveColorMap(t){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const e=new Set;for(const n of t){const t=this.getColor(n);t&&e.add(t)}const n=Array.from(e).sort(),i=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===i)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ie,r=new Map;for(let t=0;n.length>t;t++)r.set(n[t],o[t%o.length]);return this._colorMapCache={key:i,map:r,version:this._ingestVersion},r}resolveLineStyle(t,e){var n;const i=this.config.lineStyle;if("function"==typeof i){const n=i(e||{},t);if(n&&!n.stroke&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{stroke:e})}return n}const o=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return i&&"object"==typeof i?{stroke:i.stroke||o||"#007bff",strokeWidth:i.strokeWidth||2,strokeDasharray:i.strokeDasharray,fill:i.fill,fillOpacity:i.fillOpacity,opacity:i.opacity}:{stroke:this.resolveGroupColor(t)||o||"#007bff",strokeWidth:2}}resolveAreaStyle(t,e){var n,i;if(this.config.areaStyle){const n=this.config.areaStyle(e||{});if(n&&!n.fill&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{fill:e,stroke:n.stroke||e})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(e||{},t);if(n&&!n.fill&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{fill:e,stroke:n.stroke||e})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||r||"#4e79a7",fillOpacity:null!==(i=o.fillOpacity)&&void 0!==i?i:.7,stroke:o.stroke||r||"#4e79a7",strokeWidth:o.strokeWidth||2};const l=this.resolveGroupColor(t)||r||"#4e79a7";return{fill:l,fillOpacity:.7,stroke:l,strokeWidth:2}}resolveGroupColor(t){if(this._colorMapCache){const e=this._colorMapCache.map.get(t);if(e)return e}const e=this._groupColorMap.get(t);if(e)return e;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ie;if(0===n.length)return null;const i=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(t,i),this._groupColorMap.size>Ae.GROUP_COLOR_MAP_CAP){const t=this._groupColorMap.keys().next().value;void 0!==t&&this._groupColorMap.delete(t)}return i}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=new Set(Array.isArray(t)?t:[t]),n=this.getPointId,i=t=>e.has(n(t));if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),e=new Set;this.buffer.forEach((t,n)=>{i(t)&&e.add(n)}),this.timestampBuffer.clear();for(let n=0;t.length>n;n++)e.has(n)||this.timestampBuffer.push(t[n])}const o=this.buffer.remove(i);if(0===o.length)return o;for(const t of o)this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t))):(this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,o}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(t)?t:[t]),i=this.getPointId,o=new Set;this.buffer.forEach((t,e)=>{n.has(i(t))&&o.add(e)});const r=this.buffer.update(t=>n.has(i(t)),e);if(0===r.length)return r;for(const t of r)this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t))):(this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t)));return this.buffer.forEach((t,e)=>{o.has(e)&&(this.xExtent.push(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(t)),this.yExtent.push(this.getLow(t))):(this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(t){var e,n,i,o;const r=Object.assign({},this.config);("colorScheme"in t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let l=!1,s=!1;Object.assign(this.config,t);const a="chartType"in t&&t.chartType!==r.chartType||"runtimeMode"in t&&t.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const c=a||!$t(null!==(e=t.xAccessor)&&void 0!==e?e:t.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!$t(null!==(i=t.yAccessor)&&void 0!==i?i:t.valueAccessor,null!==(o=r.yAccessor)&&void 0!==o?o:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=It(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=It(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=It(this.config.xAccessor,"x"),this.getY=It(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=we(this.config)),l=!0,s=!0)}if("groupAccessor"in t&&!$t(t.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?zt(this.config.groupAccessor):void 0,l=!0),"categoryAccessor"in t&&!$t(t.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?zt(this.config.categoryAccessor):void 0,l=!0),"sizeAccessor"in t&&!$t(t.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?It(this.config.sizeAccessor,"size"):void 0,l=!0),"colorAccessor"in t&&!$t(t.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?zt(this.config.colorAccessor):void 0,l=!0),"y0Accessor"in t&&!$t(t.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?It(this.config.y0Accessor,"y0"):void 0,l=!0,s=!0),("boundsAccessor"in t&&!$t(t.boundsAccessor,r.boundsAccessor)||"band"in t&&t.band!==r.band||"boundsStyle"in t&&t.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=we(this.config),l=!0,s=!0),"pointIdAccessor"in t&&!$t(t.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?zt(this.config.pointIdAccessor):void 0,l=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in t&&!$t(t.openAccessor,r.openAccessor)||"closeAccessor"in t&&!$t(t.closeAccessor,r.closeAccessor)||"highAccessor"in t&&!$t(t.highAccessor,r.highAccessor)||"lowAccessor"in t&&!$t(t.lowAccessor,r.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?It(this.config.openAccessor,"open"):void 0,this.getHigh=It(this.config.highAccessor,"high"),this.getLow=It(this.config.lowAccessor,"low"),this.getClose=e?It(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,l=!0,s=!0}if(!l){const e=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const n of e)if(t[n]!==r[n]){l=!0;break}}l&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function _e(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:i.createElement(i.Fragment,null,...e)}function Se(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>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 Me(t,e=30){return Math.max((null!=t?t:4)+5,12,e)}function Pe(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function Ce(t,e){const n=Pe(t);if(!n)return!1;const i=Pe(e);return!i||n.getFullYear()!==i.getFullYear()||n.getMonth()!==i.getMonth()}function Te(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}Ae.GROUP_COLOR_MAP_CAP=1e3,Ae.QUADTREE_THRESHOLD=500;const Ee=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Oe=new WeakMap;let De=0,Le=!1,Ne=null,$e=null,Ie=null;function We(t,e){var n,i;if(!e)return e;const o=Ee.exec(e);if(!o)return e;const r=t.canvas;if(!r)return(null===(n=o[2])||void 0===n?void 0:n.trim())||e;!function(){if(Le)return;if("undefined"==typeof window||"undefined"==typeof document)return;Le=!0;const t=()=>{De++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ne=new MutationObserver(t),Ne.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{$e=window.matchMedia("(prefers-color-scheme: dark)"),Ie=t,"function"==typeof $e.addEventListener?$e.addEventListener("change",Ie):"function"==typeof $e.addListener&&$e.addListener(Ie)}catch(t){}}();let l=Oe.get(r);l&&l.version===De||(l={version:De,map:new Map},Oe.set(r,l));const s=l.map.get(e);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(o[1]).trim()||(null===(i=o[2])||void 0===i?void 0:i.trim())||e;return l.map.set(e,a),a}function ze(t){switch(t){case"monotoneX":return D;case"monotoneY":return O;case"cardinal":return E;case"catmullRom":return T;case"step":return C;case"stepBefore":return P;case"stepAfter":return M;case"basis":return S;case"natural":return _;default:return null}}function Re(t,e,n){return null==e?n:"string"!=typeof e?e:We(t,e)||n}function Fe(t,e,n,i,o,r,l){if("colorStops"in e){const n=e.colorStops.filter(t=>Number.isFinite(t.offset)).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color}));if(2>n.length)return null;const s=t.createLinearGradient(i,o,r,l);for(const t of n)s.addColorStop(t.offset,t.color);return s}const{topOpacity:s,bottomOpacity:a}=e;if(!Number.isFinite(s)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,a)),d=t.createLinearGradient(i,o,r,l),[h,f,g]=function(t,e){const n=t.fillStyle,i="#010203";try{t.fillStyle=i,t.fillStyle=e}catch(e){return t.fillStyle=n,[78,121,167]}const o=t.fillStyle;if(t.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===i&&e.trim().toLowerCase()!==i)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const r=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(t,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function Ye(t,e,n,i,o,r){const l=e.colorStops.filter(t=>Number.isFinite(t.offset)).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color}));if(2>l.length)return null;const s=t.createLinearGradient(n,i,o,r);for(const t of l)s.addColorStop(t.offset,t.color);return s}const je=new WeakMap;function Be(t,e){const n=ze(e);if(!n)return t;const i=je.get(t);if(i)return i;const o=function(t,e,n=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const i=[];let o=null;const r={moveTo(t,e){o=[t,e],i.push([t,e])},lineTo(t,e){o=[t,e],i.push([t,e])},bezierCurveTo(t,e,r,l,s,a){if(!o)return o=[s,a],void i.push([s,a]);const[c,u]=o;for(let o=1;n>=o;o++){const d=o/n,h=1-d;i.push([h*h*h*c+3*h*h*d*t+3*h*d*d*r+d*d*d*s,h*h*h*u+3*h*h*d*e+3*h*d*d*l+d*d*d*a])}o=[s,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,n,r){o=[n,r],i.push([n,r])}};return L().x(t=>t[0]).y(t=>t[1]).curve(e).context(r)(t),i}(t,n);return je.set(t,o),o}function He(t,e,n,i=30,o,r=0){let l=null;if(o){const t=function(t,e,n,i,o){const r=Math.max(i,o+5,12),l=e-r,s=e+r,a=n-r,c=n+r;let u=null,d=1/0;return t.visit((t,o,r,h,f)=>{if(o>s||l>h||r>c||a>f)return!0;if(!t.length){let o=t;do{const t=o.data,r=t.x-e,l=t.y-n,s=Math.sqrt(r*r+l*l);Me(t.r,i)>=s&&d>s&&(u=t,d=s),o=o.next}while(o)}return!1}),u?{node:u,distance:d}:null}(o,e,n,i,r);t&&(l={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const r of t){let t=null;switch(r.type){case"point":if(o)break;t=Ge(r,e,n,i);break;case"line":t=Ve(r,e,n,i);break;case"rect":if(null==r.datum)break;t=Ue(r,e,n);break;case"heatcell":t=Ke(r,e,n);break;case"area":if(!1===r.interactive)break;t=Qe(r,e,n);break;case"candlestick":t=Ze(r,e,n)}t&&i>t.distance&&(l&&t.distance>=l.distance||(l=t))}return l}function Xe(t,e,n){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const i=Je(t,e);if(0>i)return null;if(Math.abs(t[i][0]-e)>n)return null;let o=i,r=i;i>0&&t[i][0]>=e?(o=i-1,r=i):t.length-1>i&&(o=i,r=i+1);const[l,s]=t[o],[a,c]=t[r];return a===l?s:s+Math.max(0,Math.min(1,(e-l)/(a-l)))*(c-s)}function Ge(t,e,n,i=30){const o=e-t.x,r=n-t.y,l=Math.sqrt(o*o+r*r);return l>Me(t.r,i)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:l}}function Ve(t,e,n,i=30){var o,r;if(0===t.path.length)return null;const l=Je(t.path,e);if(0>l)return null;const[s,a]=t.path[l];let c;if(t.path.length>1){let i=1/0;const o=Math.max(0,l-1),r=Math.min(t.path.length-2,l);for(let l=o;r>=l;l++){const[o,r]=t.path[l],[s,a]=t.path[l+1],c=qe(e,n,o,r,s,a);i>c&&(i=c)}c=i}else{const t=e-s,i=n-a;c=Math.sqrt(t*t+i*i)}const u=t.style,d=null!==(r=null!==(o=u.strokeWidth)&&void 0!==o?o:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,i)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[l]?t.datum[l]:t.datum,x:s,y:a,distance:c}}function qe(t,e,n,i,o,r){const l=o-n,s=r-i,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-i,2));let c=((t-n)*l+(e-i)*s)/a;c=Math.max(0,Math.min(1,c));const u=i+c*s;return Math.sqrt(Math.pow(t-(n+c*l),2)+Math.pow(e-u,2))}function Ue(t,e,n){const i=Se(e,n,t);return i.hit?{node:t,datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}function Ke(t,e,n){const i=Se(e,n,t);return i.hit?{node:t,datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}function Ze(t,e,n){const i=t.bodyWidth/2,o=Math.min(t.openY,t.closeY);if(!(t.x-i-3>e||e>t.x+i+3||t.highY-3>n||n>t.lowY+3)){const i=o+Math.max(Math.max(t.openY,t.closeY)-o,1)/2,r=e-t.x,l=n-i;return{node:t,datum:t.datum,x:t.x,y:i,distance:Math.sqrt(r*r+l*l)}}return null}function Qe(t,e,n){if(0===t.topPath.length)return null;const i=Je(t.topPath,e);if(0>i)return null;const[o,r]=t.topPath[i],l=e-o,s=n-r,a=Math.sqrt(l*l+s*s);return{node:t,datum:Array.isArray(t.datum)&&t.datum[i]?t.datum[i]:t.datum,x:o,y:r,distance:a}}function Je(t,e){if(0===t.length)return-1;let n=0,i=t.length-1;for(;i>n;){const o=n+i>>1;e>t[o][0]?n=o+1:i=o}return n>0&&Math.abs(t[n][0]-e)>=Math.abs(t[n-1][0]-e)?n-1:n}function tn(t){var e,n;const i=new Map;for(const n of t){const t=null!==(e=n.group)&&void 0!==e?e:"_default";let o=i.get(t);o||(o=[],i.set(t,o)),o.push(n)}for(const t of i.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const o=Array.from(i.keys()).sort((t,e)=>{const n=i.get(t),o=i.get(e);return(n.length>0?n[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(i.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const l=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=null===(n=r[t].datum)||void 0===n?void 0:n.id;null!=e&&l.set(e+"",t)}return{flat:r,groups:o,byGroup:i,idToIdx:l}}function en(t,e){var n,i;if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[o];return{flatIndex:o,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(i=r._groupIndex)&&void 0!==i?i:0}}function nn(t,e,n){const{group:i,indexInGroup:o}=e,r=n.byGroup.get(i);switch(t){case"ArrowRight":return r.length-1>o?r[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?r[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(i);return n.groups.length-1>t?on(n,n.groups[t+1],r[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(i);return t>0?on(n,n.groups[t-1],r[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function on(t,e,n){const i=t.byGroup.get(e);let o=0,r=Math.abs(i[0].x-n.x);for(let t=1;i.length>t;t++){const e=Math.abs(i[t].x-n.x);r>e&&(r=e,o=t)}return i[o]._flatIndex}function rn(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function ln(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function sn(t,e,n,i,o,r){l(()=>{if(!t)return;const l=setInterval(()=>{var l;const s=e.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(l=t.threshold)&&void 0!==l?l:5e3,u=a-s.lastIngestTime>c;u!==o&&(r(u),n.current=!0,i())},1e3);return()=>clearInterval(l)},[t,o,i])}const an={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function cn(t,e,n,i){let o;return o="function"==typeof n?n(t):(0,an[n])(i(t,e)),o}function un(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function dn(t,e,n){return n&&n.size>0?n.has(t.label)?1:.3:null!=e?t.label===e?1:.3:1}const hn=(n,i,o,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=n,y=[];let p=0;const v=!(!i&&!o),m="isolate"===d||void 0===d&&null!=l;return g.forEach((n,d)=>{const x=cn(n,d,h,f),b=dn(n,r,l),k=l&&l.size>0&&l.has(n.label);y.push(e("g",{transform:`translate(0,${p})`,onClick:i?()=>i(n):void 0,onMouseEnter:o?()=>o(n):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?c===s&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?t=>{var e;if("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i&&i(n)),"ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault();const n=(d+("ArrowDown"===t.key?1:-1)+g.length)%g.length;u(c,n);const i=null===(e=t.currentTarget.parentElement)||void 0===e?void 0:e.children[n];i instanceof SVGElement&&i.focus()}}:void 0,onFocus:v?t=>{u(c,d),o&&o(n);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","visible")}:void 0,onBlur:v?t=>{o&&o(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&t(un,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),p+=22}),y};function fn({config:n,orientation:o="vertical",width:r=100}){const{colorFn:l,domain:s,label:a,format:c}=n,u=c||(t=>Math.round(100*t)/100+""),d="grad-legend-"+i.useId();if("horizontal"===o){const n=12,i=Math.min(r,200),o=Math.max(0,(r-i)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:l(s[0]+n*(s[1]-s[0]))},e))}return e("g",{"aria-label":a||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&t("text",{x:o+i/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),t("rect",{x:o,y:0,width:i,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:o,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),t("text",{x:o+i,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:l(s[1]-n*(s[1]-s[0]))},e))}return e("g",{"aria-label":a||"Gradient legend",children:[a&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function gn(n){const{legendGroups:o,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical"}=n,[g,y]=i.useState(0),[p,v]=i.useState(0),m=i.useCallback((t,e)=>{y(t),v(e)},[]),x="vertical"===f?(({legendGroups:e,width:n,customClickBehavior:i,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(t("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push(t("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${d})`,children:hn(e,i,o,r,l,s,a,f,c,u)},"legend-group-"+f)),d+=22*e.items.length+8}),h})({legendGroups:o||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:n,height:i,width:o,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let f=0;const g=[];n.forEach((n,i)=>{let y=0;n.label&&(y+=16);const p=((n,i,o,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:y}=n,p=[];let v=0,m=0;const x=!(!i&&!o),b="isolate"===d||void 0===d&&null!=l;y.forEach((n,d)=>{const k=cn(n,d,f,g),w=dn(n,r,l),A=l&&l.size>0&&l.has(n.label),_=26+7*n.label.length;h&&h>0&&v>0&&v+_>h&&(m++,v=0),p.push(e("g",{transform:`translate(${v},${22*m})`,onClick:i?()=>i(n):void 0,onMouseEnter:o?()=>o(n):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:x?c===s&&d===a?0:-1:void 0,role:x?"option":void 0,"aria-selected":x&&b?A||!1:void 0,"aria-current":x&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:x?t=>{var e;if("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i&&i(n)),"ArrowRight"===t.key||"ArrowLeft"===t.key){t.preventDefault();const n=(d+("ArrowRight"===t.key?1:-1)+y.length)%y.length;u(c,n);const i=null===(e=t.currentTarget.parentElement)||void 0===e?void 0:e.children[n];i instanceof SVGElement&&i.focus()}}:void 0,onFocus:x?t=>{u(c,d),o&&o(n);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","visible")}:void 0,onBlur:x?t=>{o&&o(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:x?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[x&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&t(un,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),v+=_});let k=0,w=0;for(const t of y){const e=26+7*t.label.length;h&&h>0&&w>0&&w+e>h?(k=Math.max(k,w),w=e):w+=e}k=Math.max(k,w);const A=m+1;return{items:p,offset:k,totalRows:A,totalHeight:22*A}})(n,r,l,s,a,c,u,i,d,h,o);y+=p.offset+5,g.push(Object.assign(Object.assign({label:n.label},p),{offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight})),f+=y+12});let y=f>o?0:Math.max(0,(o-f)/2);const p=[];return g.forEach((e,o)=>{const r=n[o];r.label&&(p.push(t("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),p.push(t("g",{className:"legend-item",transform:`translate(${y},0)`,children:e.items},"legend-group-"+o)),y+=e.offset+5,n[o+1]&&p.push(t("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(e.totalHeight||i)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),t("g",{children:p})})({legendGroups:o||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:c}),b=!(!r&&!l);return e("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),x]})}function yn(t){return"object"==typeof t&&null!==t&&"legendGroups"in t}function pn(t){return"object"==typeof t&&null!==t&&"gradient"in t}function vn(e){const{legend:n,totalWidth:i,totalHeight:o,margin:r,legendPosition:l="right",title:s,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!n)return null;const f="top"===l||"bottom"===l;let g,y;return"left"===l?(g=4,y=r.top):"top"===l?(g=0,y=s?32:8):"bottom"===l?(g=0,y=o-r.bottom+50):(g=i-r.right+10,y=r.top),t("g",{transform:`translate(${g}, ${y})`,children:pn(n)?t(fn,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?i:100}):yn(n)?t(gn,{legendGroups:n.legendGroups,title:"",width:f?i:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n})}function mn(t){return"string"==typeof t?{type:t}:t}function xn({orient:n,config:i,values:o,scale:l,size:s,length:a}){const c=function(t){var e,n,i,o,r;return{type:t.type,bins:null!==(e=t.bins)&&void 0!==e?e:20,fill:null!==(n=t.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:.5,stroke:null!==(o=t.stroke)&&void 0!==o?o:"none",strokeWidth:null!==(r=t.strokeWidth)&&void 0!==r?r:1}}(i),u="top"===n||"bottom"===n,d=r(()=>{if(0===o.length)return null;const i=l.domain(),r=s-8;if("boxplot"===c.type){const i=function(t){const e=[...t].sort((t,e)=>t-e),n=e.length;if(0===n)return null;const i=e[Math.floor(.25*n)],o=e[Math.floor(.5*n)],r=e[Math.floor(.75*n)],l=r-i;return{q1:i,median:o,q3:r,whiskerLow:Math.max(e[0],i-1.5*l),whiskerHigh:Math.min(e[n-1],r+1.5*l)}}(o);if(!i)return null;const{q1:s,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=i,g=Math.min(.5*r,20),y=(r-g)/2+4;if(u){const i=l(s),o=l(d),r=l(a),u=l(h),p=l(f),v="top"===n?-1:1,m=0;return e("g",{"data-testid":"marginal-boxplot-"+n,children:[t("line",{x1:u,y1:m+v*(y+g/2),x2:p,y2:m+v*(y+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:u,y1:m+v*y,x2:u,y2:m+v*(y+g),stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:p,y1:m+v*y,x2:p,y2:m+v*(y+g),stroke:c.fill,strokeWidth:c.strokeWidth}),t("rect",{x:Math.min(i,o),y:"top"===n?m-y-g:m+y,width:Math.abs(o-i),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),t("line",{x1:r,y1:"top"===n?m-y-g:m+y,x2:r,y2:"top"===n?m-y:m+y+g,stroke:c.fill,strokeWidth:2})]})}{const i=l(s),o=l(d),r=l(a),u=l(h),p=l(f),v="left"===n?-1:1,m=0;return e("g",{"data-testid":"marginal-boxplot-"+n,children:[t("line",{x1:m+v*(y+g/2),y1:u,x2:m+v*(y+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:m+v*y,y1:u,x2:m+v*(y+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:m+v*y,y1:p,x2:m+v*(y+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),t("rect",{x:"left"===n?m-y-g:m+y,y:Math.min(i,o),width:g,height:Math.abs(o-i),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),t("line",{x1:"left"===n?m-y-g:m+y,y1:r,x2:"left"===n?m-y:m+y+g,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=z().domain(i).thresholds(c.bins)(o);if(0===d.length)return null;const h=Math.max(...d.map(t=>t.length));if(0===h)return null;if("histogram"===c.type)return t("g",{"data-testid":"marginal-histogram-"+n,children:d.map((e,i)=>{if(null==e.x0||null==e.x1)return null;const o=e.length/h*r;if(u){const r=l(e.x0),s=l(e.x1)-l(e.x0);return t("rect",{x:r,y:"top"===n?-4-o:4,width:Math.max(s,.5),height:o,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const r=l(e.x0),s=l(e.x1)-l(e.x0);return t("rect",{x:"left"===n?-4-o:4,y:Math.min(r,r+s),width:o,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const e=r/2+4,i=[];for(const t of d){if(null==t.x0||null==t.x1)continue;const o=t.length/h*(r/2),s=l((t.x0+t.x1)/2);i.push(u?`${s},${"top"===n?-(e-o):e-o}`:`${"left"===n?-(e-o):e-o},${s}`)}for(let t=d.length-1;t>=0;t--){const o=d[t];if(null==o.x0||null==o.x1)continue;const s=o.length/h*(r/2),a=l((o.x0+o.x1)/2);i.push(u?`${a},${"top"===n?-(e+s):e+s}`:`${"left"===n?-(e+s):e+s},${a}`)}return t("g",{"data-testid":"marginal-violin-"+n,children:t("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const e=[];if(u){const t=0,i=null!=d[0].x0?l(d[0].x0):0;e.push(`M${i},${t}`);for(const t of d){if(null==t.x0||null==t.x1)continue;const i=t.length/h*r,o=l((t.x0+t.x1)/2);e.push(`L${o},${"top"===n?-i-4:i+4}`)}const o=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;e.push(`L${o},${t}`),e.push("Z")}else{const t=0,i=null!=d[0].x0?l(d[0].x0):0;e.push(`M${t},${i}`);for(const t of d){if(null==t.x0||null==t.x1)continue;const i=t.length/h*r,o=l((t.x0+t.x1)/2);e.push(`L${"left"===n?-i-4:i+4},${o}`)}const o=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;e.push(`L${t},${o}`),e.push("Z")}return t("g",{"data-testid":"marginal-ridgeline-"+n,children:t("path",{d:e.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[o,l,c,s,a,n,u,4]);return d?t("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function bn(t,e=120,n=8){if(!t)return[];const i=Math.max(1,Math.floor(e/n)),o=t.split(/\s+/),r=[];let l="";for(const t of o)l&&l.length+1+t.length>i?(r.push(l),l=t):l=l?`${l} ${t}`:t;return l&&r.push(l),r}function kn(t,e,n,i){return"curly"===t?i?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:i?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function wn(n,i,o,r){if(!n)return t("g",{className:"annotation-note"});const{label:l,title:s,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!s)return t("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(i)>Math.abs(o)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>i?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===h?"right"===f?g="end":"middle"===f&&(g="middle"):g=0>i?"end":"start";const y=16,p=s?d?[s]:bn(s,u):[],v=l?d?[l]:bn(l,u):[],m="leftRight"===h?"end"===g?-4:4:0;let x=0;const b=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(t("text",{className:"annotation-note-title",fill:k,textAnchor:g,fontWeight:"bold",children:p.map((e,n)=>t("tspan",{x:m,dy:0===n?0:y,children:e},n))},"annotation-note-title")),x=p.length*y),v.length>0&&b.push(t("text",{className:"annotation-note-label",fill:k,textAnchor:g,y:x,children:v.map((e,n)=>t("tspan",{x:m,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let w=null;if((s||l)&&(0!==i||0!==o))if("topBottom"===h){const e=Math.min(u,120);let n=0,i=e;"end"===g?(n=-e,i=0):"middle"===g&&(n=-e/2,i=e/2),w=t("line",{className:"note-line",x1:n,x2:i,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+v.length)*y+(v.length>0?y:0);let n=0,i=e;"bottom"===f?(n=-e,i=0):"middle"===f&&(n=-e/2,i=e/2),w=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:i,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,p.length+v.length-1)*y;let _=0;return"topBottom"===h?_=0>o?-(A+2):18:"leftRight"===h&&(_="middle"===f?-(A+y+(v.length>0&&p.length>0?2:0))/2+8:"bottom"===f||0>o?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${i},${o})`,children:[t("g",{className:"annotation-note-content",transform:0!==_?`translate(0,${_})`:void 0,children:b}),w]})}function An(e,n,i,o,r){var l;const s=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&s.push(t("circle",{r:e,fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,o=(null==n?void 0:n.height)||0;(e>0||o>0)&&s.push(t("rect",{width:e,height:o,fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));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 e=o||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const o=(n.x||0)-e;s.push(t("line",{x1:o,y1:(n.y1||0)-l,x2:o,y2:(n.y2||0)-l,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const o=(n.y||0)-l;s.push(t("line",{x1:(n.x1||0)-e,y1:o,x2:(n.x2||0)-e,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(t("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==e&&s.push(t("path",{d:kn((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:s})}function _n(e,n,i,o,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const t=l.width||0,i=l.height||0;if(t>0||i>0){const o=t/2,r=i/2,l=e-o,s=n-r;if(0!==l||0!==s){const e=Math.abs(l),n=Math.abs(s),u=t/2,d=i/2,h=e*d>n*u?u/e:d/n;a=o+l*h,c=r+s*h}}}else if("bracket"===r&&l){const t=l.width,e=l.height,n=l.depth||30;void 0!==t?(a=t/2,c=n):void 0!==e&&(a=n,c=e/2)}}else{const t=(l.radius||0)+(l.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const i=Math.atan2(n,e);a=Math.cos(i)*t,c=Math.sin(i)*t}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(n-c,2))>.5&&(s.push(t("line",{x1:a,y1:c,x2:e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==i?void 0:i.end))){const i=10,r=16/180*Math.PI,l=Math.atan2(n-c,e-a);s.push(t("path",{d:`M${a},${c}L${a+i*Math.cos(l+r)},${c+i*Math.sin(l+r)}L${a+i*Math.cos(l-r)},${c+i*Math.sin(l-r)}Z`,fill:o||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:s})}function Sn(t){const{x:n=0,y:i=0,dx:o,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:g,events:y={},"data-testid":p}=t,v=new Set(Array.isArray(g)?g:[]);let m=o||0,x=r||0;null!=l&&(m=l-n),null!=s&&(x=s-i);const b="string"==typeof d?d:"label";if("bracket"===b&&u&&0===m&&0===x)if(void 0!==u.width){m=u.width/2;const t=u.depth||30;x=t+(0>t?-5:5)}else if(void 0!==u.height){const t=u.depth||30;m=t+(0>t?-5:5),x=u.height/2}return e("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${i})`,"data-testid":p},y,{children:[!v.has("connector")&&_n(m,x,c,h,b,u),!v.has("subject")&&An(b,u,h,n,i),!v.has("note")&&wn(a,m,x,h)]}))}function Mn(e){var n,i;const{noteData:o}=e,{screenCoordinates:r}=o,l="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(n=o.dx)&&void 0!==n?n:0),s=o.ny||r[0][1]+(null!==(i=o.dy)&&void 0!==i?i:0),a=r.map((n,i)=>{const r=Object.assign({},o,{note:0===i?o.note:{label:""},x:n[0],y:n[1],nx:e,ny:s});return t(Sn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+i)});return t("g",{children:a})}const a=o.note||{title:"none",label:o.label},c=`${a.label}-${a.title}-${o.i}`;return t(Sn,Object.assign({"data-testid":"semiotic-annotation",events:s},o,{type:l}),c)}function Pn(t,e){var n,i,o;const r=null!==(i=null===(n=e.scales)||void 0===n?void 0:n.x)&&void 0!==i?i:null===(o=e.scales)||void 0===o?void 0:o.time;return r?null!=t.x?r(t.x):e.xAccessor&&null!=t[e.xAccessor]?r(t[e.xAccessor]):null:null}function Cn(t,e){var n,i,o;const r=null!==(i=null===(n=e.scales)||void 0===n?void 0:n.y)&&void 0!==i?i:null===(o=e.scales)||void 0===o?void 0:o.value;return r?null!=t.y?r(t.y):e.yAccessor&&null!=t[e.yAccessor]?r(t[e.yAccessor]):null:null}function Tn(t,e,n){var i,o,r,l;const s=t.anchor||"fixed";if("latest"===s){if(null!=t.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===t.pointId){const t={x:r.x,y:r.y};return null===(i=n.stickyPositionCache)||void 0===i||i.set(e,t),t}}const r=function(t){var e,n,i,o,r,l;const s=t.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(e=t.scales)||void 0===e?void 0:e.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time,u=null!==(r=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==r?r:null===(l=t.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[t.xAccessor||"x"],h=a[t.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(o=n.stickyPositionCache)||void 0===o||o.set(e,r)),r}let a=null,c=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(a=e.x,c=e.y)}if(null!=a&&null!=c||(a=Pn(t,n),c=Cn(t,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(e,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const t=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(e);if(t)return t}return null}function En(t,e,n,i=50){return!(-i>t||t>(n.width||0)+i||-i>e||e>(n.height||0)+i)}const On={linear:$,monotoneX:D,monotoneY:O,step:C,stepAfter:M,stepBefore:P,basis:S,cardinal:E,catmullRom:T};let Dn={positions:new Map};const Ln=new Set;function Nn(){for(const t of Ln)t()}function $n(t,e){const n=Dn.positions.get(t);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==e)return;const i=new Map(Dn.positions);i.delete(t),Dn={positions:i},Nn()}function In(t,e){const n=Dn.positions.get(t);if(!(null==n?void 0:n.locked))return;if(e&&n.sourceId!==e)return;const i=new Map(Dn.positions);i.delete(t),Dn={positions:i},Nn()}function Wn(){return Dn}function zn(t){return Ln.add(t),()=>Ln.delete(t)}const Rn={positions:new Map};function Fn(){return()=>{}}function Yn(){return Rn}function jn(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),i=n[0],o=n[n.length-1],r=i instanceof Date,l=i instanceof Date?i.getTime():i,s=o instanceof Date?o.getTime():o;if(2>e||l===s)return r?[new Date(l),new Date(s)]:[l,s];const a=(s-l)/(e-1),c=Array(e);for(let t=0;e>t;t++){const n=t===e-1?s:l+t*a;c[t]=r?new Date(n):n}return c}(t,e):t.ticks(e)}function Bn(t,e,n){if("edges"===t){if(e)return"start";if(n)return"end"}return"middle"}function Hn(t,e,n){if("edges"===t){if(e)return"hanging";if(n)return"auto"}return"middle"}function Xn(t){if(0===t.length)return{min:null,max:null};let e=1/0,n=-1/0;for(const i of t)e>i.pixel&&(e=i.pixel),i.pixel>n&&(n=i.pixel);return{min:e,max:n}}function Gn(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function Vn(t,e,n){if("left"===t||"right"===t){const i="left"===t?n:0,o="left"===t?-1:1,r=Math.ceil(e/8);let l="M0,"+i;for(let t=0;r>t;t++){const n=8*(t+1);l+=`L${Math.min(8*t+4,e)},${i+4*o}`,l+=`L${Math.min(n,e)},${i}`}return l}{const i="bottom"===t?0:e,o="bottom"===t?1:-1,r=Math.ceil(n/8);let l=`M${i},0`;for(let t=0;r>t;t++){const e=8*(t+1);l+=`L${i+4*o},${Math.min(8*t+4,n)}`,l+=`L${i},${Math.min(e,n)}`}return l}}function qn(n){const{width:i,height:o,totalWidth:l,totalHeight:s,margin:a,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:f,yFormat:g,axisExtent:y}=n,p=r(()=>{var t,e;if(!c)return[];const n=null==d?void 0:d.find(t=>"bottom"===t.orient),o=(null==n?void 0:n.tickFormat)||f||Un,r=Math.max(2,Math.floor(i/70)),l=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5,s=null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(c.x,"exact"===y?Math.max(2,l):Math.min(l,r),y),a=s.map(t=>t.valueOf()),u=s.map((t,e)=>({value:t,pixel:c.x(t),label:o(t,e,a)})),h=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return Kn(u,Math.max(55,h+8))},[c,d,f,i,y]),v=r(()=>{var t,e;if(!c)return[];const n=null==d?void 0:d.find(t=>"left"===t.orient),i=(null==n?void 0:n.tickFormat)||g||Un,r=Math.max(2,Math.floor(o/30)),l=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5;return Kn((null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(c.y,"exact"===y?Math.max(2,l):Math.min(l,r),y)).map(t=>({value:t,pixel:c.y(t),label:i(t)})),22)},[c,d,g,o,y]),m=h&&c,x=u&&c;if(!m&&!x)return null;const b=null==d?void 0:d.find(t=>"bottom"===t.orient),k=null==d?void 0:d.find(t=>"left"===t.orient),w=x&&(!b||!1!==b.baseline),A=x&&(!k||!1!==k.baseline),_=(null==b?void 0:b.jaggedBase)||!1,S=(null==k?void 0:k.jaggedBase)||!1,M="var(--semiotic-border, #ccc)";return t("svg",{width:l,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var n,r;const l=Gn(null===(n=null==d?void 0:d.find(t=>"bottom"===t.orient))||void 0===n?void 0:n.gridStyle),s=Gn(null===(r=null==d?void 0:d.find(t=>"left"===t.orient))||void 0===r?void 0:r.gridStyle);return e("g",{className:"stream-grid",children:[p.map((e,n)=>t("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:l},"xgrid-"+n)),v.map((e,n)=>t("line",{x1:0,y1:e.pixel,x2:i,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),w&&!_&&t("line",{x1:0,y1:o,x2:i,y2:o,stroke:M,strokeWidth:1}),_&&t("path",{d:Vn("bottom",i,o),fill:"none",stroke:M,strokeWidth:1}),A&&!S&&t("line",{x1:0,y1:0,x2:0,y2:o,stroke:M,strokeWidth:1}),S&&t("path",{d:Vn("left",i,o),fill:"none",stroke:M,strokeWidth:1})]})})}function Un(t,e,n){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function Kn(t,e){if(2>=t.length)return t;const n=[t[0]];for(let i=1;t.length-1>i;i++)e>Math.abs(t[i].pixel-n[n.length-1].pixel)||n.push(t[i]);const i=t[t.length-1];return e>Math.abs(i.pixel-n[n.length-1].pixel)?n[n.length-1]=i:n.push(i),n}function Zn(i){var s,a;const{width:u,height:d,totalWidth:h,totalHeight:f,margin:g,scales:y,showAxes:p,axes:v,xLabel:m,yLabel:x,yLabelRight:b,xFormat:k,yFormat:w,axisExtent:A,showGrid:_,title:S,legend:M,legendHoverBehavior:P,legendClickBehavior:C,legendHighlightedCategory:T,legendIsolatedCategories:E,legendPosition:O="right",foregroundGraphics:D,marginalGraphics:L,xValues:I,yValues:W,annotations:z,svgAnnotationRules:R,xAccessor:F,yAccessor:Y,annotationData:j,pointNodes:B,curve:H,underlayRendered:G,canvasObscuresUnderlay:V=!0,linkedCrosshairName:q,linkedCrosshairSourceId:U,children:K}=i,Z=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"bottom"===t.orient),i=(null==n?void 0:n.tickFormat)||k||Un,o=Math.max(2,Math.floor(u/70)),r=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5,l=null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(y.x,"exact"===A?Math.max(2,r):Math.min(r,o),A),s=l.map(t=>t.valueOf()),a=l.map((t,e)=>({value:t,pixel:y.x(t),label:i(t,e,s)})),c=a.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=Kn(a,d);if(h.length>1&&(h=h.filter((t,e)=>0===e||t.label+""!=h[e-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const t=y.x.domain()[1],e=y.x(t),n=h[h.length-1].pixel;if(Math.abs(e-n)>1){const o=i(t,h.length,s);d>e-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:t,pixel:e,label:o})}}return h},[p,y,v,k,u,A]),Q=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"left"===t.orient),i=(null==n?void 0:n.tickFormat)||w||Un,o=Math.max(2,Math.floor(d/30)),r=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5;let l=Kn((null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(y.y,"exact"===A?Math.max(2,r):Math.min(r,o),A)).map(t=>({value:t,pixel:y.y(t),label:i(t)})),22);if(l.length>1&&(l=l.filter((t,e)=>0===e||t.label+""!=l[e-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const t=y.y.domain()[1],e=y.y(t),n=l[l.length-1].pixel;if(Math.abs(e-n)>1){const o=i(t);22>Math.abs(e-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:t,pixel:e,label:o})}}return l},[p,y,v,w,d,A]),tt=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"right"===t.orient);if(!n)return[];const i=n.tickFormat||w||Un,o=Math.max(2,Math.floor(d/30)),r=null!==(t=n.ticks)&&void 0!==t?t:5;return Kn((null!==(e=n.tickValues)&&void 0!==e?e:jn(y.y,"exact"===A?Math.max(2,r):Math.min(r,o),A)).map(t=>({value:t,pixel:y.y(t),label:i(t)})),22)},[p,y,v,w,d,A]),et=o(new Map),nt=o(null!==(s=null==z?void 0:z.length)&&void 0!==s?s:0),it=null!==(a=null==z?void 0:z.length)&&void 0!==a?a:0;nt.current!==it&&(nt.current=it,et.current=new Map);const ot=r(()=>{if(!z||0===z.length)return null;const n=function(n,i,o){var r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,_,S,M,P,C,T,E,O,D,L,I,W,z,R,F,Y,j,B,H,G,V,q,U,K,Z,Q,tt,et,nt;switch(n.type){case"label":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return En(r,l,o)?t(Mn,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+i):null}case"callout":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return En(r,l,o)?t(Mn,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+i):null}case"x-threshold":{const r=Pn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,o);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:a,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"y-threshold":{const r=Cn(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,o);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"right";let a,c;return"left"===s?(a=4,c="start"):"center"===s?(a=(o.width||0)/2,c="middle"):(a=(o.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:a,y:r-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"enclose":{const r=(n.coordinates||[]).map(t=>({x:Pn(Object.assign(Object.assign({},t),{type:"point"}),o),y:Cn(Object.assign(Object.assign({},t),{type:"point"}),o),r:1})).filter(t=>null!=t.x&&null!=t.y);if(2>r.length)return null;const l=X(r),s=n.padding||10;return e("g",{children:[t("circle",{cx:l.x,cy:l.y,r:l.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:l.x,y:l.y-l.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const r=(n.coordinates||[]).map(t=>({x:Pn(Object.assign(Object.assign({},t),{type:"point"}),o),y:Cn(Object.assign(Object.assign({},t),{type:"point"}),o)})).filter(t=>null!=t.x&&null!=t.y);if(2>r.length)return null;const l=n.padding||10,s=r.map(t=>t.x),a=r.map(t=>t.y),c=Math.min(...s)-l,u=Math.max(...s)+l,d=Math.min(...a)-l,h=Math.max(...a)+l;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const e=o.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(t=>t[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,i)=>{const r=Pn(e,o),s=Cn(e,o);if(null==r||null==s)return null;const a="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||l;return t("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+i)})},"ann-"+i)}case"bracket":{const e=Pn(n,o),r=Cn(n,o);return t(Mn,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const h=o.data||[];if(2>h.length)return null;const f=o.xAccessor||"x",g=o.yAccessor||"y",y="ordinal"===o.frameType,p="horizontal"===o.projection,v=y?f:null,m=y?g:null;let x;const b=[],k=new Map;if(y&&v&&m){for(const t of h){const e=t[v];if(null==e)continue;const n=e+"";k.has(n)||(k.set(n,b.length),b.push(n))}x=h.map(t=>{const e=t[v],n=t[m];if(null==e||null==n)return null;const i=k.get(e+"");return null!=i?[i,+n]:null}).filter(t=>null!==t)}else x=h.map(t=>[t[f],t[g]]).filter(t=>null!=t[0]&&null!=t[1]);if(2>x.length)return null;const w=null!==(l=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==l?l:null===(s=o.scales)||void 0===s?void 0:s.time,A=null!==(c=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=o.scales)||void 0===u?void 0:u.value;if(!w||!A)return null;const _=t=>e=>{const n=Math.max(0,Math.floor(e)),i=Math.min(b.length-1,n+1),o=e-n,r=t(b[n]);return r+(t(b[i])-r)*o},S=w,M=A;let P;if(y)if(p){const t=_(M);P=(e,n)=>[S(n),t(e)]}else{const t=_(S);P=(e,n)=>[t(e),M(n)]}else P=(t,e)=>[S(t),M(e)];const C=n.method||"linear";let T;T="loess"===C?function(t,e=.3){const n=t.length;if(2>n)return t.slice();const i=t.slice().sort((t,e)=>t[0]-e[0]),o=i.map(t=>t[0]),r=i.map(t=>t[1]),l=Math.max(2,Math.ceil(e*n)),s=[];for(let t=0;n>t;t++){const e=o[t],i=o.map(t=>Math.abs(t-e)),a=i.slice().sort((t,e)=>t-e)[Math.min(l-1,n-1)]||1,c=[];for(let t=0;n>t;t++){const e=0===a?0:i[t]/a;c[t]=1>e?Math.pow(1-Math.pow(e,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let t=0;n>t;t++){const e=c[t];0!==e&&(u+=e,d+=e*o[t],h+=e*r[t],f+=e*o[t]*o[t],g+=e*o[t]*r[t])}if(0===u){s.push([e,r[t]]);continue}const y=u*f-d*d;if(1e-12>Math.abs(y))s.push([e,h/u]);else{const t=(u*g-d*h)/y;s.push([e,(h-t*d)/u+t*e])}}return s}(x,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===C?J.polynomial(x,{order:n.order||2}):J.linear(x)).points;const E=T.map(([t,e])=>{const[n,i]=P(t,e);return`${n},${i}`}).join(" "),O=n.color||"#6366f1",D=T[T.length-1],[L,N]=P(D[0],D[1]);return e("g",{children:[t("polyline",{points:E,fill:"none",stroke:O,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:L+4,y:N-4,fill:O,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const r=null!==(f=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(g=o.scales)||void 0===g?void 0:g.value,l=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,s=null!==(p=null==r?void 0:r(n.y1))&&void 0!==p?p:o.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(l,s),width:o.width||0,height:Math.abs(s-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(o.width||0)-4,y:Math.min(l,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+i)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const l=o.xAccessor||"x",s=null!==(m=null===(v=o.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(x=o.scales)||void 0===x?void 0:x.time,a=null!==(k=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==k?k:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(t=>null!=t[c]&&null!=t[u]&&!(d&&!d(t))).sort((t,e)=>t[l]-e[l]);if(2>h.length)return null;const f=On[o.curve||"linear"]||$,g=N().x(t=>s(t[l])).y0(t=>a(t[u])).y1(t=>a(t[c])).curve(f)(h);if(!g)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:g,fill:y,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:s(h[h.length-1][l])+4,y:a(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const l=o.yAccessor||"y",s=null!==(S=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==S?S:null===(M=o.scales)||void 0===M?void 0:M.time,a=null!==(C=null===(P=o.scales)||void 0===P?void 0:P.y)&&void 0!==C?C:null===(T=o.scales)||void 0===T?void 0:T.value;if(!s||!a)return null;const c=r.map(t=>t[l]).filter(t=>null!=t&&isFinite(t));if(2>c.length)return null;const u=c.reduce((t,e)=>t+e,0)/c.length,d=c.reduce((t,e)=>t+Math.pow(e-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(E=n.threshold)&&void 0!==E?E:2,g=u-f*h,y=!1!==n.showBand,p=n.fill||"#6366f1",v=null!==(O=n.fillOpacity)&&void 0!==O?O:.1,m=n.anomalyColor||"#ef4444",x=null!==(D=n.anomalyRadius)&&void 0!==D?D:6,b=a(u+f*h),k=a(g),w=r.filter(t=>{const e=t[l];return null!=e&&Math.abs(e-u)>f*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(b,k),width:o.width||0,height:Math.abs(k-b),fill:p,fillOpacity:v}),w.map((e,n)=>{const i=Pn(e,o),r=Cn(e,o);return null==i||null==r?null:t("circle",{cx:i,cy:r,r:x,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(o.width||0)-4,y:Math.min(b,k)-4,textAnchor:"end",fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const l=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==I?I:null===(W=o.scales)||void 0===W?void 0:W.time,c=null!==(R=null===(z=o.scales)||void 0===z?void 0:z.y)&&void 0!==R?R:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!c)return null;const u=r.map(t=>[t[l],t[s]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,e)=>t[0]-e[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const t=J.polynomial(u,{order:n.order||2}).equation;d=e=>t.reduce((t,n,i)=>t+n*Math.pow(e,i),0)}else{const t=u.length;let e=0,n=0,i=0,o=0;for(const[t,r]of u)e+=t,n+=r,i+=t*t,o+=t*r;const r=t*i-e*e;if(1e-12>Math.abs(r))return null;const l=(t*o-e*n)/r,s=(n-l*e)/t;d=t=>s+l*t}const h=u.length,f=u.map(([t,e])=>e-d(t)).reduce((t,e)=>t+e*e,0),g=Math.sqrt(f/Math.max(h-2,1)),y=u.reduce((t,e)=>t+e[0],0)/h,p=u.reduce((t,e)=>t+Math.pow(e[0]-y,2),0),v=null!==(Y=n.confidence)&&void 0!==Y?Y:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,x=null!==(j=n.steps)&&void 0!==j?j:5,b=u[h-1][0],k=(b-u[0][0])/Math.max(h-1,1),w=[];for(let t=1;x>=t;t++)w.push(b+t*k);const A=[];for(const t of w){const e=d(t),n=g*Math.sqrt(1+1/h+(p>0?Math.pow(t-y,2)/p:0))*m;A.push({x:t,yCenter:e,yUpper:e+n,yLower:e-n})}const _=`M${A.map(t=>`${a(t.x)},${c(t.yUpper)}`).join(" L")} L${A.slice().reverse().map(t=>`${a(t.x)},${c(t.yLower)}`).join(" L")} Z`,S=A.map(t=>`${a(t.x)},${c(t.yCenter)}`).join(" "),M=`${a(b)},${c(d(b))}`,P=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:_,fill:n.fill||"#6366f1",fillOpacity:null!==(B=n.fillOpacity)&&void 0!==B?B:.15,stroke:"none"}),t("polyline",{points:`${M} ${S}`,fill:"none",stroke:P,strokeWidth:null!==(H=n.strokeWidth)&&void 0!==H?H:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&A.length>0&&t("text",{x:a(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:P,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=Tn(n,i,o);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!En(e,r,o))return null;const l=null!==(V=n.dx)&&void 0!==V?V:0,s=null!==(q=n.dy)&&void 0!==q?q:0,a=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return t("text",{x:r+(n.dx||0),y:l+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+i)}case"category-highlight":{const r=n.category;if(null==r)return null;const l=t=>"function"==typeof t&&"function"==typeof t.bandwidth,s=null===(Q=o.scales)||void 0===Q?void 0:Q.o,a=null===(tt=o.scales)||void 0===tt?void 0:tt.x,c=null===(et=o.scales)||void 0===et?void 0:et.y,u=l(s)?s:l(a)?a:l(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(nt=n.opacity)&&void 0!==nt?nt:.15,y=n.label;return e("g",(o.projection?"vertical"===o.projection:u===a)?{children:[t("rect",{x:d,y:0,width:h,height:o.height||0,fill:f,fillOpacity:g}),y&&t("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:y})]}:{children:[t("rect",{x:0,y:d,width:o.width||0,height:h,fill:f,fillOpacity:g}),y&&t("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:y})]},"ann-"+i)}default:return null}},i={scales:y?{x:y.x,y:y.y,time:y.x,value:y.y}:null,timeAxis:"x",xAccessor:F,yAccessor:Y,width:u,height:d,data:j,frameType:"xy",pointNodes:B,curve:H,stickyPositionCache:et.current};return z.map((t,e)=>{if(R){const o=R(t,e,i);return null!=o?o:n(t,e,i)}return n(t,e,i)}).filter(Boolean)},[z,R,u,d,F,Y,j,y,B,H]),rt=function(t){var e;const n=c(t?zn:Fn,t?Wn:Yn,t?Wn:Yn);return t&&null!==(e=n.positions.get(t))&&void 0!==e?e:null}(q);return l(()=>{if(!(null==rt?void 0:rt.locked)||!q)return;const t=t=>{"Escape"===t.key&&In(q)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[null==rt?void 0:rt.locked,q]),p||S||M||D||L||ot&&ot.length>0||_||K||rt?e("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof S?S:"XY Chart"}),t("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),e("g",{transform:`translate(${g.left},${g.top})`,children:[_&&y&&(!G||V)&&(()=>{var n,i;const o=Gn(null===(n=null==v?void 0:v.find(t=>"bottom"===t.orient))||void 0===n?void 0:n.gridStyle),r=Gn(null===(i=null==v?void 0:v.find(t=>"left"===t.orient))||void 0===i?void 0:i.gridStyle);return e("g",{className:"stream-grid",children:[Z.map((e,n)=>t("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Q.map((e,n)=>t("line",{x1:0,y1:e.pixel,x2:u,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),p&&y&&(()=>{const n=null==v?void 0:v.find(t=>"left"===t.orient),i=null==v?void 0:v.find(t=>"bottom"===t.orient),o=!n||!1!==n.baseline,r=!i||!1!==i.baseline,l=(null==n?void 0:n.jaggedBase)||!1,s=(null==i?void 0:i.jaggedBase)||!1,a=null==i?void 0:i.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",p=!!(null==i?void 0:i.autoRotate)&&Z.length>1&&(()=>{const t=u/Math.max(Z.length-1,1),e=Z.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0);return e+8>t})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},_=null==i?void 0:i.tickAnchor,S=null==n?void 0:n.tickAnchor,M=Xn(Z),P=Xn(Q);return e("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||V)&&r&&!s&&t("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!G||V)&&s&&t("path",{d:Vn("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),Z.map((n,i)=>{const o=!!a&&("function"==typeof a?a(n.value,i):Ce(n.value,i>0?Z[i-1].value:void 0));return e("g",{transform:`translate(${n.pixel},${d})`,children:[t("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:p?10:18,textAnchor:p?"end":Bn(_,n.pixel===M.min,n.pixel===M.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?w:k),transform:p?"rotate(-45)":void 0,children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+i)}),m&&t("text",{x:u/2,y:d+40,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:m})]}),e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||V)&&o&&!l&&t("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!G||V)&&l&&t("path",{d:Vn("left",u,d),fill:"none",stroke:h,strokeWidth:1}),Q.map((n,i)=>{const o=!!c&&("function"==typeof c?c(n.value,i):Ce(n.value,i>0?Q[i-1].value:void 0));return e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:Hn(S,n.pixel===P.min,n.pixel===P.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?w:k),children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+i)}),(()=>{const e=(null==n?void 0:n.label)||x;return e?t("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:e}):null})()]}),(()=>{const n=null==v?void 0:v.find(t=>"right"===t.orient);if(!n||0===tt.length)return null;const i=!1!==n.baseline,o=n.landmarkTicks,r=n.label||b,l=n.tickAnchor,s=Xn(tt);return e("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[i&&t("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),tt.map((n,i)=>{const r=!!o&&("function"==typeof o?o(n.value,i):Ce(n.value,i>0?tt[i-1].value:void 0));return e("g",{transform:`translate(${u},${n.pixel})`,children:[t("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:8,textAnchor:"start",dominantBaseline:Hn(l,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):t("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+i)}),r&&t("text",{x:u+g.right-15,y:d/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${u+g.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),ot,L&&y&&I&&W&&e(n,{children:[L.top&&t("g",{transform:"translate(0, 0)",children:t(xn,{orient:"top",config:mn(L.top),values:I,scale:y.x,size:g.top,length:u})}),L.bottom&&t("g",{transform:`translate(0, ${d})`,children:t(xn,{orient:"bottom",config:mn(L.bottom),values:I,scale:y.x,size:g.bottom,length:u})}),L.left&&t("g",{transform:"translate(0, 0)",children:t(xn,{orient:"left",config:mn(L.left),values:W,scale:y.y,size:g.left,length:d})}),L.right&&t("g",{transform:`translate(${u}, 0)`,children:t(xn,{orient:"right",config:mn(L.right),values:W,scale:y.y,size:g.right,length:d})})]}),D,rt&&rt.sourceId!==U&&(null==y?void 0:y.x)&&(()=>{const e=y.x(rt.xValue);if(null==e||0>e||e>u)return null;const n=rt.locked;return t("line",{x1:e,y1:0,x2:e,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),K]}),S&&t("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof S?S:null}),vn({legend:M,totalWidth:h,totalHeight:f,margin:g,legendPosition:O,title:S,legendHoverBehavior:P,legendClickBehavior:C,legendHighlightedCategory:T,legendIsolatedCategories:E})]}):null}function Qn(t){var e,n,i,o;return(null!==(e=t.tl)&&void 0!==e?e:0)>0||(null!==(n=t.tr)&&void 0!==n?n:0)>0||(null!==(i=t.br)&&void 0!==i?i:0)>0||(null!==(o=t.bl)&&void 0!==o?o:0)>0}const Jn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ti(t,e="#4e79a7"){return t&&"string"==typeof t?t:e}const ei="undefined"==typeof window||"undefined"==typeof document,ni="undefined"!=typeof window?h:l;function ii(){const[t,e]=d(!1);return ni(()=>{e(!0)},[]),t}const oi=()=>()=>{},ri=()=>!1,li=()=>!0;function si(){const t=c(oi,ri,li);return o(t).current}function ai(t){const{hydrated:e,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=t;ni(()=>{var t,o;e&&n&&(null===(o=null===(t=i.current)||void 0===t?void 0:t.cancelIntroAnimation)||void 0===o||o.call(t)),r.current=!0,s.current()},[e,n]);const c=o(a);c.current=a,l(()=>()=>{var t;return null===(t=c.current)||void 0===t?void 0:t.call(c)},[])}function ci(t){const e=o(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return di(t,e);if(!hi(t)||!hi(e))return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n){if(!Object.prototype.hasOwnProperty.call(e,i))return!1;const n=t[i],o=e[i];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!di(n,o))return!1}else{if(!hi(n)||!hi(o))return!1;if(!ui(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function ui(t,e){const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n){if(!Object.prototype.hasOwnProperty.call(e,i))return!1;if(!Object.is(t[i],e[i]))return!1}return!0}function di(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function hi(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}const fi=i.createContext(null);function gi(){return i.useContext(fi)}const yi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function pi(t,e){if(!t||0===t.length)return e+", empty";const n={};for(const e of t){const t=e.type+"";n[t]=(n[t]||0)+1}const i=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((t,e)=>{const n=r.indexOf(t),i=r.indexOf(e);return(-1===n?999:n)-(-1===i?999:i)});for(const t of l)i.push(`${n[t]} ${o[t]||t}`);return`${e}, ${i.join(", ")}`}function vi(t,e,n){const i=[];return t>0&&i.push(t+" nodes"),e>0&&i.push(e+" edges"),0===i.length?n+", empty":`${n}, ${i.join(", ")}`}const mi=t=>{if(null==t)return"";const e=Math.round(100*t)/100;return Number.isNaN(e)?"":e+""},xi={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},bi={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ki={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},wi={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ai={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},_i={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Si={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Mi({scene:n,chartType:o,tableId:r,chartTitle:l}){var s;const[a,c]=i.useState(!1),u=gi(),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,h=a||d,f=i.useRef(null),g=l?"Data summary for "+l:r?`Data summary for ${o} ${r}`:"Data summary for "+o,y=i.useCallback(()=>{a||d||c(!0)},[a,d]),p=i.useCallback(t=>{var e;d||(null===(e=f.current)||void 0===e?void 0:e.contains(t.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:yi}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:y,style:yi,role:"region","aria-label":g,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const v=function(t){var e,n,i,o,r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,_,S;const M=[];if(!Array.isArray(t))return M;for(const P of t)if(P&&"object"==typeof P)try{switch(P.type){case"point":M.push({label:"Point",values:{x:P.x,y:P.y}});break;case"line":{const t=P.path,e=Array.isArray(P.datum)?P.datum:[];if(!Array.isArray(t))break;for(let n=0;t.length>n&&e.length>n;n++){const e=t[n];Array.isArray(e)&&M.push({label:"Line point",values:{x:e[0],y:e[1]}})}break}case"area":{const t=P.topPath,e=Array.isArray(P.datum)?P.datum:[];if(!Array.isArray(t))break;for(let n=0;t.length>n&&e.length>n;n++){const e=t[n];Array.isArray(e)&&M.push({label:"Area point",values:{x:e[0],y:e[1]}})}break}case"rect":{const t=null!=P.datum&&"object"==typeof P.datum?P.datum:{},r=null!==(n=null!==(e=t.category)&&void 0!==e?e:P.group)&&void 0!==n?n:"",l=null!==(o=null!==(i=t.value)&&void 0!==i?i:t.__aggregateValue)&&void 0!==o?o:t.total;M.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":M.push({label:"Cell",values:{x:P.x,y:P.y,value:P.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=P.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=P.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=P.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(h=null===(d=P.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=P.cx)&&void 0!==f?f:P.x,y:null!==(g=P.cy)&&void 0!==g?g:P.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(p=null===(y=P.datum)||void 0===y?void 0:y.id)&&void 0!==p?p:"",x:null!==(v=P.cx)&&void 0!==v?v:P.x,y:null!==(m=P.cy)&&void 0!==m?m:P.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:P.x,open:P.open,high:P.high,low:P.low,close:P.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(A=null!==(k=null===(b=null===(x=P.datum)||void 0===x?void 0:x.properties)||void 0===b?void 0:b.name)&&void 0!==k?k:null===(w=P.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(_=P.datum)||void 0===_?void 0:_.value)&&void 0!==S?S:""}})}}catch(t){}return M}(n),m=function(t){if(!t||0===t.length)return[];const e=new Set;for(const n of t)if(n&&n.values)for(const t of Object.keys(n.values))e.add(t);const n=[];for(const i of e){const e=[],o=new Set;for(const n of t){if(!n||!n.values)continue;const t=n.values[i];null!=t&&""!==t&&("number"==typeof t&&!Number.isNaN(t)&&Number.isFinite(t)?e.push(t):"number"==typeof t||"object"!=typeof t&&"function"!=typeof t&&o.add(t+""))}if(e.length>0){let t=e[0],o=e[0],r=0;for(const n of e)t>n&&(t=n),n>o&&(o=n),r+=n;n.push({name:i,count:e.length,numeric:!0,min:t,max:o,mean:r/e.length})}else if(o.size>0){const t=Array.from(o);n.push({name:i,count:t.length,numeric:!1,uniqueValues:t.slice(0,5)})}}return n}(v),x=function(t,e){const n=[t+" data points."];for(const t of e)if(t.numeric)n.push(`${t.name}: ${mi(t.min)} to ${mi(t.max)}, mean ${mi(t.mean)}.`);else{const e=t.uniqueValues,i=e.length>3?`${e.slice(0,3).join(", ")}… (${t.count} unique)`:e.join(", ");n.push(`${t.name}: ${i}.`)}return n.join(" ")}(v.length,m),b=v.slice(0,5),k=new Set;for(const t of b)for(const e of Object.keys(t.values))k.add(e);const w=Array.from(k);return e("div",{ref:f,id:r,tabIndex:-1,onBlur:p,style:xi,role:"region","aria-label":g,children:[t("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:ki,children:"×"}),t("div",{role:"note",style:bi,children:x}),e("table",{role:"table","aria-label":"Sample data for "+o,style:wi,children:[e("caption",{style:Si,children:["First ",b.length," of ",v.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Ai,children:"type"}),w.map(e=>t("th",{style:Ai,children:e},e))]})}),t("tbody",{children:b.map((n,i)=>e("tr",{children:[t("td",{style:_i,children:n.label}),w.map(e=>{return t("td",{style:_i,children:(i=n.values[e],null==i||""===i?"—":"number"==typeof i?Number.isNaN(i)?"—":mi(i):"boolean"==typeof i?i?"true":"false":"object"==typeof i?"—":i+"")},e);var i})]},i))})]})]})}function Pi({nodes:n,edges:o,chartType:r,tableId:l,chartTitle:s}){var a,c,u,d,h,f,g,y,p,v,m,x,b,k;const[w,A]=i.useState(!1),_=gi(),S=null!==(a=null==_?void 0:_.visible)&&void 0!==a&&a,M=w||S,P=s?"Data summary for "+s:l?`Data summary for ${r} ${l}`:"Data summary for "+r,C=i.useRef(null),T=i.useCallback(()=>{w||S||A(!0)},[w,S]),E=i.useCallback(t=>{var e;S||(null===(e=C.current)||void 0===e?void 0:e.contains(t.relatedTarget))||A(!1)},[S]);if(!n||0===n.length)return l?t("span",{id:l,tabIndex:-1,style:yi}):null;if(!M)return t("div",{id:l,tabIndex:-1,onFocus:T,style:yi,role:"region","aria-label":P,children:e("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",o.length," edges)"]})});const O=Array.isArray(n)?n:[],D=Array.isArray(o)?o:[],L=new Map,N=new Map,$=new Map,I=new Map;for(const t of D){if(!t||"object"!=typeof t)continue;const e=null!==(c=t.datum)&&void 0!==c?c:t,n="object"==typeof e.source?null===(u=e.source)||void 0===u?void 0:u.id:e.source,i="object"==typeof e.target?null===(d=e.target)||void 0===d?void 0:d.id:e.target,o="number"==typeof e.value&&Number.isFinite(e.value)?e.value:0;if(null!=n&&""!==n){const t=n+"";N.set(t,(null!==(h=N.get(t))&&void 0!==h?h:0)+1),I.set(t,(null!==(f=I.get(t))&&void 0!==f?f:0)+o)}if(null!=i&&""!==i){const t=i+"";L.set(t,(null!==(g=L.get(t))&&void 0!==g?g:0)+1),$.set(t,(null!==(y=$.get(t))&&void 0!==y?y:0)+o)}}const W=[];for(let t=0;O.length>t;t++){const e=O[t];if(!e||"object"!=typeof e)continue;const n=null!==(v=null===(p=e.datum)||void 0===p?void 0:p.id)&&void 0!==v?v:e.id,i=null!=n?n+"":"node-"+t,o=null!==(m=L.get(i))&&void 0!==m?m:0,r=null!==(x=N.get(i))&&void 0!==x?x:0,l=null!==(b=$.get(i))&&void 0!==b?b:0,s=null!==(k=I.get(i))&&void 0!==k?k:0;W.push({id:i,degree:o+r,inDeg:o,outDeg:r,wDegree:l+s,wInDeg:l,wOutDeg:s})}W.sort((t,e)=>e.degree-t.degree);let z=0,R=0;if(W.length>0){let t=0;for(const e of W)t+=e.degree,e.degree>R&&(R=e.degree);z=t/W.length}const F=D.some(t=>{var e;const n=null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),Y=[`${W.length} nodes, ${D.length} edges.`];W.length>0&&Y.push(`Mean degree: ${mi(z)}, max degree: ${R}.`);const j=W.slice(0,5);return e("div",{ref:C,id:l,tabIndex:-1,onBlur:E,style:xi,role:"region","aria-label":P,children:[t("button",{type:"button",onClick:()=>{S&&_&&_.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:ki,children:"×"}),t("div",{role:"note",style:bi,children:Y.join(" ")}),e("table",{role:"table","aria-label":"Node degree summary for "+r,style:wi,children:[e("caption",{style:Si,children:["Top ",j.length," of ",W.length," nodes by degree"]}),t("thead",{children:e("tr",{children:[t("th",{style:Ai,children:"id"}),t("th",{style:Ai,children:"degree"}),t("th",{style:Ai,children:"in"}),t("th",{style:Ai,children:"out"}),F&&t("th",{style:Ai,children:"w. degree"}),F&&t("th",{style:Ai,children:"w. in"}),F&&t("th",{style:Ai,children:"w. out"})]})}),t("tbody",{children:j.map((n,i)=>e("tr",{children:[t("td",{style:_i,children:n.id}),t("td",{style:_i,children:n.degree}),t("td",{style:_i,children:n.inDeg}),t("td",{style:_i,children:n.outDeg}),F&&t("td",{style:_i,children:mi(n.wDegree)}),F&&t("td",{style:_i,children:mi(n.wInDeg)}),F&&t("td",{style:_i,children:mi(n.wOutDeg)})]},i))})]})]})}function Ci({summary:e}){return e?t("div",{role:"note",style:yi,children:e}):null}function Ti({tableId:e}){return t("a",{href:"#"+e,style:yi,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:t=>{Object.assign(t.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:t=>{const e=t.currentTarget;e.removeAttribute("style"),Object.assign(e.style,yi)},children:"Skip to data table"})}function Ei({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,t])=>"object"!=typeof t&&"function"!=typeof t).map(([t,e])=>`${t}: ${e}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:yi,children:n})}const Oi="var(--semiotic-focus, #005fcc)";function Di({active:e,hoverPoint:n,margin:i,size:o,shape:r="circle",width:l,height:s}){if(!e||!n)return null;const a=n.x+i.left,c=n.y+i.top;let u;if("rect"===r&&null!=l&&null!=s){const e=Math.max(l,4),n=Math.max(s,4);u=t("rect",{x:a-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:Oi,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Oi,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Oi,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Li={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ni({x:e,y:n,containerWidth:o,containerHeight:r,margin:l,children:s,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(e)&&Number.isFinite(n),d=i.useRef(null),[h,f]=i.useState(null);i.useLayoutEffect(()=>{const t=d.current;if(!t)return;const e=t.getBoundingClientRect();f(t=>t&&t.width===e.width&&t.height===e.height?t:{width:e.width,height:e.height})},[s,a,o,r]);let g;g=h?`translate(${h.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const y=function(t){if(!i.isValidElement(t))return!1;const e=t.type;if("string"!=typeof e&&e&&!0===e.ownsChrome)return!0;const n=t.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),p=y?null:Li;return u?t("div",{ref:d,className:y?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:l.left+e,top:l.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}const $i="undefined"==typeof window?l:h;function Ii(t,e,n){return"function"==typeof t?t({size:e,margin:n}):t}function Wi(t){const e=function(){const[t,e]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-reduced-motion: reduce)");return e(t.matches),function(t,e){if("function"==typeof t.addEventListener)return t.addEventListener("change",e),()=>t.removeEventListener("change",e);const n=t;return n.addListener(e),()=>n.removeListener(e)}(t,t=>e(t.matches))},[]),t}(),n=o(e);n.current=e;const[s,c]=function(t,e,n){const i=o(null),[r,s]=d(null);return l(()=>{if(!e&&!n)return;const t=i.current;if(!t)return;const o=new ResizeObserver(t=>{for(const e of t){const{width:t,height:n}=e.contentRect;s(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n})}});return o.observe(t),()=>o.disconnect()},[e,n]),[i,[e&&r?r.w:t[0],n&&r?r.h:t[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),u=r(()=>Object.assign(Object.assign({},t.marginDefault),t.userMargin),[t.marginDefault,t.userMargin]),h=c[0]-u.left-u.right,f=c[1]-u.top-u.bottom,g=Ii(t.foregroundGraphics,c,u),y=Ii(t.backgroundGraphics,c,u),p=St(t=>t.theme),{transition:v,introEnabled:m}=function(t,e){var n,i;if(!1===t)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:t?!0===t?{duration:300}:{duration:null!==(i=t.duration)&&void 0!==i?i:300,easing:"linear"===t.easing?"linear":"ease-out"}:e,introEnabled:!(o||!t||!0!==t&&!1===t.intro)}}(t.animate,t.transitionProp),x="semiotic-table-"+i.useId(),b=o(0),k=o(()=>{}),w=a(()=>{b.current||(b.current=requestAnimationFrame(()=>k.current()))},[]);l(()=>()=>{b.current&&(cancelAnimationFrame(b.current),b.current=0)},[]);const A=o(()=>{}),_=o(()=>{}),S=o(null),M=o(0),P=a(()=>{M.current=0;const t=S.current;S.current=null,t&&A.current(t)},[]),C=a(t=>{S.current={clientX:t.clientX,clientY:t.clientY},0===M.current&&(M.current=requestAnimationFrame(P))},[P]),T=a(()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0),_.current()},[]);l(()=>()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0)},[]);const E=t.themeDirtyRef;return $i(()=>{E&&(De++,E.current=!0,w())},[p,w,E]),{reducedMotion:e,reducedMotionRef:n,responsiveRef:s,size:c,margin:u,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:y,currentTheme:p,transition:v,introEnabled:m,tableId:x,rafRef:b,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:_,onPointerMove:C,onPointerLeave:T}}function zi(t,e,n,i){const o=t.getContext("2d");if(!o)return null;const r=e[0]*i,l=e[1]*i,s=e[0]+"px",a=e[1]+"px";return t.style.width!==s&&(t.style.width=s),t.style.height!==a&&(t.style.height=a),t.width===r&&t.height===l||(t.width=r,t.height=l),o.setTransform(i,0,0,i,0,0),o.translate(n.left,n.top),o}function Ri(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Fi(t,e,n){let i=n;for(const n of e)"lesser"===n.thresholdType?n.value>t&&(i=n.color):t>n.value&&(i=n.color);return i}function Yi(t,e,n,i,o,r){if(2>e.length)return;const l=[0];for(let t=1;e.length>t;t++){const n=e[t][0]-e[t-1][0],i=e[t][1]-e[t-1][1];l.push(l[t-1]+Math.sqrt(n*n+i*i))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);t.strokeStyle=n,t.lineWidth=i,t.lineCap=r;for(let n=0;e.length-1>n;n++){const i=(l[n]+l[n+1])/2;let r=o;a>i&&(r*=i/a),a>s-i&&(r*=(s-i)/a),t.globalAlpha=Math.max(0,r),t.beginPath(),t.moveTo(e[n][0],e[n][1]),t.lineTo(e[n+1][0],e[n+1][1]),t.stroke()}}const ji=(t,e,n,i)=>{var o,r;const l=e.filter(t=>"line"===t.type);for(const s of l){if(2>s.path.length)continue;const a=s._introClipFraction;void 0!==a&&1>a&&(t.save(),t.beginPath(),t.rect(0,0,i.width*a,i.height),t.clip());const c=s.style.stroke||"#007bff",u=We(t,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,f=s.rawValues;if(t.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(t.globalAlpha=s.style.opacity),t.lineWidth=d,t.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const v=null!==(o=s.style.opacity)&&void 0!==o?o:1;Yi(t,s.path,u,d,v,s.style.strokeLinecap||"butt"),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt";continue}const g=ze(s.curve),y=h&&h.length>0&&f&&f.length===s.path.length,p=s._decayOpacities;if(p&&p.length===s.path.length&&!y){t.strokeStyle=u;const m=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let x=0;s.path.length-1>x;x++)t.globalAlpha=.5*(p[x]+p[x+1])*m,t.beginPath(),t.moveTo(s.path[x][0],s.path[x][1]),t.lineTo(s.path[x+1][0],s.path[x+1][1]),t.stroke()}else if(y){let b=null,k=null,w=null,A=null,_=!1;function S(e,n,i){t.beginPath(),t.strokeStyle=e,t.moveTo(n,i),_=!0}function M(){_&&(t.stroke(),_=!1)}for(let P=0;s.path.length>P;P++){const[C,T]=s.path[P],E=f[P],O=Fi(E,h,u);if(null!==b&&null!==A&&null!==w){if(O===A)t.lineTo(C,T);else{const D=[];for(const N of h){const $=N.value;(w>$||$>E)&&($>w||E>$)||w===$||E===$||D.push({t:($-w)/(E-w)})}D.sort((t,e)=>t.t-e.t);for(const I of D){const W=b+(C-b)*I.t,z=k+(T-k)*I.t,R=Fi(w+(E-w)*Math.min(I.t+1e-4,1),h,u);t.lineTo(W,z),M(),S(R,W,z)}t.lineTo(C,T)}b=C,k=T,w=E,A=O}else S(O,C,T),b=C,k=T,w=E,A=O}M()}else{t.beginPath();const F=s.strokeGradient&&s.path.length>=2?Ye(t,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(t.strokeStyle=F||u,g)L().x(t=>t[0]).y(t=>t[1]).curve(g).context(t)(s.path);else{const[Y,j]=s.path[0];t.moveTo(Y,j);for(let B=1;s.path.length>B;B++)t.lineTo(s.path[B][0],s.path[B][1])}t.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(t.beginPath(),t.globalAlpha=s.style.fillOpacity,t.fillStyle=Re(t,s.style.fill,s.style.fill),g&&!y)L().x(t=>t[0]).y(t=>t[1]).curve(g).context(t)(s.path);else{const[X,G]=s.path[0];t.moveTo(X,G);for(let V=1;s.path.length>V;V++)t.lineTo(s.path[V][0],s.path[V][1])}const H=s.path[0][0];t.lineTo(s.path[s.path.length-1][0],i.height),t.lineTo(H,i.height),t.closePath(),t.fill()}void 0!==a&&1>a&&t.restore(),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt"}};function Bi(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Hi(t,e,n=.3){Bi(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Xi(t,e,n=.6){var i,o,r,l,s;if(!Bi(e))return;const a=null!==(i=e._pulseGlowRadius)&&void 0!==i?i:4,c=e.r+a*e._pulseIntensity,u=null!==(r=null!==(o=e.cx)&&void 0!==o?o:e.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=e.cy)&&void 0!==l?l:e.y)&&void 0!==s?s:0;t.beginPath(),t.arc(u,d,c,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Gi(t,e,n,i=.35){Bi(e)&&(t.globalAlpha=e._pulseIntensity*i,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fill())}function Vi(t,e){const n=ze(e.curve);if(!n||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1]);for(let n=e.bottomPath.length-1;n>=0;n--)t.lineTo(e.bottomPath[n][0],e.bottomPath[n][1]);t.closePath()}else{const i=N().x(t=>t[0]).y0((t,n)=>e.bottomPath[n][1]).y1(t=>t[1]).curve(n).context(t);t.beginPath(),i(e.topPath)}}const qi=(t,e,n,i)=>{var o,r,l;const s=e.filter(t=>"area"===t.type);for(const e of s){if(2>e.topPath.length)continue;let n=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),n=!0);const s=e._introClipFraction;void 0!==s&&1>s&&(t.save(),t.beginPath(),t.rect(0,0,i.width*s,i.height),t.clip());const a=Re(t,e.style.fill,"#4e79a7"),c=e._decayOpacities;if(c&&c.length===e.topPath.length){const n=null!==(o=e.style.fillOpacity)&&void 0!==o?o:.7;t.fillStyle=a;for(let i=0;e.topPath.length-1>i;i++)t.globalAlpha=.5*(c[i]+c[i+1])*n,t.beginPath(),t.moveTo(e.topPath[i][0],e.topPath[i][1]),t.lineTo(e.topPath[i+1][0],e.topPath[i+1][1]),t.lineTo(e.bottomPath[i+1][0],e.bottomPath[i+1][1]),t.lineTo(e.bottomPath[i][0],e.bottomPath[i][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let n=0;e.topPath.length-1>n;n++)t.globalAlpha=.5*(c[n]+c[n+1]),t.beginPath(),t.moveTo(e.topPath[n][0],e.topPath[n][1]),t.lineTo(e.topPath[n+1][0],e.topPath[n+1][1]),t.stroke()}t.globalAlpha=1;continue}const u=null!==(r=e.style.opacity)&&void 0!==r?r:1;if(Vi(t,e),e.fillGradient&&("colorStops"in e.fillGradient&&e.fillGradient.colorStops.length>=2||"topOpacity"in e.fillGradient)&&e.fillGradient){let n=1/0;for(const t of e.topPath)n>t[1]&&(n=t[1]);let i=-1/0;for(const t of e.bottomPath)t[1]>i&&(i=t[1]);const o=Fe(t,e.fillGradient,"string"==typeof a?a:"#4e79a7",0,n,0,i);t.fillStyle=o||a,t.globalAlpha=u}else{const n=null!==(l=e.style.fillOpacity)&&void 0!==l?l:.7;t.globalAlpha=n*u,t.fillStyle=a}if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(Vi(t,e),Gi(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=u;const n=e.strokeGradient&&e.topPath.length>=2?Ye(t,e.strokeGradient,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0):null;t.strokeStyle=n||We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);const i=ze(e.curve);if(t.beginPath(),i)L().x(t=>t[0]).y(t=>t[1]).curve(i).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1])}t.stroke()}void 0!==s&&1>s&&t.restore(),n&&t.restore(),t.globalAlpha=1}},Ui=(t,e,n,i)=>{var o;const r=e.filter(t=>"point"===t.type);if(0!==r.length){t.save();try{for(const e of r){t.beginPath(),t.arc(e.x,e.y,e.r,0,2*Math.PI);const n=null!==(o=e.style.opacity)&&void 0!==o?o:e.style.fillOpacity;null!=n&&(t.globalAlpha=n),t.fillStyle=Re(t,e.style.fill,"#4e79a7"),t.fill(),e.style.stroke&&(t.strokeStyle=Re(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth||1,t.stroke()),Xi(t,e),t.globalAlpha=1}}finally{t.restore()}}};function Ki(t,e){const{x:n,y:i,w:o,h:r}=e,{tl:l,tr:s,br:a,bl:c}=function(t){const e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(t.w,t.h)/2,i=t=>Math.max(0,Math.min(null!=t?t:0,n));return{tl:i(e.tl),tr:i(e.tr),br:i(e.br),bl:i(e.bl)}}(e);t.beginPath(),t.moveTo(n+l,i),t.lineTo(n+o-s,i),s>0&&t.arcTo(n+o,i,n+o,i+s,s),t.lineTo(n+o,i+r-a),a>0&&t.arcTo(n+o,i+r,n+o-a,i+r,a),t.lineTo(n+c,i+r),c>0&&t.arcTo(n,i+r,n,i+r-c,c),t.lineTo(n,i+l),l>0&&t.arcTo(n,i,n+l,i,l),t.closePath()}function Zi(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}const Qi=(t,e,n,i)=>{const o=e.filter(t=>"rect"===t.type);for(const e of o){if(null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.icon)Ji(t,e);else if(e.cornerRadii&&Qn(e.cornerRadii)){const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=Zi(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n,Ki(t,e),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else if(e.roundedTop&&e.roundedTop>0){const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=Zi(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n;const r=Math.min(e.roundedTop,e.w/2,e.h/2);t.beginPath();const{x:l,y:s,w:a,h:c}=e;switch(e.roundedEdge){case"right":t.moveTo(l,s),t.lineTo(l+a-r,s),t.arcTo(l+a,s,l+a,s+r,r),t.lineTo(l+a,s+c-r),t.arcTo(l+a,s+c,l+a-r,s+c,r),t.lineTo(l,s+c);break;case"left":t.moveTo(l+a,s),t.lineTo(l+r,s),t.arcTo(l,s,l,s+r,r),t.lineTo(l,s+c-r),t.arcTo(l,s+c,l+r,s+c,r),t.lineTo(l+a,s+c);break;case"bottom":t.moveTo(l,s),t.lineTo(l+a,s),t.lineTo(l+a,s+c-r),t.arcTo(l+a,s+c,l+a-r,s+c,r),t.lineTo(l+r,s+c),t.arcTo(l,s+c,l,s+c-r,r);break;default:t.moveTo(l,s+c),t.lineTo(l,s+r),t.arcTo(l,s,l+r,s,r),t.lineTo(l+a-r,s),t.arcTo(l+a,s,l+a,s+r,r),t.lineTo(l+a,s+c)}t.closePath(),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else{const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=Zi(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n,t.fillRect(e.x,e.y,e.w,e.h),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.strokeRect(e.x,e.y,e.w,e.h))}Hi(t,e),t.globalAlpha=1}};function Ji(t,e){const n=e.style.icon,i=e.style.iconPadding||2,o=Math.min(e.w,e.h)-i;if(0>=o)return;const r=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),r){const r=o+i,l=e.x+(e.w-o)/2;for(let i=e.y+e.h-o;i>=e.y-o;i-=r)t.drawImage(n,l,i,o,o)}else{const r=o+i,l=e.y+(e.h-o)/2;for(let i=e.x;e.x+e.w>i;i+=r)t.drawImage(n,i,l,o,o)}t.restore()}function to(t,e,n,i){return Object.assign({data:t,x:e,y:n,__semioticHoverData:!0},i)}function eo(t){const[e,n,i]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*i>128?"#000":"#fff"}function no(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}const io=(t,e,n,i)=>{const o=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of o){const n=e.style;if(null!=(null==n?void 0:n.opacity)&&(t.globalAlpha=n.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h),t.strokeStyle=We(t,"var(--semiotic-surface, #fff)"),t.lineWidth=1,t.strokeRect(e.x,e.y,e.w,e.h),Hi(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const n=e.valueFormat?e.valueFormat(e.value):no(e.value),i=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),o=e.x+e.w/2,r=e.y+e.h/2;t.fillStyle=eo(e.fill),t.font=i+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(n,o,r)}}}finally{t.restore()}},oo=(t,e,n,i)=>{var o,r,l;for(const n of e){if("candlestick"!==n.type)continue;const e=n;t.save();const s=(null!==(o=e._decayOpacity)&&void 0!==o?o:1)*(null!==(l=null===(r=e.style)||void 0===r?void 0:r.opacity)&&void 0!==l?l:1);1!==s&&(t.globalAlpha=s);const a=We(t,e.wickColor)||e.wickColor,c=60>i.height,u=c?Math.max(e.wickWidth,2):e.wickWidth,d=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=a,t.lineWidth=u,t.stroke()};if(c||d(),e.isRange){const n=Math.max(2,Math.min(e.bodyWidth/2,.12*i.height));t.fillStyle=a,t.beginPath(),t.arc(e.x,e.highY,n,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,n,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const n=Math.min(e.openY,e.closeY),i=Math.abs(e.openY-e.closeY),o=e.isUp?e.upColor:e.downColor,r=We(t,o)||o;t.fillStyle=r,t.fillRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(i,1)),t.strokeStyle=r,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(i,1))}c&&d(),t.restore()}};function ro(t,e,n,i){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:i,fn:e}:{key:void 0,fn:null}}const lo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function so(t){const e=t[1]-t[0],n=3156e7;return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:n>e?t=>{const e=new Date(t);return`${lo[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*n>e?t=>{const e=new Date(t);return`${lo[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}const ao={line:[qi,ji,Ui],area:[qi,Ui],stackedarea:[qi,Ui],scatter:[Ui],bubble:[Ui],heatmap:[io],bar:[Qi],swarm:[Ui],waterfall:[(t,e,n,i)=>{var o;Qi(t,e);const r=e.filter(t=>"rect"===t.type);if(2>r.length)return;const l=r[0].datum,s=null==l?void 0:l._connectorStroke;if(s){t.save(),t.strokeStyle=We(t,s)||s,t.lineWidth=null!==(o=null==l?void 0:l._connectorWidth)&&void 0!==o?o:1,t.setLineDash([]);for(let e=0;r.length-1>e;e++){const i=r[e],o=r[e+1],l=i.datum,s=o.datum;if(null==(null==l?void 0:l.cumEnd)||null==(null==s?void 0:s.baseline))continue;const a=n.y(l.cumEnd),c=i.x+i.w,u=o.x;t.beginPath(),t.moveTo(c,a),t.lineTo(u,a),t.stroke()}t.restore()}}],candlestick:[oo],mixed:[qi,ji,Ui],custom:[qi,Qi,io,ji,Ui,oo]},co={top:20,right:20,bottom:30,left:40},uo={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function ho(t,e){const n=t.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const t=n[1],i=n[2],o=n[3];return`#${t}${t}${i}${i}${o}${o}${e}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${e}`;const i=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return i?`rgba(${i[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:n}const fo={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 go({hover:n}){var i,o,r;const l=t=>null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+"",s=null!==(i=n.data)&&void 0!==i?i:{},a=null!==(o=s.y)&&void 0!==o?o:s.value,c=null!==(r=s.x)&&void 0!==r?r:s.time;return e("div",{className:"semiotic-tooltip",style:fo,children:[t("div",{style:{fontWeight:600,marginBottom:2},children:l(a)}),t("div",{style:{opacity:.7,fontSize:11},children:l(c)})]})}go.ownsChrome=!0;const yo=f(function(n,s){var c,u,h,f,p,v,m,x,b,k,w,A,_;const{chartType:S,runtimeMode:M,data:P,chunkThreshold:C,chunkSize:T,xAccessor:E,yAccessor:O,colorAccessor:D,sizeAccessor:L,groupAccessor:N,lineDataAccessor:$,curve:I,normalize:W,baseline:z,stackOrder:R,binSize:F,valueAccessor:Y,arrowOfTime:j="right",windowMode:B="sliding",windowSize:H=200,timeAccessor:X,xExtent:G,yExtent:V,extentPadding:q=.1,scalePadding:U,sizeRange:K,size:Z=[500,300],responsiveWidth:Q,responsiveHeight:J,margin:tt,className:et,background:nt,lineStyle:it,pointStyle:ot,areaStyle:rt,barStyle:lt,waterfallStyle:st,swarmStyle:at,barColors:ct,colorScheme:ut,boundsAccessor:ht,boundsStyle:yt,y0Accessor:pt,band:mt,gradientFill:xt,lineGradient:bt,areaGroups:kt,openAccessor:wt,highAccessor:At,lowAccessor:_t,closeAccessor:St,candlestickStyle:Mt,showAxes:Pt=!0,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:Dt,yFormat:Lt,axisExtent:Nt,tickFormatTime:$t,tickFormatValue:It,hoverAnnotation:Wt,tooltipContent:zt,customHoverBehavior:Rt,customClickBehavior:Ft,enableHover:Yt,hoverRadius:jt=30,tooltipMode:Bt,annotations:Ht,svgAnnotationRules:Xt,showGrid:Gt,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,legendCategoryAccessor:Jt,onCategoriesChange:te,backgroundGraphics:ee,foregroundGraphics:ne,canvasPreRenderers:ie,svgPreRenderers:oe,title:re,categoryAccessor:le,brush:se,onBrush:ae,decay:ce,pulse:ue,transition:de,animate:he,staleness:fe,heatmapAggregation:ge,heatmapXBins:pe,heatmapYBins:ve,showValues:me,heatmapValueFormat:xe,marginalGraphics:be,pointIdAccessor:ke,xScaleType:we,yScaleType:Se,accessibleTable:Me=!0,description:Pe,summary:Ce,linkedCrosshairName:Te,linkedCrosshairSourceId:Ee,customLayout:Oe,layoutConfig:De}=n,Le=g().replace(/:/g,""),Ne=o(!1),$e=Wi({sizeProp:Z,responsiveWidth:Q,responsiveHeight:J,userMargin:tt,marginDefault:co,animate:he,transitionProp:de,themeDirtyRef:Ne}),Ie=ii(),ze=si(),{reducedMotionRef:Re,responsiveRef:Fe,size:Ye,currentTheme:je,transition:Ge,introEnabled:Ve,tableId:qe,rafRef:Ue,renderFnRef:Ke,scheduleRender:Ze}=$e;let Qe=$e.margin;if(be){const t=60,e=Object.assign({},$e.margin);be.top&&t>e.top&&(e.top=t),be.bottom&&t>e.bottom&&(e.bottom=t),be.left&&t>e.left&&(e.left=t),be.right&&t>e.right&&(e.right=t),Qe=e}const on="function"==typeof ne?ne({size:Ye,margin:Qe}):ne,rn="function"==typeof ee?ee({size:Ye,margin:Qe}):ee,an=Ye[0]-Qe.left-Qe.right,cn=Ye[1]-Qe.top-Qe.bottom,un=r(()=>ft(P),[P]),dn=null!=Wt?Wt:Yt,hn=o(null),fn=o(null),[gn,yn]=d(0),[pn,vn]=d(null),mn=o(null),xn=o(null),[bn,kn]=d(null),wn=o(uo.primary),An=o([]),_n=o(Jt),Sn=o(te);_n.current=Jt,Sn.current=te;const[Mn,Pn]=d(!1),[Cn,Tn]=d([]),[En,On]=d([]),Dn="streaming"===M||["bar","swarm","waterfall"].includes(S),Ln=r(()=>{var t,e,n;return{chartType:S,runtimeMode:Dn?"streaming":"bounded",windowSize:H,windowMode:B,arrowOfTime:Dn?j:"right",extentPadding:q,scalePadding:U,axisExtent:Nt,xAccessor:E,yAccessor:O,timeAccessor:Dn?X:void 0,valueAccessor:Y,colorAccessor:D,sizeAccessor:L,groupAccessor:N||($?"_lineGroup":void 0),categoryAccessor:le,lineDataAccessor:$,xScaleType:we,yScaleType:Se,xExtent:G,yExtent:V,sizeRange:K,binSize:F,normalize:W,baseline:z,stackOrder:R,boundsAccessor:ht,boundsStyle:yt,y0Accessor:pt,band:mt,gradientFill:!0===xt?{topOpacity:.8,bottomOpacity:.05}:!1===xt?void 0:xt,areaGroups:kt?new Set(kt):void 0,lineGradient:bt,openAccessor:wt,highAccessor:At,lowAccessor:_t,closeAccessor:St,candlestickStyle:Mt,lineStyle:it,pointStyle:ot,areaStyle:rt,swarmStyle:at,waterfallStyle:st,colorScheme:ut,barColors:ct,barStyle:lt,annotations:Ht,decay:ce,pulse:ue,transition:Ge,introAnimation:Ve,staleness:fe,heatmapAggregation:ge,heatmapXBins:pe,heatmapYBins:ve,showValues:me,heatmapValueFormat:xe,pointIdAccessor:ke,curve:I,themeCategorical:null===(t=null==je?void 0:je.colors)||void 0===t?void 0:t.categorical,themeSemantic:vt(je),themeSequential:null===(e=null==je?void 0:je.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(n=null==je?void 0:je.colors)||void 0===n?void 0:n.diverging,customLayout:Oe,layoutConfig:De,layoutMargin:Qe}},[S,H,B,j,q,U,Nt,E,O,X,Y,we,Se,D,L,N,le,$,G,V,K,F,W,z,R,ht,yt,pt,mt,xt,bt,kt,wt,At,_t,St,Mt,it,ot,rt,at,st,lt,ut,ct,Ht,ce,ue,null==Ge?void 0:Ge.duration,null==Ge?void 0:Ge.easing,Ve,fe,ge,pe,ve,me,xe,Dn,ke,I,je,Oe,De,Qe]),Nn=ci(Ln),$n=o(null);$n.current||($n.current=new Ae(Nn));const In=a(()=>{var t,e;const n=_n.current,i=Sn.current;if(!i||!n)return;const o=function(t,e){if(!e)return[];const n=new Set,i=[];for(const o of t){if(!o||"object"!=typeof o)continue;const t="function"==typeof e?e(o):o[e];if(null==t)continue;const r=t+"";n.has(r)||(n.add(r),i.push(r))}return i}(null!==(e=null===(t=$n.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[],n);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(o,An.current)||(An.current=o,i(o))},[]);l(()=>{var t;null===(t=$n.current)||void 0===t||t.updateConfig(Nn),Ne.current=!0,Ze()},[Nn,Ze]);const Wn=o(null);Wn.current||(Wn.current=new gt(t=>{const e=$n.current;e&&e.ingest(t)&&(Ne.current=!0,Ze())},{chunkThreshold:C,chunkSize:T})),l(()=>{var t;null===(t=Wn.current)||void 0===t||t.updateChunkOptions({chunkThreshold:C,chunkSize:T})},[C,T]);const zn=a(t=>{var e;null===(e=Wn.current)||void 0===e||e.push(t)},[]),Rn=a(t=>{var e;null===(e=Wn.current)||void 0===e||e.pushMany(t)},[]),Fn=a(()=>{var t,e;null===(t=Wn.current)||void 0===t||t.clear(),null===(e=$n.current)||void 0===e||e.clear(),Ne.current=!0,Ze()},[Ze]);y(s,()=>({push:zn,pushMany:Rn,remove:t=>{var e,n,i;null===(e=Wn.current)||void 0===e||e.flush();const o=null!==(i=null===(n=$n.current)||void 0===n?void 0:n.remove(t))&&void 0!==i?i:[];return o.length>0&&(mn.current&&o.some(t=>{var e;return t===(null===(e=mn.current)||void 0===e?void 0:e.data)})&&(mn.current=null,kn(null)),Ne.current=!0,Ze()),o},update:(t,e)=>{var n,i,o;null===(n=Wn.current)||void 0===n||n.flush();const r=null!==(o=null===(i=$n.current)||void 0===i?void 0:i.update(t,e))&&void 0!==o?o:[];return r.length>0&&(Ne.current=!0,Ze()),r},clear:Fn,getData:()=>{var t,e,n;return null===(t=Wn.current)||void 0===t||t.flush(),null!==(n=null===(e=$n.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var t,e;return null!==(e=null===(t=$n.current)||void 0===t?void 0:t.scales)&&void 0!==e?e:null},getExtents:()=>{var t,e;return null!==(e=null===(t=$n.current)||void 0===t?void 0:t.getExtents())&&void 0!==e?e:null}}),[zn,Rn,Fn,Ze]),l(()=>{var t,e;if(P){if($&&un.length>0&&"object"==typeof un[0]&&null!==un[0]){const e="string"==typeof $?$:"coordinates";if(Array.isArray(un[0][e])){const n=[];for(const t of un){const i=t[e];if(Array.isArray(i)){const e=t.label||t.id||t.key;if(null!=e)for(const t of i)n.push(Object.assign(Object.assign({},t),{_lineGroup:e}));else for(const t of i)n.push(t)}}return void(null===(t=Wn.current)||void 0===t||t.setBoundedData(n))}}null===(e=Wn.current)||void 0===e||e.setBoundedData(un)}},[P,un,$]);const{hoverHandlerRef:Yn,hoverLeaveRef:jn,onPointerMove:Bn,onPointerLeave:Hn}=$e;Yn.current=t=>{var e,n;if(!dn)return;const i=hn.current;if(!i)return;const o=i.getBoundingClientRect(),r=t.clientX-o.left-Qe.left,l=t.clientY-o.top-Qe.top;if(0>r||r>an||0>l||l>cn)return void(mn.current&&(mn.current=null,xn.current=null,kn(null),Rt&&(Rt(null),Ne.current=!0),Ze()));const s=$n.current;if(!s||0===s.scene.length)return;const a=He(s.scene,r,l,jt,s.quadtree,s.maxPointRadius),c="multi"===Bt,u=()=>{mn.current&&(mn.current=null,xn.current=null,kn(null),Rt&&Rt(null),Ze())};if(!a&&!c)return void u();const d=c||!a?r:a.x,h=c||!a?l:a.y;let f=to((null==a?void 0:a.datum)?ye(a.datum,s.resolvedRibbons):{},d,h);if(c&&s.scene.length>0&&s.scales){const t=function(t,e,n=30){const i=[];for(const o of t)if("line"===o.type){const t=o;if(2>t.path.length)continue;const r=Xe(Be(t.path,t.curve),e,n);if(null===r)continue;const l=Je(t.path,e);i.push({node:o,datum:Array.isArray(t.datum)&&t.datum[l]?t.datum[l]:t.datum,x:t.path[l][0],y:r,group:t.group,color:t.style.stroke})}else if("area"===o.type){const t=o;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const r=Be(t.topPath,t.curve),l=Be(t.bottomPath,t.curve),s=Xe(r,e,n);if(null===s)continue;const a=Xe(l,e,n),c=Je(t.topPath,e);i.push({node:o,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:s,y0:null!=a?a:void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return i}(s.scene,d,Math.max(jt,an));if(t.length>0){const e=s.scales.y.invert,n=s.scales.x.invert,i=wn.current,o=n?n(d):d;if(a)f.xValue=o,f.xPx=d;else{const t={xValue:o};"string"==typeof E&&(t[E]=o),f=to(t,d,h,{xValue:o,xPx:d})}f.allSeries=t.map(t=>{const n=e?e(t.y):t.y,o=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===S&&null!=o?n-o:n,valuePx:t.y,color:t.color||i,datum:ye(t.datum,s.resolvedRibbons)}})}}a||(null===(e=f.allSeries)||void 0===e?void 0:e.length)?(mn.current=f,xn.current=null!==(n=null==a?void 0:a.node)&&void 0!==n?n:null,kn(f),Rt&&(Rt(f),Ne.current=!0),Ze()):u()},jn.current=()=>{mn.current&&(mn.current=null,xn.current=null,kn(null),Rt&&(Rt(null),Ne.current=!0),Ze())};const Xn=o(()=>{});Xn.current=t=>{if(!Ft)return;const e=hn.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-Qe.left,o=t.clientY-n.top-Qe.top;if(0>i||i>an||0>o||o>cn)return void Ft(null);const r=$n.current;if(!r||0===r.scene.length)return void Ft(null);const l=He(r.scene,i,o,jt,r.quadtree,r.maxPointRadius);Ft(l?to(l.datum||{},l.x,l.y):null)};const Gn=a(t=>Xn.current(t),[]),Vn=o(-1),Un=o(null),Kn=o(null),Qn=a(t=>{const e=$n.current;if(!e||0===e.scene.length)return;const n=e.version;let i;if(Kn.current&&Kn.current.version===n)i=Kn.current.graph;else{const t=function(t){var e,n,i;const o=[];for(const r of t)switch(r.type){case"point":o.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const t=r,n=Array.isArray(t.datum)?t.datum:[],i=null!==(e=t.group)&&void 0!==e?e:"_default";for(let e=0;t.path.length>e&&n.length>e;e++)o.push({x:t.path[e][0],y:t.path[e][1],datum:n[e],shape:"circle",group:i});break}case"area":{const t=r,e=Array.isArray(t.datum)?t.datum:[],i=null!==(n=t.group)&&void 0!==n?n:"_default";for(let n=0;t.topPath.length>n&&e.length>n;n++)o.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:e[n],shape:"circle",group:i});break}case"rect":o.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(i=r.group)&&void 0!==i?i:"_default"});break;case"heatcell":o.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return o.sort((t,e)=>t.x-e.x||t.y-e.y),o}(e.scene);if(0===t.length)return;i=tn(t),Kn.current={version:n,graph:i}}const o=Vn.current;if(0>o){if("Escape"===t.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key))return;t.preventDefault(),Vn.current=0;const n=i.flat[0];Un.current={shape:n.shape,w:n.w,h:n.h};const o=ln(Object.assign(Object.assign({},n),{datum:ye(n.datum,e.resolvedRibbons)}));return mn.current=o,kn(o),Rt&&Rt(o),void Ze()}const r=en(i,o),l=nn(t.key,r,i);if(null===l)return;if(t.preventDefault(),0>l)return Vn.current=-1,Un.current=null,mn.current=null,xn.current=null,kn(null),Rt&&Rt(null),void Ze();Vn.current=l;const s=i.flat[l];Un.current={shape:s.shape,w:s.w,h:s.h};const a=ln(Object.assign(Object.assign({},s),{datum:ye(s.datum,e.resolvedRibbons)}));mn.current=a,kn(a),Rt&&Rt(a),Ze()},[Rt,Ze]),Jn=a(t=>{Vn.current=-1,Un.current=null,Bn(t)},[Bn]);Ke.current=()=>{var t,e;Ue.current=0;const n=hn.current,i=fn.current;if(!n||!i)return;const o=$n.current;if(!o)return;const r="undefined"!=typeof performance?performance.now():Date.now(),l=o.advanceTransition(Re.current?r+1e6:r),s=!Re.current&&l,a=Ne.current||l;a&&!s&&(o.computeScene({width:an,height:cn}),In());const c=Ri(),u=function(t){if(!t)return uo;const e=getComputedStyle(t),n=e.getPropertyValue("--semiotic-border").trim(),i=e.getPropertyValue("--semiotic-text-secondary").trim(),o=e.getPropertyValue("--semiotic-bg").trim(),r=e.getPropertyValue("--semiotic-primary").trim(),l=i||e.getPropertyValue("--text-secondary").trim(),s=e.getPropertyValue("--text-primary").trim(),a=n||e.getPropertyValue("--surface-3").trim(),c=o||e.getPropertyValue("--surface-0").trim();return l||s||n||r?{axisStroke:a||uo.axisStroke,tickText:l||uo.tickText,crosshair:l?ho(l,"66"):uo.crosshair,hoverFill:c?ho(c,"4D"):uo.hoverFill,hoverStroke:l?ho(l,"99"):uo.hoverStroke,pointRing:c||uo.pointRing,primary:r||uo.primary}:uo}(n);wn.current=u.primary;const d=null!==(t=null==fe?void 0:fe.threshold)&&void 0!==t?t:5e3,h=fe&&o.lastIngestTime>0&&r-o.lastIngestTime>d;if(a){const t=zi(n,Ye,Qe,c);if(t){if(t.clearRect(-Qe.left,-Qe.top,Ye[0],Ye[1]),h&&(t.globalAlpha=null!==(e=null==fe?void 0:fe.dimOpacity)&&void 0!==e?e:.5),"transparent"!==nt&&!ee){const e=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=nt||(e&&"transparent"!==e?e:null),o=i?We(t,i):null;o&&(t.fillStyle=o,t.fillRect(-Qe.left,-Qe.top,Ye[0],Ye[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,an,cn),t.clip()),ie&&o.scales)for(const e of ie)t.save(),e(t,o.scene,o.scales,{width:an,height:cn}),t.restore();const i=Oe?ao.custom:ao[S];if(i&&o.scales)for(const e of i)e(t,o.scene,o.scales,{width:an,height:cn});t.restore(),h&&(t.globalAlpha=1)}}{const t=zi(i,Ye,Qe,c);if(t&&(t.clearRect(-Qe.left,-Qe.top,Ye[0],Ye[1]),dn&&mn.current&&o.scales&&function(t,e,n,i,o,r,l){var s;if(!1===o.crosshair)return;const a=e.allSeries,c=a&&a.length>0,u=null!==(s=e.xPx)&&void 0!==s?s:e.x;t.save();const d="object"==typeof o.crosshair?o.crosshair:{};if(t.strokeStyle=d.stroke||l.crosshair,t.lineWidth=d.strokeWidth||1,t.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(c?u:e.x,0),t.lineTo(c?u:e.x,i),t.stroke(),c||(t.beginPath(),t.moveTo(0,e.y),t.lineTo(n,e.y),t.stroke()),t.restore(),c){t.lineWidth=2,t.strokeStyle=l.pointRing;for(const e of a)null!=e.valuePx&&(t.beginPath(),t.arc(u,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||l.primary,t.fill(),t.stroke())}else{const n=o.pointColor||function(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const n="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||n||null:n||e.stroke||null}(r)||l.primary;t.beginPath(),t.arc(e.x,e.y,4,0,2*Math.PI),t.fillStyle=n,t.fill(),t.strokeStyle=l.pointRing,t.lineWidth=2,t.stroke()}}(t,mn.current,an,cn,"object"==typeof dn?dn:{},xn.current,u),xn.current&&Array.isArray(Wt))){const e=Wt.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,n,i,o){var r;if(!n)return;const l="group"in n?n.group:void 0;if(void 0!==l)for(const n of e){if("line"!==n.type)continue;if(n.group!==l)continue;if(2>n.path.length)continue;const e="function"==typeof i.style?n.datum?i.style(n.datum):{}:i.style||{};t.save(),t.beginPath(),t.moveTo(n.path[0][0],n.path[0][1]);for(let e=1;n.path.length>e;e++)t.lineTo(n.path[e][0],n.path[e][1]);t.strokeStyle=e.stroke||n.style.stroke||o.primary,t.lineWidth=e.strokeWidth||(n.style.strokeWidth||2)+2,t.globalAlpha=null!==(r=e.opacity)&&void 0!==r?r:1,t.stroke(),t.restore()}}(t,o.scene,xn.current,e,u)}}a&&n&&n.setAttribute("aria-label",pi(o.scene,S+" chart"));const f=Ne.current;if(Ne.current=!1,f&&o.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!pn||t(pn.x.domain()[0])!==t(o.scales.x.domain()[0])||t(pn.x.domain()[1])!==t(o.scales.x.domain()[1])||t(pn.y.domain()[0])!==t(o.scales.y.domain()[0])||t(pn.y.domain()[1])!==t(o.scales.y.domain()[1])||pn.x.range()[0]!==o.scales.x.range()[0]||pn.x.range()[1]!==o.scales.x.range()[1]||pn.y.range()[0]!==o.scales.y.range()[0]||pn.y.range()[1]!==o.scales.y.range()[1])&&vn(o.scales),be){const t=o.getData(),e="function"==typeof E?E:t=>t[E||"x"],n="function"==typeof O?O:t=>t[O||"y"];Tn(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),On(t.map(t=>n(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}f&&Ht&&Ht.length>0&&yn(t=>t+1),(null==fe?void 0:fe.showBadge)&&Pn(!!h),(s||null!=o.activeTransition||o.hasActivePulses)&&(Ue.current=requestAnimationFrame(()=>Ke.current()))},ai({hydrated:Ie,wasHydratingFromSSR:ze,storeRef:$n,dirtyRef:Ne,renderFnRef:Ke,cleanup:()=>{var t;return null===(t=Wn.current)||void 0===t?void 0:t.clear()}}),l(()=>{Ne.current=!0,Ze()},[S,an,cn,Pt,nt,it,ie,Ze]),sn(fe,$n,Ne,Ze,Mn,Pn);const ni=r(()=>{if(Dt||$t)return;const t=$n.current;return(null==t?void 0:t.xIsDate)&&pn?so(pn.x.domain()):void 0},[Dt,$t,pn]),oi=Dt||$t||ni,ri=dn&&bn?zt?zt(bn):t(go,{hover:bn}):null,li=ri?t(Ni,{x:bn.x,y:bn.y,containerWidth:an,containerHeight:cn,margin:Qe,className:"stream-frame-tooltip",children:ri}):null,ui=Un.current,di=t(Di,{active:Vn.current>=0,hoverPoint:bn,margin:Qe,size:Ye,shape:null==ui?void 0:ui.shape,width:null==ui?void 0:ui.w,height:null==ui?void 0:ui.h}),hi=ro(E,X,"__semiotic_resolvedX","__semiotic_resolvedTime"),fi=ro(O,Y,"__semiotic_resolvedY","__semiotic_resolvedValue"),gi=hi.key,yi=fi.key,vi=function(t,e,n){return i=>{if(!i||!n||!t.fn&&!e.fn)return i;let o=!1;const r=i.map(n=>{const i=t.fn&&t.key&&!(t.key in n),r=e.fn&&e.key&&!(e.key in n);if(!i&&!r)return n;o=!0;const l=Object.assign({},n);return i&&(l[t.key]=t.fn(n)),r&&(l[e.key]=e.fn(n)),l});return o?r:i}}(hi,fi,Ht&&Ht.length>0||!1);if(ei||!Ie&&ze){const n=$n.current;n&&P&&(n.ingest({inserts:un,bounded:!0}),n.computeScene({width:an,height:cn}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,l=oi||(()=>{if((null==n?void 0:n.xIsDate)&&r)return so(r.x.domain())})();return e("div",{ref:Fe,className:"stream-xy-frame"+(et?" "+et:""),role:"img","aria-label":Pe||("string"==typeof re?re:"XY chart"),style:{position:"relative",width:Q?"100%":Ye[0],height:J?"100%":Ye[1]},children:[t(Ci,{summary:Ce}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ye[0],height:Ye[1],style:{position:"absolute",left:0,top:0},children:[t("g",{transform:`translate(${Qe.left},${Qe.top})`,children:rn}),e("g",{transform:`translate(${Qe.left},${Qe.top})`,children:[nt&&t("rect",{x:0,y:0,width:an,height:cn,fill:nt}),oe&&r&&oe.map((e,n)=>t(i.Fragment,{children:e(o,r,{width:an,height:cn})},"svgpre-"+n)),o.map((n,i)=>function(n,i,o){var r,l,s,a,c;switch(n.type){case"line":{const e=n;if(0===e.path.length)return null;const o="M"+e.path.map(([t,e])=>`${t},${e}`).join("L");return t("path",{d:o,fill:"none",stroke:e.style.stroke||"#4e79a7",strokeWidth:e.style.strokeWidth||2,strokeDasharray:e.style.strokeDasharray,opacity:e.style.opacity},"line-"+i)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([t,e])=>`${t},${e}`).join("L")}L${[...c.bottomPath].reverse().map(([t,e])=>`${t},${e}`).join("L")}Z`;if(c.clipRect){const n=`${o?o+"-":""}area-clip-${i}`;return e("g",{children:[t("defs",{children:t("clipPath",{id:n,children:t("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),t("path",{d:u,fill:ti(c.style.fill),fillOpacity:null!==(l=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+i)}return t("path",{d:u,fill:ti(c.style.fill),fillOpacity:null!==(a=null!==(s=c.style.fillOpacity)&&void 0!==s?s:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+i)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:ti(e.style.fill),opacity:null!==(c=e.style.opacity)&&void 0!==c?c:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"point-"+i)}case"rect":{const e=n;return t("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:ti(e.style.fill),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"rect-"+i)}case"heatcell":{const o=n;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const n=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,l,s]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(o.fill),a=.299*r+.587*l+.114*s>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e("g",{children:[t("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),t("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:c+"px",children:n})]},"heatcell-"+i)}return t("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+i)}case"candlestick":{const o=n,r=Math.min(o.openY,o.closeY),l=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e("g",{children:[t("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),t("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:l,fill:s,stroke:s,strokeWidth:1})]},"candle-"+i)}default:return null}}(n,i,Le)).filter(Boolean)]})]}),t(Zn,{width:an,height:cn,totalWidth:Ye[0],totalHeight:Ye[1],margin:Qe,scales:r,showAxes:Pt,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:l,yFormat:Lt||It,axisExtent:Nt,showGrid:Gt,title:re,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,foregroundGraphics:_e(on,null===(h=$n.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:be,xValues:[],yValues:[],annotations:Ht,svgAnnotationRules:Xt,annotationFrame:0,xAccessor:gi,yAccessor:yi,annotationData:vi(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(t=>"point"===t.type),curve:"string"==typeof I?I:void 0,linkedCrosshairName:Te,linkedCrosshairSourceId:Ee})]})}return e("div",{ref:Fe,className:"stream-xy-frame"+(et?" "+et:""),role:"group","aria-label":Pe||("string"==typeof re?re:"XY chart"),tabIndex:0,style:{position:"relative",width:Q?"100%":Ye[0],height:J?"100%":Ye[1],overflow:"visible"},onKeyDown:Qn,children:[Me&&t(Ti,{tableId:qe}),Me&&t(Mi,{scene:null!==(p=null===(f=$n.current)||void 0===f?void 0:f.scene)&&void 0!==p?p:[],chartType:S+" chart",tableId:qe,chartTitle:"string"==typeof re?re:void 0}),t(Ci,{summary:Ce}),e("div",{role:"img","aria-label":Pe||("string"==typeof re?re:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:dn?Jn:void 0,onMouseLeave:dn?Hn:void 0,onClick:Ft?Gn:void 0,children:[rn&&t("svg",{style:{position:"absolute",left:0,top:0,width:Ye[0],height:Ye[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Qe.left},${Qe.top})`,children:rn})}),t(qn,{width:an,height:cn,totalWidth:Ye[0],totalHeight:Ye[1],margin:Qe,scales:pn,showAxes:Pt,axes:Ct,showGrid:Gt,xFormat:oi,yFormat:Lt||It,axisExtent:Nt}),t("canvas",{ref:hn,"aria-label":pi(null!==(m=null===(v=$n.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],S+" chart"),style:{position:"absolute",left:0,top:0}}),t("canvas",{ref:fn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),t(Ei,{hoverPoint:bn}),t(Zn,{width:an,height:cn,totalWidth:Ye[0],totalHeight:Ye[1],margin:Qe,scales:pn,showAxes:Pt,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:oi,yFormat:Lt||It,axisExtent:Nt,showGrid:Gt,title:re,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,foregroundGraphics:_e(on,null===(x=$n.current)||void 0===x?void 0:x.customLayoutOverlays),marginalGraphics:be,xValues:Cn,yValues:En,annotations:Ht,svgAnnotationRules:Xt,annotationFrame:gn,xAccessor:gi,yAccessor:yi,annotationData:vi(null===(b=$n.current)||void 0===b?void 0:b.getData()),pointNodes:null===(k=$n.current)||void 0===k?void 0:k.scene.filter(t=>"point"===t.type),curve:"string"==typeof I?I:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==nt&&!ee,linkedCrosshairName:Te,linkedCrosshairSourceId:Ee}),(se||ae)&&t(dt,{width:an,height:cn,totalWidth:Ye[0],totalHeight:Ye[1],margin:Qe,dimension:null!==(w=null==se?void 0:se.dimension)&&void 0!==w?w:"xy",scales:pn,onBrush:null!=ae?ae:()=>{},binSize:F,snap:null==se?void 0:se.snap,binBoundaries:null!==(A=null==se?void 0:se.binBoundaries)&&void 0!==A?A:"bar"===S?null===(_=$n.current)||void 0===_?void 0:_.getBinBoundaries():void 0,snapDuring:null==se?void 0:se.snapDuring,streaming:"streaming"===M}),(null==fe?void 0:fe.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===fe.badgePosition?{top:4,left:4}:"bottom-left"===fe.badgePosition?{bottom:4,left:4}:"bottom-right"===fe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Mn?"#dc3545":"#28a745",color:"white"}),children:Mn?"STALE":"LIVE"}),di,li]})]})});yo.displayName="StreamXYFrame";const po={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},vo={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class mo{constructor(t){this.capacity=t,this.particles=Array(t),this._freeIndices=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[e]=t-1-e}spawn(t){const e=this._freeIndices.pop();if(void 0===e)return null;const n=this.particles[e];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=t,n.x=0,n.y=0,n}step(t,e,n,i){var o;for(let r=0;this.capacity>r;r++){const l=this.particles[r];if(!l.active)continue;const s=n[l.edgeIndex];if(!s||!s.bezier){l.active=!1,this._freeIndices.push(r);continue}const a=i&&null!==(o=i[l.edgeIndex])&&void 0!==o?o:1;l.t+=t*e*a*(s.bezier.circular?.3:1),1>l.t?xo(s.bezier,l.t,l.offset,l):(l.active=!1,this._freeIndices.push(r))}}countForEdge(t){let e=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1;this._freeIndices.length=0;for(let t=this.capacity-1;t>=0;t--)this._freeIndices.push(t)}resize(t){if(this.capacity>=t)return;const e=this.particles;this.particles=Array(t);for(let n=0;t>n;n++)e.length>n?this.particles[n]=e[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=t}}function xo(t,e,n,i){if(t.circular&&t.segments)return void function(t,e,n,i,o){const r=t.length,l=e*r,s=Math.min(Math.floor(l),r-1),a=l-s,[c,u,d,h]=t[s];bo(c,u,d,h,a,o);const f=h.x-c.x,g=h.y-c.y,y=Math.sqrt(f*f+g*g);if(y>.001){const t=f/y;o.x+=-g/y*n*i*2,o.y+=t*n*i*2}}(t.segments,e,n,t.halfWidth,i);if(!t.points)return i.x=0,void(i.y=0);const[o,r,l,s]=t.points;bo(o,r,l,s,e,i);const a=s.x-o.x,c=s.y-o.y,u=Math.sqrt(a*a+c*c);if(u>.001){const e=a/u;i.x+=-c/u*n*t.halfWidth*2,i.y+=e*n*t.halfWidth*2}}function bo(t,e,n,i,o,r){const l=1-o,s=l*l,a=s*l,c=o*o,u=c*o;r.x=a*t.x+3*s*o*e.x+3*l*c*n.x+u*i.x,r.y=a*t.y+3*s*o*e.y+3*l*c*n.y+u*i.y}function ko(t,e){var n=t.get(e);if(!n)throw Error("missing: "+e);return n}function wo(t,e){var n,i=[],o=[],r=[],l={},s=[];function a(t){r[t]=!1,l.hasOwnProperty(t)&&Object.keys(l[t]).forEach(function(e){delete l[t][e],r[e]&&a(e)})}function c(t){var e,i,d=!1;for(o.push(t),r[t]=!0,e=0;s[t].length>e;e++)(i=s[t][e])===n?(u(n,o),d=!0):r[i]||(d=c(i));if(d)a(t);else for(e=0;s[t].length>e;e++){var h=l[i=s[t][e]];h||(l[i]=h={}),h[i]=!0}return o.pop(),d}function u(t,e){var n=[].concat(e).concat(t);i.push(n)}function d(e){!function(e){for(var n=0;t.length>n;n++)n>=e&&t[n]||(t[n]=[]),t[n]=t[n].filter(function(t){return t>=e})}(e);for(var n,i=function(t){for(var e=t.length,n=Array(e),i=Array(e),o=Array(e),r=Array(e),l=Array(e),s=Array(e),a=0;e>a;++a)n[a]=-1,i[a]=0,o[a]=!1,r[a]=0,l[a]=-1,s[a]=[];var c,u=0,d=[],h=[];function f(e){var a=[e],c=[e];for(n[e]=i[e]=u,o[e]=!0,u+=1;c.length>0;){var f=t[e=c[c.length-1]];if(f.length>r[e]){for(var g=r[e];f.length>g;++g){var y=f[g];if(0>n[y]){n[y]=i[y]=u,o[y]=!0,u+=1,a.push(y),c.push(y);break}o[y]&&(i[e]=0|Math.min(i[e],i[y])),0>l[y]||s[e].push(l[y])}r[e]=g}else{if(i[e]===n[e]){var p=[],v=[],m=0;for(g=a.length-1;g>=0;--g){var x=a[g];if(o[x]=!1,p.push(x),v.push(s[x]),m+=s[x].length,l[x]=d.length,x===e){a.length=g;break}}d.push(p);var b=Array(m);for(g=0;v.length>g;g++)for(var k=0;v[g].length>k;k++)b[--m]=v[g][k];h.push(b)}c.pop()}}}for(a=0;e>a;++a)0>n[a]&&f(a);for(a=0;h.length>a;a++){var g=h[a];if(0!==g.length){g.sort(function(t,e){return t-e}),c=[g[0]];for(var y=1;g.length>y;y++)g[y]!==g[y-1]&&c.push(g[y]);h[a]=c}}return{components:d,adjacencyList:h}}(t),o=i.components.filter(function(t){return t.length>1}),r=1/0,l=0;o.length>l;l++)for(var s=0;o[l].length>s;s++)r>o[l][s]&&(r=o[l][s],n=l);var a=o[n];if(!a)return!1;var c=t.map(function(t,e){return-1===a.indexOf(e)?[]:t.filter(function(t){return-1!==a.indexOf(t)})});return{leastVertex:r,adjList:c}}n=0;for(var h=t.length;h>n;){var f=d(n);if(n=f.leastVertex,s=f.adjList){for(var g=0;s.length>g;g++)for(var y=0;s[g].length>y;y++){var p=s[g][y];r[+p]=!1,l[p]={}}c(n),n+=1}else n=h}return i}function Ao(t){return t.y0-t.y1>0?"up":"down"}function _o(t,e){return e(t.source)==e(t.target)}function So(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var n=0;return t.target.targetLinks.forEach(function(t){n=t.circular?n+1:n}),1>=e&&1>=n}function Mo(t){return t.target.x0-t.source.x1}function Po(t,e){var n=To(t),i=Mo(e)/Math.tan(n);return"up"==Ao(t)?t.y1-i:t.y1+i}function Co(t,e){var n=To(t),i=Mo(e)/Math.tan(n);return"up"==Ao(t)?t.y1+i:t.y1-i}function To(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function Eo(t,e){return e(t)}function Oo(t){return Lo(t.source)}function Do(t){return Lo(t.target)}function Lo(t){return(t.y0+t.y1)/2}function No(t){return t.virtual?0:t.value}function $o(t,e){var n=0;t.sourceLinks.forEach(function(t){n=t.circular&&!_o(t,e)?n+1:n});var i=0;return t.targetLinks.forEach(function(t){i=t.circular&&!_o(t,e)?i+1:i}),n+i}function Io(t){return t.target.depth}function Wo(t,e){return t.sourceLinks.length?t.depth:e-1}function zo(t,e){return t.y0-e.y0}function Ro(t,e){return e.y0-t.y0}function Fo(t,e){return t.y1-e.y1}function Yo(t,e){return e.y1-t.y1}function jo(t,e){return Ho(t.source,e.source)||t.index-e.index}function Bo(t,e){return Ho(t.target,e.target)||t.index-e.index}function Ho(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function Xo(t,e){return Go(t)==Go(e)?"bottom"==t.circularLinkType?Ro(t,e):zo(t,e):Go(e)-Go(t)}function Go(t){return t.target.column-t.source.column}function Vo(t,e){return qo(t)==qo(e)}function qo(t){return t.y0-t.y1>0?"up":"down"}function Uo(t,e,n,i,o){let r=t;var l=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,l))});var s=R(r.links,function(t){return t.source.y0});r.links.forEach(function(t){t.circular&&(t.circularPathData={})});var a=r.links.filter(function(t){return t.circular});return a.sort(function(t,e){return e.value-t.value}),a.forEach(function(t,e){t._circularStub=e>=4}),Ko(r.links.filter(function(t){return"top"==t.circularLinkType}),e,n),Ko(r.links.filter(function(t){return"bottom"==t.circularLinkType}),e,n),r.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+i,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,_o(t,e)&&So(t))t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var l=t.source.column,a=t.circularLinkType,c=r.links.filter(function(t){return t.source.column==l&&t.circularLinkType==a});c.sort("bottom"==t.circularLinkType?Ro:zo);var u=0;c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),l=t.target.column,(c=r.links.filter(function(t){return t.target.column==l&&t.circularLinkType==a})).sort("bottom"==t.circularLinkType?Yo:Fo),u=0,c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(r.y1,t.source.y1,t.target.y1)+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=s-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,n=t.y0,i=t.target.x0,o=t.y1,r=(e+i)/2;return"M"+e+","+n+"C"+r+","+n+" "+r+","+o+" "+i+","+o}(t)}),r}function Ko(t,e,n){t.sort(Xo);var i=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,o){var r=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(_o(t,e)&&So(t))t.circularPathData.verticalBuffer=r+t._circularWidth/2;else{for(var l=0;i.length>l;l++){var s=i[l];if(s!==t&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Zo(t,s)){var a=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;r=a>r?a:r}}t.circularPathData.verticalBuffer=r+t._circularWidth/2}}),t}function Zo(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}function Qo(t){return function(){return t}}function Jo(t){return t.index}function tr(t){return t.nodes}function er(t){return t.links}function nr(t,e,n){var i=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});i.forEach(function(o,r){var l=o.length;if(e)o.sort(e);else if(r>0){var s=new Map;o.forEach(function(t,e){var n,i,o,r=(i=0,o=0,(n=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=Lo(t.source)*e,i+=e}}),n.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=Lo(t.target)*e,i+=e}}),i>0?o/i:NaN);s.set(t,{bc:r,idx:e})}),o.sort(function(t,e){var n=s.get(t),i=s.get(e),o=n.bc,r=i.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(o)||isNaN(r)?isNaN(o)?isNaN(r)?n.idx-i.idx:1:-1:o-r})}else o.sort(function(t,e){return t.circularLinkType==e.circularLinkType?$o(e,n)-$o(t,n):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});o.forEach(function(e,o){e.depth==i.length-1&&1==l||0==e.depth&&1==l?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==$o(e,n)?(e.y0=t.y1/2+o,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+o,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-o,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/l*o,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-l/2+o,e.y1=e.y0+e.value*t.ky)})})}function ir(t,e,n,i,o,r){var l=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var s=1,a=r;a>0;--a)c(s*=.99,n),u();function c(e,n){var i=l.length;l.forEach(function(o){var r=o.length,l=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&$o(o,n)>0){var a=B(o.sourceLinks,Do),c=B(o.targetLinks,Oo),u=a&&c?(a+c)/2:a||c;if(u){var d=(u-Lo(o))*e*.3;o.y0+=d,o.y1+=d}}else if(0==l&&1==r)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(l==i-1&&1==r)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=B(o.sourceLinks,Do),f=B(o.targetLinks,Oo),g=((h&&f?(h+f)/2:h||f)-Lo(o))*e;o.y0+=g,o.y1+=g}})})}function u(){l.forEach(function(n){var r,l,s,a=t.y0,c=n.length;for(n.sort(e||Ho),s=0;c>s;++s)(l=a-(r=n[s]).y0)>0&&(r.y0+=l,r.y1+=l),a=r.y1+i;if((l=a-i-t.y1)>0)for(a=r.y0-=l,r.y1-=l,s=c-2;s>=0;--s)(l=(r=n[s]).y1+o-a)>0&&(r.y0-=l,r.y1-=l),a=r.y0})}}function or(t){t.nodes.forEach(function(t){t.sourceLinks.sort(Bo),t.targetLinks.sort(jo)}),t.nodes.forEach(function(t){var e=t.y0,n=e,i=t.y1,o=i;t.sourceLinks.forEach(function(t){t.circular?(t.y0=i-t.width/2,i-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=o-t.width/2,o-=t.width):(t.y1=n+t.width/2,n+=t.width)})})}function rr(){var t=0,e=0,n=1,i=1,o=24,r=8,l=null,s=Jo,a=Wo,c=void 0,u=32,d=2,h=tr,f=er;function g(){var g={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=t,h.y0=e,h.x1=n,h.y1=i,h.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var n=function(t,e){var n=new Map;return H(t,e).forEach(function(t,e){n.set(e,t[0])}),n}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var i=t.source,o=t.target;"object"!=typeof i&&(i=t.source=ko(n,i)),"object"!=typeof o&&(o=t.target=ko(n,o)),i.sourceLinks.push(t),o.targetLinks.push(t)})}(h,s),function(t,e){var n=0;if(null==e){for(var i=[],o=0;t.links.length>o;o++){var r=t.links[o],l=r.source.index,s=r.target.index;i[l]||(i[l]=[]),i[s]||(i[s]=[]),-1===i[l].indexOf(s)&&i[l].push(s)}var a=wo(i);a.sort(function(t,e){return t.length-e.length});var c={};for(o=0;a.length>o;o++){var u=a[o].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,i=t.source.index;e===i||c[i]&&c[i][e]?(t.circular=!0,t.circularLinkID=n++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=n++)})}(h,c),function(t,e){var n=0,i=0;t.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:i>n?"top":"bottom","top"==o.circularLinkType?n++:i++,t.nodes.forEach(function(t){Eo(t,e)!=Eo(o.source,e)&&Eo(t,e)!=Eo(o.target,e)||(t.circularLinkType=o.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),_o(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(h,s),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(j(t.sourceLinks,No),j(t.targetLinks,No)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(h),function(t,e,n){var i,o,r;if(null!=e){t.nodes.sort(function(t,n){return e(t)<e(n)?-1:1});var l=0,s=e(t.nodes[0]);t.nodes.forEach(function(t){l=e(t)==s?l:l+1,s=e(t)==s?s:e(t),t.column=l})}for(i=t.nodes,o=[],r=0;i.length;++r,i=o,o=[])i.forEach(function(t){t.depth=r,t.sourceLinks.forEach(function(t){0>o.indexOf(t.target)&&!t.circular&&o.push(t.target)})});for(i=t.nodes,o=[],r=0;i.length;++r,i=o,o=[])i.forEach(function(t){t.height=r,t.targetLinks.forEach(function(t){0>o.indexOf(t.source)&&!t.circular&&o.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?n(t,r):t.column})}(h,c,a);var f=r;if(null!==l){var g=F(h.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),y=Y(g,function(t){return t.length});y>1&&(f=Math.max(1,(i-e)*l/(y-1)))}(function(t,e,n){var i=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var o=R(i,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/j(e,function(t){return t.value})});t.ky=o,t.links.forEach(function(e){e.width=e.value*t.ky});var r=Y(t.nodes,function(t){return t.column});t.nodes.forEach(r>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-n)/r),e.x1=e.x0+n}:function(e){e.x0=t.x0,e.x1=e.x0+n})})(h,f,o),nr(h,c,s),ir(h,c,s,f,f,u),or(h),Uo(h,s,d,10,8),nr(h,c,s),ir(h,c,s,f,f,u),or(h),Uo(h,s,d,10,8),function(t,e){let n=t;n.nodes.forEach(function(t){t.y+(t.y1-t.y0)>n.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-n.y1));var i=n.links.filter(function(n){return Eo(n.source,e)==Eo(t,e)}),o=i.length;o>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!Vo(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var n=Po(e,t);return t.y1-n}if(e.target.column>t.target.column)return Po(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;i.forEach(function(t){t.y0=r+t.width/2,r+=t.width}),i.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var r=n+1,l=0;o>r;r++)l+=i[r].width;e.y0=t.y1-l-e.width/2}})})}(h,s),function(t,e){let n=t;n.nodes.forEach(function(t){var i=n.links.filter(function(n){return Eo(n.target,e)==Eo(t,e)}),o=i.length;o>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!Vo(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var n=Co(e,t);return t.y0-n}if(e.source.column>t.source.column)return Co(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;i.forEach(function(t){t.y1=r+t.width/2,r+=t.width}),i.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var r=n+1,l=0;o>r;r++)l+=i[r].width;e.y1=t.y1-l-e.width/2}})})}(h,s),function(t){var e=t.nodes,n=t.links,i=!1,o=!1;if(n.forEach(function(t){"top"==t.circularLinkType?i=!0:"bottom"==t.circularLinkType&&(o=!0)}),0==i||0==o){var r=R(e,function(t){return t.y0}),l=Y(e,function(t){return t.y1}),s=(t.y1-t.y0)/(l-r);function a(e){return(e-r)/(l-r)*(t.y1-t.y0)+t.y0}1>s?(e.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1)}),n.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1),t.width=t.width*s})):e.forEach(function(t){var e=t.y1-t.y0,n=a(t.y0)-t.y0;t.y0=a(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+n}),t.targetLinks.forEach(function(t){t.y1=t.y1+n})})}}(h),Uo(h,s,d,10,8)}(g),g}return g.update=function(t){return or(t),Uo(t,s,d,10,8),t},g.nodeWidth=function(t){return arguments.length?(o=+t,g):o},g.nodePadding=function(t){return arguments.length?(r=+t,g):r},g.nodePaddingRatio=function(t){return arguments.length?(l=+t,g):l},g.nodes=function(t){return arguments.length?(h="function"==typeof t?t:Qo(t),g):h},g.links=function(t){return arguments.length?(f="function"==typeof t?t:Qo(t),g):f},g.nodeId=function(t){return arguments.length?(s="function"==typeof t?t:Qo(t),g):s},g.nodeAlign=function(t){return arguments.length?(a="function"==typeof t?t:Qo(t),g):a},g.nodeSort=function(t){return arguments.length?(c=t,g):c},g.iterations=function(t){return arguments.length?(u=+t,g):u},g.circularLinkGap=function(t){return arguments.length?(d=+t,g):d},g.extent=function(o){return arguments.length?(t=+o[0][0],e=+o[0][1],n=+o[1][0],i=+o[1][1],g):[[t,e],[n,i]]},g.size=function(o){return arguments.length?(t=e=0,n=+o[0],i=+o[1],g):[n-t,i-e]},g}const lr=t=>{let e,n,i,o,r,l,s,a,c;if("down"===t.direction)return e=t.y0-t.sankeyWidth/2,n=t.y1-t.sankeyWidth/2,i=t.y1+t.sankeyWidth/2,o=t.y0+t.sankeyWidth/2,r=t.source.x1,l=t.target.x0,s=tt(r,l),a=s(.5),c=s(.5),`M${e},${r}C${e},${a} ${n},${c} ${n},${l}L${i},${l}C${i},${c} ${o},${a} ${o},${r}Z`;const u=t.sankeyWidth/2,d=tt(t.source.x1,t.target.x0),{pathD:h}=function(t){const{sx:e,sTop:n,sBot:i,tx:o,tTop:r,tBot:l,cp1X:s,cp2X:a}=t,c=(n+i)/2,u=(r+l)/2;return{pathD:[`M${e},${n}`,`C${s},${n} ${a},${r} ${o},${r}`,`L${o},${l}`,`C${a},${l} ${s},${i} ${e},${i}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:c},{x:s,y:c},{x:a,y:u},{x:o,y:u}],halfWidth:(i-n)/2}}}({sx:t.source.x1,sTop:t.y0-u,sBot:t.y0+u,tx:t.target.x0,tTop:t.y1-u,tBot:t.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function sr(t){var e;const n=t.sankeyWidth/2,i=(null!==(e=t._circularWidth)&&void 0!==e?e:t.sankeyWidth)/2,o=t.circularPathData;if(!o)return null;if("down"===t.direction)return null;if(t._circularStub){const e=o.sourceX,i=o.sourceY,r=o.targetX,l=o.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const s=Math.max(15,Math.min(40,.33*(o.rightFullExtent-e))),a=Math.max(15,Math.min(40,.33*(r-o.leftFullExtent)));return`M${e},${i-n}L${e+s},${i-n}L${e+s},${i+n}L${e},${i+n}ZM${r},${l-n}L${r-a},${l-n}L${r-a},${l+n}L${r},${l+n}Z`}const r=o.sourceX,l=o.sourceY,s=o.targetX,a=o.targetY,c=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,f=Math.max(4,Math.min(i,15));return`M${r},${l-h*n}L${c},${l-h*n}L${c+i},${l-h*n+h*f}L${c+i},${d+h*i-h*f}L${c+i-f},${d+h*i}L${u-i+f},${d+h*i}L${u-i},${d+h*i-h*f}L${u-i},${a-h*n+h*f}L${u-i+f},${a-h*n}L${s},${a-h*n}L${s},${a+h*n}L${u+i},${a+h*n}L${u+i},${d-h*i}L${c-i},${d-h*i}L${c-i},${l+h*n}L${r},${l+h*n}Z`}const ar=new Set,cr=new WeakMap;function ur(t,e){if("production"===process.env.NODE_ENV)return t;if(!t||!t.data||"object"!=typeof t.data)return t;let n=cr.get(t);if(n){const t=n.get(e);if(t)return t}else n=new Map,cr.set(t,n);const i=new Proxy(t,{get(t,n,i){if("string"==typeof n&&!(n in t)&&t.data&&n in t.data){const t=`${e}:${n}`;ar.has(t)||(ar.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,n,i)}});return n.set(e,i),i}const dr={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(Io))-1:0},justify:Wo};function hr(t){return"string"==typeof t?t:t.id}const fr={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,i){var o,r,l,s,a,c,u;if(0===t.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",f=null!==(o=n.nodeWidth)&&void 0!==o?o:15,g=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,y=null!==(l=n.iterations)&&void 0!==l?l:100,p=t.map(t=>Object.assign({},t)),v=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id,value:Math.sqrt(Math.max(1,t.value||1))}));let m;m="down"===d?[[0,0],[i[1],i[0]]]:[[0,0],[i[0],i[1]]];const x=rr().extent(m).links(v).nodes(p).nodeAlign(dr[h]||Wo).nodeId(t=>t.id).nodeWidth(f).iterations(y);x.nodePaddingRatio&&x.nodePaddingRatio(g),x();{let t=1/0,e=-1/0,n=1/0,o=-1/0;for(const i of p)t>i.x0&&(t=i.x0),i.x1>e&&(e=i.x1),n>i.y0&&(n=i.y0),i.y1>o&&(o=i.y1);for(const i of v){if(!i.circular||!i.circularPathData)continue;const r=i.circularPathData,l=(null!==(a=null!==(s=i._circularWidth)&&void 0!==s?s:i.width)&&void 0!==a?a:0)/2;t>r.leftFullExtent-l&&(t=r.leftFullExtent-l),r.rightFullExtent+l>e&&(e=r.rightFullExtent+l),n>r.verticalFullExtent-l&&(n=r.verticalFullExtent-l),r.verticalFullExtent+l>o&&(o=r.verticalFullExtent+l)}const r=e-t,l=o-n,u=i[0],d=i[1];if(r>0&&l>0&&(0>t||0>n||e>u||o>d)){const e=Math.min(u/r,d/l),i=-t*e+(u-r*e)/2,o=-n*e+(d-l*e)/2;for(const t of p)t.x0=t.x0*e+i,t.x1=t.x1*e+i,t.y0=t.y0*e+o,t.y1=t.y1*e+o;for(const t of v)if(t.y0=t.y0*e+o,t.y1=t.y1*e+o,t.width=(null!==(c=t.width)&&void 0!==c?c:0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const n=t.circularPathData;n.sourceX=n.sourceX*e+i,n.targetX=n.targetX*e+i,n.sourceY=n.sourceY*e+o,n.targetY=n.targetY*e+o,n.rightFullExtent=n.rightFullExtent*e+i,n.leftFullExtent=n.leftFullExtent*e+i,n.verticalFullExtent=n.verticalFullExtent*e+o,n.rightInnerExtent=n.rightInnerExtent*e+i,n.leftInnerExtent=n.leftInnerExtent*e+i,n.verticalRightInnerExtent=n.verticalRightInnerExtent*e+o,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*e+o,n.rightSmallArcRadius*=e,n.rightLargeArcRadius*=e,n.leftSmallArcRadius*=e,n.leftLargeArcRadius*=e,n.sourceWidth*=e,n.rightNodeBuffer*=e,n.leftNodeBuffer*=e,n.arcRadius*=e}}}const b=new Map;for(const e of t)b.set(e.id,e);for(const t of p){const e=b.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const k=new Map;for(const t of e)k.set(t._edgeKey?t._edgeKey:`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const t of v){const e=hr(t.source),n=hr(t.target),i=k.get(t._edgeKey?t._edgeKey:`${e}\0${n}`);if(i){i.y0=t.y0,i.y1=t.y1,i.sankeyWidth=null!==(u=t.width)&&void 0!==u?u:0,i.circular=!!t.circular,i.circularPathData=t.circularPathData,i._circularWidth=t._circularWidth,i._circularStub=t._circularStub,i.path=t.path,i.circularLinkType=t.circularLinkType,i.direction=d;const o=b.get(e),r=b.get(n);o&&(i.source=o),r&&(i.target=r)}}},buildScene(t,e,n,i){var o,r,l,s,a,c;const u="vertical"===n.orientation?"down":"right",d=n.nodeStyle,h=n.edgeStyle,f=null!==(o=n.edgeOpacity)&&void 0!==o?o:.5,g=n.edgeColorBy||"source",y=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:jt,p=new Map;t.forEach((t,e)=>{p.set(t.id,y[e%y.length])});const v=[],m=[],x=[],b=new Map;for(const e of t){const t=e.x1-e.x0,n=e.y1-e.y0;if(0>=t||0>=n)continue;const i=d?d(ur(e,"nodeStyle")):{},o={fill:i.fill||p.get(e.id)||"#4d430c",stroke:i.stroke,strokeWidth:i.strokeWidth,opacity:i.opacity};b.set(e.id,("string"==typeof o.fill?o.fill:null)||p.get(e.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:e.y0,y:e.x0,w:n,h:t,style:o,datum:e,id:e.id,label:e.id}:{type:"rect",x:e.x0,y:e.y0,w:t,h:n,style:o,datum:e,id:e.id,label:e.id})}const k=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of k){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,i="object"==typeof t.target?t.target:null;if(!e||!i)continue;let o=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999";o="function"==typeof g?g(t)||o:"target"===g?b.get(i.id)||p.get(i.id)||o:b.get(e.id)||p.get(e.id)||o;const u=h?h(ur(t,"edgeStyle")):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,n=t.sankeyWidth/2,i=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),r=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),l=u.fill||o;m.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-n}L${e.sourceX+i},${e.sourceY-n}L${e.sourceX+i},${e.sourceY+n}L${e.sourceX},${e.sourceY+n}Z`,style:{fill:l,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:f,stroke:"none",opacity:u.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+i}}),m.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-n}L${e.targetX-r},${e.targetY-n}L${e.targetX-r},${e.targetY+n}L${e.targetX},${e.targetY+n}Z`,style:{fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:f,stroke:"none",opacity:u.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-r,x1:e.targetX}});continue}let d;if(d=t.circular&&t.circularPathData?sr(t):lr(t),!d)continue;const y={fill:u.fill||o,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:f,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:t.bezier,style:y,datum:t})}if(!1!==n.showLabels){const e=(w=n.nodeLabel)?"function"==typeof w?w:t=>t[w]||t.id:null;for(const n of t){const t=n.x1-n.x0,o=n.y1-n.y0;if(0>=t||0>=o)continue;const r=e?e(n):n.id;if(!r)continue;let l,s,a;"down"===u?(l=n.y0+(n.y1-n.y0)/2,s=n.x1+14,a="start"):(i[0]/2>n.x0+t/2?(l=n.x0-6,a="end"):(l=n.x1+6,a="start"),s=n.y0+o/2),x.push({x:l,y:s,text:r+"",anchor:"down"===u?"middle":a,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:x}}},gr={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,i){var o,r;if(0===t.length)return;const l=null!==(o=n.forceStrength)&&void 0!==o?o:.1,s=i[0]/2,a=i[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const e of t){const t=null!=e.x&&null!=e.y&&(0!==e.x||0!==e.y),n=null==c?void 0:c.get(e.id);t?u++:n?(e.x=n.x,e.y=n.y,u++):d.push(e)}const h=u>0&&.3>=(t.length>0?d.length/t.length:1);if(h){const n=new Map;for(const e of t)n.set(e.id,e);for(const t of d){const i=yr(t.id,e,n);if(i.length>0){let e=0,n=0;for(const t of i)e+=t.x,n+=t.y;const o=pr(t.id),r=o%360*(Math.PI/180),l=10+o%20;t.x=e/i.length+l*Math.cos(r),t.y=n/i.length+l*Math.sin(r)}else{const e=pr(t.id),n=e%360*(Math.PI/180),i=15+e%30;t.x=s+i*Math.cos(n),t.y=a+i*Math.sin(n)}}}else{const e=2.399963229728653;for(let n=0;t.length>n;n++){const i=t[n];if(null==i.x||null==i.y||0===i.x&&0===i.y){const t=10*Math.sqrt(n+.5),o=n*e;i.x=s+t*Math.cos(o),i.y=a+t*Math.sin(o)}}}const f=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(t.length-30)))),g=0===n.iterations?0:h?40:f,y=vr(n.nodeSize,n.nodeSizeRange,t),p=t=>y(t);if(g>0){const n=et().strength(t=>{const e=t.weight;return Math.min(2.5,e?e*l:l)}).id(t=>t.id),i=nt().force("charge",it().strength(t=>-25*p(t))).force("center",ot(s,a).strength(.8)).force("x",rt(s).strength(.15)).force("y",lt(a).strength(.15));if(i.nodes(t),e.length>0){const t=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));n.links(t),i.force("link",n)}h?i.alpha(.3):.1>i.alpha()&&i.alpha(1),i.stop();for(let t=0;g>t;++t)i.tick()}for(const e of t){if(null==e.x||null==e.y)continue;const t=p(e);e.x=Math.max(t,Math.min(i[0]-t,e.x)),e.y=Math.max(t,Math.min(i[1]-t,e.y)),e.x0=0,e.x1=0,e.y0=0,e.y1=0}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){if("string"==typeof t.source){const e=v.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=v.get(t.target);e&&(t.target=e)}}},buildScene(t,e,n,i){var o,r,l,s,a,c,u;const d=n.nodeStyle,h=n.edgeStyle,f=vr(n.nodeSize,n.nodeSizeRange,t),g=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:jt,y=new Map;t.forEach((t,e)=>{y.set(t.id,g[e%g.length])});const p=[],v=[],m=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=f(ur(e,"nodeSize")),i=d?d(ur(e,"nodeStyle")):{},s={fill:i.fill||y.get(e.id)||(null===(o=n.themeSemantic)||void 0===o?void 0:o.primary)||"#007bff",stroke:i.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=i.strokeWidth)&&void 0!==l?l:2,opacity:i.opacity};p.push({type:"circle",cx:e.x,cy:e.y,r:t,style:s,datum:e,id:e.id,label:e.id})}const x=new Map;for(const e of t)x.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:x.get(t.source),i="object"==typeof t.target?t.target:x.get(t.target);if(!e||!i)continue;if(null==e.x||null==e.y)continue;if(null==i.x||null==i.y)continue;const o=h?h(ur(t,"edgeStyle")):{},r={stroke:o.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",strokeWidth:null!==(c=o.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=o.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:e.x,y1:e.y,x2:i.x,y2:i.y,style:r,datum:t})}if(!1!==n.showLabels){const e=(b=n.nodeLabel)?"function"==typeof b?b:t=>t[b]||t.id:null;for(const n of t){if(null==n.x||null==n.y)continue;const t=e?e(n):n.id;if(!t)continue;const i=f(ur(n,"nodeSize"));m.push({x:n.x,y:n.y-i-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var b;return{sceneNodes:p,sceneEdges:v,labels:m}}};function yr(t,e,n){const i=[];for(const o of e){const e="string"==typeof o.source?o.source:o.source.id,r="string"==typeof o.target?o.target:o.target.id;let l=null;if(e===t?l=r:r===t&&(l=e),l){const t=n.get(l);!t||0===t.x&&0===t.y||i.push({x:t.x,y:t.y})}}return i}function pr(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return Math.abs(e)}function vr(t,e,n){var i,o;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const r=e||[5,20],l=n.map(e=>{var n;return null===(n=e.data)||void 0===n?void 0:n[t]}).filter(t=>null!=t&&"number"==typeof t);if(0===l.length)return()=>r[0];const s=null!==(i=R(l))&&void 0!==i?i:0,a=null!==(o=Y(l))&&void 0!==o?o:1;if(s===a)return()=>(r[0]+r[1])/2;const c=b().domain([s,a]).range(r).clamp(!0);return e=>{var n;const i=null===(n=e.data)||void 0===n?void 0:n[t];return null==i||"number"!=typeof i?r[0]:c(i)}}const mr=jt,xr={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,i){if(0===t.length)return;const{padAngle:o=.01,groupWidth:r=20,sortGroups:l}=n,s=Math.min(i[0],i[1])/2,a=s-r,c=i[0]/2,u=i[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:t=>{var e;return null!==(e=t[h])&&void 0!==e?e:1}:t=>{var e;return null!==(e=t.value)&&void 0!==e?e:1};var h;const f=new Map;for(let e=0;t.length>e;e++)f.set(t[e].id,e);const g=t.length,y=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=f.get("string"==typeof t.source?t.source:t.source.id),i=f.get(e);if(void 0===n||void 0===i)continue;const o=d(t);y[n][i]=o}const p=at().padAngle(o);l&&p.sortGroups(l);const v=p(y),m=v.groups,x=I().innerRadius(a).outerRadius(s);for(const e of m){const n=t[e.index],i=x.centroid({innerRadius:a,outerRadius:s,startAngle:e.startAngle,endAngle:e.endAngle});n.x=i[0]+c,n.y=i[1]+u,n.__arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const b=new Map;for(const e of t)b.set(e.id,e);for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=b.get("string"==typeof t.source?t.source:t.source.id),i=b.get(e);n&&(t.source=n),i&&(t.target=i)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const e of v){const n=t[e.source.index].id,i=t[e.target.index].id,o=k.get(`${n}\0${i}`)||k.get(`${i}\0${n}`);o&&(o.__chordData=e)}},buildScene(t,e,n,i){var o,r,l,s;const{groupWidth:a=20,edgeOpacity:c=.5}=n,u=Math.min(i[0],i[1])/2,d=u-a,h=i[0]/2,f=i[1]/2,g=n.nodeStyle,y=n.edgeStyle,p=n.edgeColorBy||"source",v=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:mr,m=new Map;t.forEach((t,e)=>{m.set(t.id,v[e%v.length])});const x=st().radius(d),b=[],k=[],w=[];for(let e=0;t.length>e;e++){const n=t[e],i=n.__arcData;if(!i)continue;let r;r=g?g(ur(n,"nodeStyle")).fill||m.get(n.id)||v[e%v.length]:m.get(n.id)||v[e%v.length];const l=g?g(ur(n,"nodeStyle")):{},s={fill:r,stroke:l.stroke||"black",strokeWidth:null!==(o=l.strokeWidth)&&void 0!==o?o:1,opacity:l.opacity};b.push({type:"arc",cx:h,cy:f,innerR:d,outerR:u,startAngle:i.startAngle-Math.PI/2,endAngle:i.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const t of e){const e=t.__chordData;if(!e)continue;const i=x(e);if(!i)continue;const o=br(i,h,f);let a=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999";if(y)a=y(ur(t,"edgeStyle")).fill||a;else{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;"target"===p&&n?a=m.get(n.id)||a:e&&(a=m.get(e.id)||a)}const u=y?y(ur(t,"edgeStyle")):{},d={fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:o,style:d,datum:t})}if(!1!==n.showLabels){const e=(A=n.nodeLabel)?"function"==typeof A?A:t=>t[A]||t.id:null,i=u+12;for(const n of t){const t=n.__arcData;if(!t)continue;const o=e?e(n):n.id;if(!o)continue;const r=(t.startAngle+t.endAngle)/2,l=r-Math.PI/2;w.push({x:h+Math.cos(l)*i,y:f+Math.sin(l)*i,text:o+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:b,sceneEdges:k,labels:w}}};function br(t,e,n){const i=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!i)return t;const o=[];let r=0;for(;i.length>r;){const t=i[r];if("M"===t||"L"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("C"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)for(let t=0;3>t&&i.length>r&&!isNaN(Number(i[r]));t++)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("Q"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)for(let t=0;2>t&&i.length>r&&!isNaN(Number(i[r]));t++)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("A"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&(o.push(Number(i[r])+e+""),r++),i.length>r&&(o.push(Number(i[r])+n+""),r++);else"Z"===t||"z"===t?(o.push(t),r++):(o.push(i[r]),r++)}return o.join(" ")}const kr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function wr(t){const[e,n,i]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*i>150?"#222":"#fff"}function Ar(t,e,n){const i=e.nodeIDAccessor;return"function"==typeof i?i(t.data)+"":"string"==typeof i&&void 0!==t.data[i]?t.data[i]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+n}function _r(t){return t?"function"==typeof t?t:e=>{var n;return(null===(n=e.data)||void 0===n?void 0:n[t])||e[t]||e.id}:null}function Sr(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:kr}function Mr(t){var e;return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:(null===(e=t.themeSemantic)||void 0===e?void 0:e.primary)?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}function Pr(t,e,n,i,o){if("horizontal"===o){const o=(t+n)/2;return`M ${t},${e} C ${o},${e} ${o},${i} ${n},${i}`}if("radial"===o){const o=(t+n)/2;return`M ${t},${e} Q ${o},${e} ${o},${(e+i)/2} T ${n},${i}`}{const o=(e+i)/2;return`M ${t},${e} C ${t},${o} ${n},${o} ${n},${i}`}}const Cr={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,n,i){var o;const r=n.__hierarchyRoot;if(!r)return;const l=n.chartType,s=function(t){if(t)return"function"==typeof t?t:e=>e[t]}(n.childrenAccessor),a=n.hierarchySum,c="function"==typeof a?a:"string"==typeof a?t=>Number(t[a])||0:t=>Number(t.value)||0,u=G(r,s);u.sum(c),u.sort((t,e)=>{var n,i;return(null!==(n=e.value)&&void 0!==n?n:0)-(null!==(i=t.value)&&void 0!==i?i:0)});const[d,h]=i;switch(l){case"tree":!function(t,e,n,i){const o=e.treeOrientation||"vertical",r=Q();r.size("horizontal"===o?[i,n]:"radial"===o?[2*Math.PI,Math.min(n,i)/2*.8]:[n,i]),r(t)}(u,n,d,h);break;case"cluster":!function(t,e,n,i){const o=e.treeOrientation||"vertical",r=Z();r.size("horizontal"===o?[i,n]:"radial"===o?[2*Math.PI,Math.min(n,i)/2*.8]:[n,i]),r(t)}(u,n,d,h);break;case"treemap":!function(t,e,n,i){var o,r;const l=null!==(o=e.padding)&&void 0!==o?o:4,s=null!==(r=e.paddingTop)&&void 0!==r?r:0,a=U().size([n,i]).tile(K).padding(l);s>0&&a.paddingTop(s),a(t)}(u,n,d,h);break;case"circlepack":!function(t,e,n,i){var o;const r=null!==(o=e.padding)&&void 0!==o?o:4;q().size([n,i]).padding(r)(t)}(u,n,d,h);break;case"partition":!function(t,e,n,i){var o;V().size([n,i]).padding(null!==(o=e.padding)&&void 0!==o?o:1)(t)}(u,n,d,h)}const f=u.descendants();t.length=0,e.length=0;const g=new Map;for(let e=0;f.length>e;e++){const i=f[e],r={id:Ar(i,n,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=i.value)&&void 0!==o?o:0,depth:i.depth,data:i.data,createdByFrame:!0};"tree"===l||"cluster"===l?Tr(r,i,n):"treemap"===l||"partition"===l?Er(r,i):"circlepack"===l&&Or(r,i),r.__hierarchyNode=i,t.push(r),g.set(i,r)}if("tree"===l||"cluster"===l)for(const t of f)if(t.parent){const n=g.get(t.parent),i=g.get(t);n&&i&&e.push({source:n,target:i,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,n,i){const o=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(t,e,n,i,o,r){var l,s,a,c,u,d,h,f;const g=[],y=[],p=[],v=n.treeOrientation||"vertical",m="radial"===v,x=i[0]/2,b=i[1]/2,k="number"==typeof(w=n.nodeSize)?w:5;var w;for(const e of t){let t=e.x,i=e.y;m&&(t+=x,i+=b);const r=o(ur(e,"nodeStyle"));let a=r.fill||Mr(n);if(n.colorByDepth&&void 0!==e.depth){const t=Sr(n);a=t[e.depth%t.length]}const c={fill:a,stroke:r.stroke||(null===(l=n.themeSemantic)||void 0===l?void 0:l.surface)||"#fff",strokeWidth:null!==(s=r.strokeWidth)&&void 0!==s?s:1,opacity:r.opacity};g.push({type:"circle",cx:t,cy:i,r:k,style:c,datum:e,id:e.id,label:e.id,depth:e.depth})}const A=null!==(a=n.edgeOpacity)&&void 0!==a?a:.5;for(const t of e){const e="object"==typeof t.source?t.source:null,i="object"==typeof t.target?t.target:null;if(!e||!i)continue;let o=e.x,l=e.y,s=i.x,a=i.y;m&&(o+=x,l+=b,s+=x,a+=b);const f=Pr(o,l,s,a,v),g=r(ur(t,"edgeStyle")),p={fill:"none",stroke:g.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=n.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=g.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=g.opacity)&&void 0!==h?h:A};y.push({type:"curved",pathD:f,style:p,datum:t})}if(!1!==n.showLabels){const e=_r(n.nodeLabel);for(const n of t){const t=e?e(n):n.id;if(!t)continue;let i,o,r,l=n.x,s=n.y;if(m&&(l+=x,s+=b),m){const t=l-x,e=s-b,n=Math.sqrt(t*t+e*e);n>0?(i=l+t/n*10,o=s+e/n*10,r=0>t?"end":"start"):(i=l,o=s-12,r="middle")}else"horizontal"===v?((null===(f=n.data)||void 0===f?void 0:f.children)&&0!==n.data.children.length?(i=l-k-6,r="end"):(i=l+k+6,r="start"),o=s):(i=l,o=s+k+14,r="middle");p.push({x:i,y:o,text:t+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:y,labels:p}}(t,e,n,i,o,r);case"treemap":case"partition":return function(t,e,n,i){var o,r,l,s,a;const c=[],u=[];for(const n of t){const t=n.x1-n.x0,l=n.y1-n.y0;if(0>=t||0>=l)continue;const s=i(ur(n,"nodeStyle"));let a=s.fill||Mr(e);if(e.colorByDepth&&void 0!==n.depth){const t=Sr(e);a=t[n.depth%t.length]}const u={fill:a,stroke:s.stroke||(null===(o=e.themeSemantic)||void 0===o?void 0:o.surface)||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:t,h:l,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=_r(e.nodeLabel),o=e.labelMode||"leaf",r="partition"===e.chartType;for(const c of t){const t=c.x1-c.x0,d=c.y1-c.y0;if(0>=t||0>=d)continue;const h=!((null===(l=c.data)||void 0===l?void 0:l.children)&&c.data.children.length>0);if(!r){if("leaf"===o&&!h)continue;if("parent"===o&&h)continue}const f=n?n(c):c.id;if(!f)continue;if((h?30:40)>t||(h?16:14)>d)continue;let g=i(ur(c,"nodeStyle")).fill||Mr(e);if(e.colorByDepth&&void 0!==c.depth){const t=Sr(e);g=t[c.depth%t.length]}const y="string"==typeof g?wr(g):null!==(a=null===(s=e.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==a?a:"#000";u.push(h?{x:c.x0+t/2,y:c.y0+d/2,text:f+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,d)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:f+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(t,n,0,o);case"circlepack":return function(t,e,n,i){var o,r,l,s,a,c,u,d,h,f;const g=[],y=[];for(const n of t){const t=null!==(o=n.__radius)&&void 0!==o?o:5;if(0>=t)continue;const a=i(ur(n,"nodeStyle"));let c=a.fill||Mr(e);if(e.colorByDepth&&void 0!==n.depth){const t=Sr(e);c=t[n.depth%t.length]}const u={fill:c,stroke:a.stroke||(null===(r=e.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=a.strokeWidth)&&void 0!==l?l:1,opacity:null!==(s=a.opacity)&&void 0!==s?s:.7};g.push({type:"circle",cx:n.x,cy:n.y,r:t,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=_r(e.nodeLabel);for(const o of t){const t=null!==(a=o.__radius)&&void 0!==a?a:5,r=n?n(o):o.id;if(!r)continue;if(15>t)continue;const l=!((null===(c=o.data)||void 0===c?void 0:c.children)&&o.data.children.length>0);let s=i(ur(o,"nodeStyle")).fill||Mr(e);if(e.colorByDepth&&void 0!==o.depth){const t=Sr(e);s=t[o.depth%t.length]}if(l){const n="string"==typeof s?wr(s):null!==(d=null===(u=e.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";y.push({x:o.x,y:o.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:n})}else y.push({x:o.x,y:o.y-t+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:(null===(h=e.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(f=e.themeSemantic)||void 0===f?void 0:f.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:g,sceneEdges:[],labels:y}}(t,n,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Tr(t,e,n){const i=n.treeOrientation||"vertical";if("radial"===i){const n=e.x,i=e.y;t.x=i*Math.cos(n-Math.PI/2),t.y=i*Math.sin(n-Math.PI/2)}else"horizontal"===i?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function Er(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function Or(t,e){var n;const i=null!==(n=e.r)&&void 0!==n?n:0;t.x=e.x,t.y=e.y,t.x0=e.x-i,t.x1=e.x+i,t.y0=e.y-i,t.y1=e.y+i,t.width=2*i,t.height=2*i,t.__radius=i}function Dr(t){let e=t.__orbitState;return e||(e={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},t.__orbitState=e),e}const Lr={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,n,i){const o=n.__hierarchyRoot;o&&function(t,e,n,i,o){var r,l;const s=function(t){if("function"==typeof t)return t;const e=t||"children";return t=>t[e]||null}(n.childrenAccessor),a=function(t){if("function"==typeof t)return t;const e=t||"name";return t=>{var n;return(null!==(n=t[e])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,d=null!==(l=n.orbitEccentricity)&&void 0!==l?l:1,h="number"==typeof u?()=>u:u,f="number"==typeof d?()=>d:d,g=Dr(n);g.metaMap.clear(),i.length=0,o.length=0;const y=new Map;function p(t){var e;const n=null!==(e=y.get(t))&&void 0!==e?e:0;return y.set(t,n+1),0===n?t:`${t}__${n}`}const v=e[0]/2,m=e[1]/2,x=Math.min(e[0],e[1])/2*.85,b=p(a(t));i.push({id:b,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:t}),g.metaMap.set(b,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,n,r,l,u,d,y){const v=s(e);if(!(null==v?void 0:v.length))return;const m=v.length;let x=0,b=0,k=0;for(;m>b;)b+=c[Math.min(k,c.length-1)],k++,x++;let w=0;for(let m=0;x>m;m++){const b=c[Math.min(m,c.length-1)],k=v.slice(w,w+b);if(!k.length)break;const A=(m+1)/x,_={id:n,depth:d,data:e,parentId:n},S=y?u/h(_)*A:u*A,M=W().value(t=>{var e;return(null===(e=s(t))||void 0===e?void 0:e.length)?4:1}).sort(null),P=M(k),C=f(_);for(let e=0;k.length>e;e++){const s=(P[e].startAngle+P[e].endAngle)/2,c=k[e],u=p(a(c)),h=r+S*Math.sin(s),f=l+S*Math.cos(s)*C;i.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:d,data:c}),g.metaMap.set(u,{ring:S,angle:s,depth:d,parentId:n,eccentricity:C}),o.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),t(c,u,h,f,S,d+1,!0)}w+=b}}(t,b,v,m,x,1,!1)}(o,i,n,t,e)},buildScene(t,e,n,i){var o,r,l,s,a,c,u;const d=n.nodeStyle,h=n.nodeSize,f="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,g=[],y=[],p=[];if(!1!==n.orbitShowRings){const e=Dr(n),i=new Map;for(const e of t)i.set(e.id,e);const o=new Map;for(const[,t]of e.metaMap){if(!t.parentId)continue;const e=i.get(t.parentId);if(!e)continue;const n=`${t.parentId}:${t.ring}`;o.has(n)||o.set(n,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}const r=48,l={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:t,parentY:e,ring:n,ecc:i}]of o)for(let o=0;r>o;o++){const s=o/r*Math.PI*2,a=(o+1)/r*Math.PI*2;y.push({type:"line",x1:t+n*Math.sin(s),y1:e+n*Math.cos(s)*i,x2:t+n*Math.sin(a),y2:e+n*Math.cos(a)*i,style:l,datum:null})}}for(const e of t){if(null==e.x||null==e.y)continue;const t=f(ur(e,"nodeSize")),i=d?d(ur(e,"nodeStyle")):{},c={fill:i.fill||(null===(o=n.themeSemantic)||void 0===o?void 0:o.primary)||"#6366f1",stroke:i.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=i.strokeWidth)&&void 0!==l?l:1,opacity:null!==(s=i.opacity)&&void 0!==s?s:0===(null!==(a=e.depth)&&void 0!==a?a:0)?1:.85};g.push({type:"circle",cx:e.x,cy:e.y,r:t,style:c,datum:e,id:e.id,label:e.id,depth:e.depth})}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:v.get(t.source),n="object"==typeof t.target?t.target:v.get(t.target);e&&n&&(null!=e.x&&null!=n.x&&y.push({type:"line",x1:e.x,y1:e.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:t}))}if(n.showLabels){const e=n.nodeLabel;for(const n of t){const t=f(ur(n,"nodeSize"));if(4>=t)continue;const i="function"==typeof e?e(n):e&&null!==(u=null===(c=n.data)||void 0===c?void 0:c[e])&&void 0!==u?u:n.id;p.push({x:n.x,y:n.y+t+12,text:i+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:g,sceneEdges:y,labels:p}},tick:(t,e,n,i,o)=>!1!==n.orbitAnimated&&(function(t,e){var n,i;const o=Dr(e),r=null!==(n=e.orbitSpeed)&&void 0!==n?n:.25,l=null!==(i=e.orbitRevolution)&&void 0!==i?i:function(t){switch(t){case"decay":return t=>{var e;return Math.pow(.6,null!==(e=t.depth)&&void 0!==e?e:0)};case"alternate":return t=>{var e;const n=null!==(e=t.depth)&&void 0!==e?e:0;return(n%2==0?1:-1)/(n+1)};default:return t=>{var e;return 1/((null!==(e=t.depth)&&void 0!==e?e:0)+1)}}}(e.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,a=r*(Math.PI/6),c=new Map;for(const e of t)c.set(e.id,e);for(const e of t){const t=o.metaMap.get(e.id);if(!t||!t.parentId)continue;const n=c.get(t.parentId);if(!n)continue;const i=t.angle+s*a*l({id:e.id,depth:t.depth,data:e.data,parentId:t.parentId});e.x=n.x+t.ring*Math.sin(i),e.y=n.y+t.ring*Math.cos(i)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,n),!0)},Nr={sankey:fr,force:gr,chord:xr,tree:Cr,cluster:Cr,treemap:Cr,circlepack:Cr,partition:Cr,orbit:Lr};function $r(t){return Nr[t]}function Ir(t){return 0===t.length?()=>"#4e79a7":e=>{var n;let i=0;for(let t=0;e.length>t;t++)i=31*i+e.charCodeAt(t)|0;return null!==(n=t[Math.abs(i)%t.length])&&void 0!==n?n:"#4e79a7"}}class Wr{constructor(t){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=t,this.tensionConfig=Object.assign(Object.assign({},po),t.tensionConfig),t.showParticles&&("sankey"===t.chartType||t.customNetworkLayout)&&(this.particlePool=new mo(2e3))}updateConfig(t){const e=this.config;e.__orbitState&&(t.__orbitState=e.__orbitState),e.__hierarchyRoot&&(t.__hierarchyRoot=e.__hierarchyRoot),this.config=t,this.tensionConfig=Object.assign(Object.assign({},po),t.tensionConfig),!t.showParticles||"sankey"!==t.chartType&&!t.customNetworkLayout||this.particlePool||(this.particlePool=new mo(2e3))}ingestHierarchy(t,e){this._boundedPrevSnapshot=new Map;for(const[t,e]of this.nodes)0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1||this._boundedPrevSnapshot.set(t,{x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=t,this.runLayout(e),this._boundedPrevSnapshot=null}ingestBounded(t,e,n){const{nodeIDAccessor:i="id",sourceAccessor:o="source",targetAccessor:r="target",valueAccessor:l="value"}=this.config,s="function"==typeof i?i:t=>t[i],a="function"==typeof o?o:t=>t[o],c="function"==typeof r?r:t=>t[r],u="function"==typeof l?l:t=>{var e;return null!==(e=t[l])&&void 0!==e?e:1};this._boundedPrevSnapshot=new Map;for(const[t,e]of this.nodes)0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1||this._boundedPrevSnapshot.set(t,{x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1});this._boundedEdgeSnapshot=new Map;for(const[,t]of this.edges)t.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,{y0:t.y0,y1:t.y1,sankeyWidth:t.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of t){const t=s(e)+"";this.nodes.set(t,Object.assign(Object.assign({},zr(t)),{data:e}))}for(let t=0;e.length>t;t++){const n=e[t],i=a(n)+"",o=c(n)+"",r=u(n),l=null==r?NaN:Number(r),s=Number.isFinite(l)?l:1;this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},zr(i)),{data:n})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},zr(o)),{data:n}));const d=`${i}\0${o}\0${t}`,h={source:i,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&Rr(n.bezier)&&(h.bezier=n.bezier),this.edges.set(d,h)}this.runLayout(n)}edgeKey(t,e){return`${t}\0${e}`}ingestEdge(t){const{source:e,target:n,value:i}=t,o=0===this.nodes.size;let r=!1;const l="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=l,this._decaySortedNodes=null,this.nodes.has(e)||(this.nodes.set(e,zr(e)),this.nodeTimestamps.set(e,l),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,zr(n)),this.nodeTimestamps.set(n,l),this.tension+=this.tensionConfig.newNode,r=!0);const s=this.edgeKey(e,n),a=this.edges.get(s);let c=!1;return a?(a.value+=i,this.edgeTimestamps.set(s,l),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:e,target:n,value:i,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,l),this.tension+=this.tensionConfig.newEdge,r=!0),o||r||c||this.tension>=this.tensionConfig.threshold}runLayout(t){var e,n,i,o,r,l,s,a;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=$r(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const t=new Map;for(const s of u)if(void 0!==s._prevX0){const a=(null!==(e=s._prevX1)&&void 0!==e?e:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(i=s._prevY1)&&void 0!==i?i:0)-(null!==(o=s._prevY0)&&void 0!==o?o:0);t.set(s.id,{x:(null!==(r=s._prevX0)&&void 0!==r?r:0)+a/2,y:(null!==(l=s._prevY0)&&void 0!==l?l:0)+c/2})}else 0===s.x&&0===s.y||t.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[e,n]of this._lastPositionSnapshot)t.has(e)||t.set(e,n);this.config.__previousPositions=t.size>0?t:void 0}if(c.computeLayout(u,d,this.config,t),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of u)this.nodes.set(t.id,t);for(let t=0;d.length>t;t++){const e=d[t],n=e._edgeKey||`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}\0${t}`;e._edgeKey=n,this.edges.set(n,e)}const t=this._boundedPrevSnapshot;if(t&&t.size>0)for(const e of this.nodes.values()){const n=t.get(e.id);n&&(e._prevX0=n.x0,e._prevX1=n.x1,e._prevY0=n.y0,e._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const t of this.nodes.values())0===t.x&&0===t.y||h.set(t.id,{x:t.x,y:t.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const f=u.some(t=>void 0!==t._prevX0&&(0!==t._prevX0||0!==t._prevX1||0!==t._prevY0||0!==t._prevY1)),g=null!==(a=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==a?a:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&g>0){const e=t[0]/2,n=t[1]/2;for(const t of this.nodes.values())t._prevX0=e,t._prevX1=e,t._prevY0=n,t._prevY1=n;for(const t of this.edges.values())t._prevY0=n,t._prevY1=n,t._prevSankeyWidth=0,t._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g}}else f&&g>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const t=new Set(this.nodes.keys()),e=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 t)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)t.has(e)||this.removedNodes.add(e);for(const t of e)this.previousEdgeKeys.has(t)||this.addedEdges.add(t);for(const t of this.previousEdgeKeys)e.has(t)||this.removedEdges.add(t);(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=t,this.previousEdgeKeys=e}buildScene(t){var e,n,i,o,r,l;const s=Array.from(this.nodes.values()),a=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=function(t,e,n){if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=ee[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}(this.config.colorScheme,this.config.themeCategorical,jt),u={nodes:s,edges:a,dimensions:{width:t[0],height:t[1],plot:{x:0,y:0,width:t[0],height:t[1]}},theme:{semantic:null!==(e=this.config.themeSemantic)&&void 0!==e?e:{},categorical:[...c]},resolveColor:Ir(c),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{}};let d;try{d=this.config.customNetworkLayout(u)}catch(t){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(i=d.sceneNodes)&&void 0!==i?i:[],this.sceneEdges=null!==(o=d.sceneEdges)&&void 0!==o?o:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(l=d.overlays)&&void 0!==l?l:null)}this.customLayoutOverlays=null;const c=$r(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(s,a,this.config,t);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const t=$r(this.config.chartType);return!!(null==t?void 0:t.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(t,e){const n=$r(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const i=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return n.tick(i,o,this.config,t,e)}cancelIntroAnimation(){this.transition=null;for(const t of this.nodes.values())t._prevX0=void 0,t._prevX1=void 0,t._prevY0=void 0,t._prevY1=void 0;for(const t of this.edges.values())t._prevY0=void 0,t._prevY1=void 0,t._prevSankeyWidth=void 0,t._introFromZero=!1}advanceTransition(t){if(!this.transition)return!1;const e=se(t,this.transition),n=le(e);for(const t of this.nodes.values())void 0===t._targetX0||void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=ae(t._prevX0,t._targetX0,n),t.x1=ae(t._prevX1,t._targetX1,n),t.y0=ae(t._prevY0,t._targetY0,n),t.y1=ae(t._prevY1,t._targetY1,n));for(const t of this.edges.values())void 0!==t._targetY0&&void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&(t._prevSankeyWidth>0||t._introFromZero)&&(t.y0=ae(t._prevY0,t._targetY0,n),t.y1=ae(t._prevY1,t._targetY1,n),t.sankeyWidth=ae(t._prevSankeyWidth,t._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>e||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const t=this._boundedPrevSnapshot;for(const e of this.nodes.values()){const n=null==t?void 0:t.get(e.id);n&&0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1?(e._prevX0=n.x0,e._prevX1=n.x1,e._prevY0=n.y0,e._prevY1=n.y1):(e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1)}const e=this._boundedEdgeSnapshot;for(const t of this.edges.values()){if(e&&0===t.sankeyWidth){const n=e.get(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`);if(n){t._prevY0=n.y0,t._prevY1=n.y1,t._prevSankeyWidth=n.sankeyWidth;continue}}t._prevY0=t.y0,t._prevY1=t.y1,t._prevSankeyWidth=t.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const t="vertical"===this.config.orientation?"down":"right";for(const t of this.nodes.values())if(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;else{const e=5;t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}for(const e of this.edges.values())e.direction=t,this.updateEdgeBezier(e);this.tension=0}saveTargetPositions(){for(const t of this.nodes.values())t._targetX0=t.x0,t._targetX1=t.x1,t._targetY0=t.y0,t._targetY1=t.y1;for(const t of this.edges.values())t._targetY0=t.y0,t._targetY1=t.y1,t._targetSankeyWidth=t.sankeyWidth}restorePreviousPositions(){for(const t of this.nodes.values())void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0,t.x1=t._prevX1,t.y0=t._prevY0,t.y1=t._prevY1);for(const t of this.edges.values())void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0,t.y1=t._prevY1,t.sankeyWidth=t._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const t of this.nodes.values())void 0!==t._targetX0&&(t.x0=t._targetX0,t.x1=t._targetX1,t.y0=t._targetY0,t.y1=t._targetY1);for(const t of this.edges.values())void 0!==t._targetY0&&(t.y0=t._targetY0,t.y1=t._targetY1,t.sankeyWidth=t._targetSankeyWidth),t._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(t){const e="string"==typeof t.source?this.nodes.get(t.source):t.source,n="string"==typeof t.target?this.nodes.get(t.target):t.target;e&&n&&(t.bezier=t.circular&&t.circularPathData?this.buildCircularBezier(t):this.buildStandardBezier(t,e,n))}buildStandardBezier(t,e,n){const i=(t.sankeyWidth||1)/2;if("down"===t.direction){const o=e.x1,r=n.x0,l=tt(o,r);return{circular:!1,points:[{x:t.y0,y:o},{x:t.y0,y:l(.5)},{x:t.y1,y:l(.5)},{x:t.y1,y:r}],halfWidth:i}}const o=e.x1,r=n.x0,l=tt(o,r);return{circular:!1,points:[{x:o,y:t.y0},{x:l(.5),y:t.y0},{x:l(.5),y:t.y1},{x:r,y:t.y1}],halfWidth:i}}buildCircularBezier(t){const e=(t._circularWidth||t.sankeyWidth||1)/2,n=t.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(t._circularStub){const t=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),i=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*t,y:n.sourceY},{x:n.sourceX+.66*t,y:n.sourceY},{x:n.sourceX+t,y:n.sourceY}],[{x:n.targetX-i,y:n.targetY},{x:n.targetX-.66*i,y:n.targetY},{x:n.targetX-.33*i,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:e}}let i;i="down"===t.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 o=[];for(let t=0;i.length-1>t;t++){const e=i[t],n=i[t+1],r=n.x-e.x,l=n.y-e.y;o.push([e,{x:e.x+r/3,y:e.y+l/3},{x:e.x+2*r/3,y:e.y+2*l/3},n])}return{circular:!0,segments:o,halfWidth:e}}rebuildAllBeziers(){for(const t of this.nodes.values())t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;for(const t of this.edges.values())this.updateEdgeBezier(t)}applyPulse(t){var e,n,i,o,r;const l=this.config.pulse;if(!l)return;const s=null!==(e=l.duration)&&void 0!==e?e:500,a=null!==(n=l.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(i=l.glowRadius)&&void 0!==i?i:4;for(const e of this.sceneNodes){const n=e.id;if(!n)continue;const i=this.nodeTimestamps.get(n);if(!i)continue;const o=t-i;s>o&&(e._pulseIntensity=1-o/s,e._pulseColor=a,e._pulseGlowRadius=c)}for(const e of this.sceneEdges){const n=e.datum;if(!n)continue;const i="object"==typeof n.source?null===(o=n.source)||void 0===o?void 0:o.id:n.source,l="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!i||!l)continue;const c=this.edgeTimestamps.get(`${i}\0${l}`);if(!c)continue;const u=t-c;s>u&&(e._pulseIntensity=1-u/s,e._pulseColor=a)}}applyDecay(){var t,e;const n=this.config.decay;if(!n)return;const i=this.nodeTimestamps.size;if(1>=i)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((t,e)=>t[1]-e[1]));const o=this._decaySortedNodes,r=new Map;for(let t=0;o.length>t;t++)r.set(o[t][0],t);for(const o of this.sceneNodes){const l=o.id;if(!l)continue;const s=r.get(l);if(void 0===s)continue;const a=oe(n,s,i),c=null!==(e=null===(t=o.style)||void 0===t?void 0:t.opacity)&&void 0!==e?e:1;o.style=Object.assign(Object.assign({},o.style),{opacity:c*a})}}applyTopologyDiff(t){var e;if(0===this.addedNodes.size)return;const n=t-this.lastTopologyChangeTime;if(n>=2e3)return;const i=1-n/2e3;for(const t of this.sceneNodes){const n=t.id;n&&this.addedNodes.has(n)&&(t._pulseIntensity=Math.max(null!==(e=t._pulseIntensity)&&void 0!==e?e:0,i),t._pulseColor="rgba(34, 197, 94, 0.7)",t._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(t){var e,n;const i=this.config.thresholds;if(!i)return;const o=null!==(e=i.warningColor)&&void 0!==e?e:"#f59e0b",r=null!==(n=i.criticalColor)&&void 0!==n?n:"#ef4444",l=!1!==i.pulse;for(const e of this.sceneNodes){const n=e.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const a=i.metric(s);let c=null;void 0===i.critical||i.critical>a?void 0===i.warning||i.warning>a||(c=o):c=r,c&&(e.style=Object.assign(Object.assign({},e.style),{fill:c}),l&&(e._pulseIntensity=.6+.4*Math.sin(t/300),e._pulseColor=c,e._pulseGlowRadius=6))}}get hasActiveThresholds(){const t=this.config.thresholds;if(!t)return!1;for(const e of this.nodes.values()){const n=t.metric(e);if(void 0!==t.warning&&n>=t.warning||void 0!==t.critical&&n>=t.critical)return!0}return!1}get hasActivePulses(){var t;const e=this.config.pulse;if(!e||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(t=e.duration)&&void 0!==t?t:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(t,e){var n;const i=this.nodes.get(t);if(!i)return null;const o=i.data?Object.assign({},i.data):{};return i.data=e(null!==(n=i.data)&&void 0!==n?n:{}),this.layoutVersion++,o}updateEdge(t,e,n){var i;const o=this.config.valueAccessor,r="function"==typeof o?o:o?t=>t[o]:t=>t.value,l=[];for(const[,o]of this.edges)if(("string"==typeof o.source?o.source:o.source.id)===t&&("string"==typeof o.target?o.target:o.target.id)===e){l.push(o.data?Object.assign({},o.data):{}),o.data=n(null!==(i=o.data)&&void 0!==i?i:{});const t=r(o.data);null!=t&&(o.value=Number(t))}return l.length>0&&this.layoutVersion++,l}removeNode(t){if(!this.nodes.has(t))return!1;this.nodes.delete(t),this.nodeTimestamps.delete(t);for(const[e,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==t&&("string"==typeof n.target?n.target:n.target.id)!==t||(this.edges.delete(e),this.edgeTimestamps.delete(e));return this.layoutVersion++,!0}removeEdge(t,e){const n=[];if(void 0===e){const e=this.config.edgeIdAccessor;if(!e)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const i="function"==typeof e?e:t=>null==t?void 0:t[e];for(const[e,o]of this.edges)o.data&&i(o.data)===t&&n.push(e)}else for(const[i,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===t&&("string"==typeof o.target?o.target:o.target.id)===e&&n.push(i);for(const t of n)this.edges.delete(t),this.edgeTimestamps.delete(t);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function zr(t){return{id:t,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Rr(t){if(!t||"object"!=typeof t)return!1;const e=t;if("boolean"!=typeof e.circular)return!1;if("number"!=typeof e.halfWidth||!Number.isFinite(e.halfWidth))return!1;if(e.circular){if(!Array.isArray(e.segments)||0===e.segments.length)return!1;for(const t of e.segments)if(!Fr(t))return!1;return!0}return Fr(e.points)}function Fr(t){if(!Array.isArray(t)||4!==t.length)return!1;for(const e of t){if(!e||"object"!=typeof e)return!1;const t=e;if("number"!=typeof t.x||!Number.isFinite(t.x))return!1;if("number"!=typeof t.y||!Number.isFinite(t.y))return!1}return!0}function Yr(t,e,n,i,o=30){let r=null,l=o,s=1/0;for(const e of t){const t=jr(e,n,i,o);if(t)if("rect"===e.type){const n=e.w*e.h;s>n&&(r=t,s=n)}else l>t.distance&&(r=t,l=t.distance)}if(r)return r;for(const t of e){if(!1===t.interactive)continue;const e=Vr(t,n,i);e&&l>e.distance&&(r=e,l=e.distance)}return r}function jr(t,e,n,i=30){switch(t.type){case"circle":return function(t,e,n,i=30){const o=e-t.cx,r=n-t.cy,l=Math.sqrt(o*o+r*r);return l>Me(t.r,i)?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:l}}(t,e,n,i);case"rect":return function(t,e,n){const i=Se(e,n,t);return i.hit?{type:"node",datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}(t,e,n);case"arc":return function(t,e,n){const i=e-t.cx,o=n-t.cy,r=Math.sqrt(i*i+o*o);if(t.innerR-2>r||r>t.outerR+2)return null;const l=Te(Math.atan2(o,i)),s=Te(t.startAngle),a=Te(t.endAngle);if(s>a?l>=s||a>=l:l>=s&&a>=l){const e=(t.startAngle+t.endAngle)/2,n=(t.innerR+t.outerR)/2;return{type:"node",datum:t.datum,x:t.cx+n*Math.cos(e),y:t.cy+n*Math.sin(e),distance:0}}return null}(t,e,n);default:return null}}let Br=null,Hr=null;function Xr(){return Hr||(Br=document.createElement("canvas"),Br.width=1,Br.height=1,Hr=Br.getContext("2d")),Hr}function Gr(t){if(t._cachedPath2D&&t._cachedPath2DSource===t.pathD)return t._cachedPath2D;try{return t._cachedPath2D=new Path2D(t.pathD),t._cachedPath2DSource=t.pathD,t._cachedPath2D}catch(t){return null}}function Vr(t,e,n){switch(t.type){case"bezier":return function(t,e,n){if(!t.pathD)return null;const i=Gr(t),o=Xr();if(!i||!o)return null;try{if(o.isPointInPath(i,e,n))return{type:"edge",datum:t.datum,x:e,y:n,distance:0};const r=o.lineWidth;o.lineWidth=10;const l=o.isPointInStroke(i,e,n);if(o.lineWidth=r,l)return{type:"edge",datum:t.datum,x:e,y:n,distance:4}}catch(t){}return null}(t,e,n);case"line":return function(t,e,n){const i=t.x2-t.x1,o=t.y2-t.y1,r=i*i+o*o;if(0===r)return null;let l=((e-t.x1)*i+(n-t.y1)*o)/r;l=Math.max(0,Math.min(1,l));const s=t.x1+l*i,a=t.y1+l*o,c=Math.sqrt(Math.pow(e-s,2)+Math.pow(n-a,2));return c>5?null:{type:"edge",datum:t.datum,x:s,y:a,distance:c}}(t,e,n);case"ribbon":case"curved":return function(t,e,n){if(!t.pathD)return null;const i=Gr(t),o=Xr();if(!i||!o)return null;try{if(o.isPointInPath(i,e,n))return{type:"edge",datum:t.datum,x:e,y:n,distance:0};const r=o.lineWidth;o.lineWidth=10;const l=o.isPointInStroke(i,e,n);if(o.lineWidth=r,l)return{type:"edge",datum:t.datum,x:e,y:n,distance:4}}catch(t){}return null}(t,e,n);default:return null}}function qr(o){const{width:r,height:l,totalWidth:s,totalHeight:a,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p,legendPosition:v="right",foregroundGraphics:m,sceneNodes:x,annotations:b,svgAnnotationRules:k}=o;return e(n,{children:[e("svg",{role:"img",width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[t("title",{children:"string"==typeof d?d:"Network Chart"}),t("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),e("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((e,n)=>t("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"currentColor",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+n)),b&&b.filter(t=>"widget"!==t.type).map((e,n)=>{if(k){const o=k(e,n,{width:r,height:l,sceneNodes:x});if(o)return t(i.Fragment,{children:o},"annotation-"+n)}return null}),m]}),d&&"string"==typeof d?t("text",{x:s/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:d}):d?t("foreignObject",{x:0,y:0,width:s,height:c.top,children:d}):null,vn({legend:h,totalWidth:s,totalHeight:a,margin:c,legendPosition:v,title:d,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p})]}),null==b?void 0:b.filter(t=>"widget"===t.type&&t.nodeId&&x).map((e,n)=>{var i,o,r,l,s,a,u,d,h;const f=x.find(t=>{var n,i,o,r,l;return t.id===e.nodeId||(null===(n=t.datum)||void 0===n?void 0:n.id)===e.nodeId||(null===(o=null===(i=t.datum)||void 0===i?void 0:i.data)||void 0===o?void 0:o.id)===e.nodeId||(null===(l=null===(r=t.datum)||void 0===r?void 0:r.data)||void 0===l?void 0:l.name)===e.nodeId});if(!f)return null;const g=c.left+(null!==(i=f.cx)&&void 0!==i?i:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(o=f.x)&&void 0!==o?o:0),y=c.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(l=f.y)&&void 0!==l?l:0),p=null!==(s=e.dx)&&void 0!==s?s:0,v=null!==(a=e.dy)&&void 0!==a?a:-16,m=null!==(u=e.width)&&void 0!==u?u:32,b=null!==(d=e.height)&&void 0!==d?d:32,k=null!==(h=e.content)&&void 0!==h?h:t("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return t("div",{style:{position:"absolute",left:g+p-m/2,top:y+v-b/2,width:m,height:b,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+n)})]})}function Ur(t){return t._cachedPath2D&&t._cachedPath2DSource===t.pathD||(t._cachedPath2D=new Path2D(t.pathD),t._cachedPath2DSource=t.pathD),t._cachedPath2D}function Kr(t,e){var n,i,o,r,l,s;if(!e.pathD)return;t.save();const a=Ur(e);if(e.style.fill&&"none"!==e.style.fill){const l=e._gradient;if(l){const o=t.createLinearGradient(l.x0,0,l.x1,0),r=null!==(i=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==i?i:.5,s="string"==typeof e.style.fill?e.style.fill:"#999",a=We(t,s)||s;o.addColorStop(0,1===l.from?a:"transparent"),o.addColorStop(1,1===l.to?a:"transparent"),t.fillStyle=o,t.globalAlpha=r}else t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(r=null!==(o=e.style.fillOpacity)&&void 0!==o?o:e.style.opacity)&&void 0!==r?r:.5;t.fill(a)}e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(l=e.style.strokeWidth)&&void 0!==l?l:.5,t.globalAlpha=.5*(null!==(s=e.style.opacity)&&void 0!==s?s:1),t.stroke(a)),e._pulseIntensity&&e._pulseIntensity>0&&(t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.globalAlpha=.2*e._pulseIntensity,t.fill(a)),t.restore()}function Zr(t,e){var n,i;t.save();const o=e.style.stroke||"#999";t.strokeStyle=We(t,o)||o,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.strokeDasharray&&t.setLineDash(e.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke(),e._pulseIntensity&&e._pulseIntensity>0&&(t.setLineDash([]),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=(null!==(i=e.style.strokeWidth)&&void 0!==i?i:1)+3*e._pulseIntensity,t.globalAlpha=.4*e._pulseIntensity,t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),t.restore()}function Qr(t,e){var n,i,o,r;if(!e.pathD)return;t.save();const l=Ur(e);e.style.fill&&"none"!==e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(i=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==i?i:.5,t.fill(l)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:.5,t.globalAlpha=.3*(null!==(r=e.style.opacity)&&void 0!==r?r:1),t.stroke(l)),e._pulseIntensity&&e._pulseIntensity>0&&(t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.globalAlpha=.25*e._pulseIntensity,t.fill(l)),t.restore()}function Jr(t,e){var n,i;if(!e.pathD)return;t.save();const o=Ur(e),r=e.style.stroke||"#999";t.strokeStyle=We(t,r)||r,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.stroke(o),e.style.fill&&"none"!==e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(i=e.style.fillOpacity)&&void 0!==i?i:.1,t.fill(o)),t.restore()}qr.displayName="NetworkSVGOverlay";const tl={top:20,right:80,bottom:20,left:80},el={top:40,right:40,bottom:40,left:40},nl=new Set(["chord","force","circlepack","orbit"]),il=[800,600],ol={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 rl({data:n}){var i,o,r,l,s,a;if("edge"===n.nodeOrEdge){const t=n.data;return t?e("div",{className:"semiotic-tooltip",style:ol,children:[e("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&e("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const c=n.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const n=[];let s=u;for(;s;){const t=null!==(l=null!==(o=null===(i=s.data)||void 0===i?void 0:i.name)&&void 0!==o?o:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==l?l:c.id;null!=t&&n.unshift(t+""),s=s.parent}n.length>1&&n.shift();const a=n.length-1;return e("div",{className:"semiotic-tooltip",style:ol,children:[t("div",{children:n.map((n,i)=>e("span",{children:[i>0&&t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),i===a?t("strong",{children:n}):t("span",{style:{opacity:.7},children:n})]},i))}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(s=c.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=c.targetLinks)||void 0===a?void 0:a.length)||0),h=(c.sourceLinks||[]).reduce((t,e)=>t+(e.value||0),0)+(c.targetLinks||[]).reduce((t,e)=>t+(e.value||0),0);return e("div",{className:"semiotic-tooltip",style:ol,children:[t("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&e("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}rl.ownsChrome=!0;const ll=f(function(n,i){var s,c,u,h,f,g,p,v,m,x,b,k,w,A,_,S,M,P;const{chartType:C,nodes:T,edges:E,data:O,initialEdges:D,nodeIDAccessor:L="id",sourceAccessor:N="source",targetAccessor:$="target",valueAccessor:W="value",edgeIdAccessor:z,childrenAccessor:R,hierarchySum:F,orientation:Y="horizontal",nodeAlign:j="justify",nodePaddingRatio:B=.05,nodeWidth:H=15,iterations:X=300,forceStrength:G=.1,padAngle:V=.01,groupWidth:q=20,sortGroups:U,edgeSort:K,treeOrientation:Z="vertical",edgeType:Q="curve",padding:J,paddingTop:tt,tensionConfig:et,showParticles:nt=!1,particleStyle:it,nodeStyle:ot,edgeStyle:rt,colorBy:lt,colorScheme:st="category10",edgeColorBy:at="source",edgeOpacity:ct=.5,colorByDepth:ut=!1,nodeSize:dt=8,nodeSizeRange:ht=[5,20],nodeLabel:gt,showLabels:yt=!0,labelMode:pt,size:mt=il,responsiveWidth:xt,responsiveHeight:bt,margin:kt,className:wt,background:At,enableHover:_t=!0,tooltipContent:St,customHoverBehavior:Mt,customClickBehavior:Pt,onObservation:Ct,chartId:Tt,onTopologyChange:Et,annotations:Ot,svgAnnotationRules:Dt,legend:Lt,legendPosition:Nt,legendHoverBehavior:$t,legendClickBehavior:It,legendHighlightedCategory:Wt,legendIsolatedCategories:zt,title:Rt,foregroundGraphics:Ft,backgroundGraphics:Yt,decay:jt,pulse:Bt,transition:Ht,animate:Xt,staleness:Gt,thresholds:Vt,accessibleTable:qt=!0,description:Ut,summary:Kt,orbitMode:Zt,orbitSize:Qt,orbitSpeed:Jt,orbitRevolution:te,orbitRevolutionStyle:ee,orbitEccentricity:ie,orbitShowRings:oe,orbitAnimated:re,customNetworkLayout:le,layoutConfig:se}=n,ae=nl.has(C)?el:tl,ce=o(!0),ue=Wi({sizeProp:mt,responsiveWidth:xt,responsiveHeight:bt,userMargin:kt,marginDefault:ae,foregroundGraphics:Ft,backgroundGraphics:Yt,animate:Xt,transitionProp:Ht,themeDirtyRef:ce}),{reducedMotionRef:de,responsiveRef:he,size:fe,margin:ge,adjustedWidth:ye,adjustedHeight:pe,resolvedForeground:ve,resolvedBackground:me,transition:xe,introEnabled:be,tableId:ke,rafRef:we,renderFnRef:Ae,scheduleRender:Se,currentTheme:Me}=ue,Pe=ii(),Ce=si(),Te=r(()=>ft(T),[T]),Ee=r(()=>Array.isArray(E)?ft(E):E,[E]),Oe=r(()=>Object.assign(Object.assign({},po),et),[et]),De=r(()=>Object.assign(Object.assign({},vo),it),[it]),Le=r(()=>{var t;return{chartType:C,nodeIDAccessor:L,sourceAccessor:N,targetAccessor:$,valueAccessor:W,edgeIdAccessor:z,childrenAccessor:R,hierarchySum:F,orientation:Y,nodeAlign:j,nodePaddingRatio:B,nodeWidth:H,iterations:X,forceStrength:G,padAngle:V,groupWidth:q,sortGroups:U,edgeSort:K,treeOrientation:Z,edgeType:Q,padding:J,paddingTop:tt,tensionConfig:Oe,showParticles:nt,particleStyle:De,nodeStyle:ot,edgeStyle:rt,nodeLabel:gt,showLabels:yt,labelMode:pt,colorBy:lt,colorScheme:st,themeCategorical:null===(t=null==Me?void 0:Me.colors)||void 0===t?void 0:t.categorical,themeSemantic:vt(Me),edgeColorBy:at,edgeOpacity:ct,colorByDepth:ut,nodeSize:dt,nodeSizeRange:ht,decay:jt,pulse:Bt,transition:xe,introAnimation:be,staleness:Gt,thresholds:Vt,orbitMode:Zt,orbitSize:Qt,orbitSpeed:Jt,orbitRevolution:te,orbitRevolutionStyle:ee,orbitEccentricity:ie,orbitShowRings:oe,orbitAnimated:re,customNetworkLayout:le,layoutConfig:se}},[C,L,N,$,W,R,F,Y,j,B,H,X,G,V,q,U,K,Z,Q,J,tt,Oe,nt,De,ot,rt,gt,yt,pt,lt,st,at,ct,ut,dt,ht,jt,Bt,null==xe?void 0:xe.duration,null==xe?void 0:xe.easing,be,Gt,Vt,Zt,Qt,Jt,te,ee,ie,oe,re,Me,le,se]),Ne=ci(Le),$e=o(null),Ie=o(0),ze=o(0),Re=o(!1),Fe=o(null);Fe.current||(Fe.current=new Wr(Ne));const[Ye,je]=d(null),[Be,He]=d(0),[Xe,Ge]=d(0),[Ve,qe]=d(!1),[Ue,Ke]=d(null),Ze=o(null),Qe=o(new Map),Je=o(0),on=a(t=>{if("function"==typeof lt)return lt(t)+"";if("string"==typeof lt&&t.data){const e=t.data[lt];if(void 0!==e){if(!Qe.current.has(e+"")){const t=Array.isArray(st)?st:ne;Qe.current.set(e+"",t[Je.current++%t.length])}return Qe.current.get(e+"")}}if(Qe.current.has(t.id))return Qe.current.get(t.id);const e=Array.isArray(st)?st:ne,n=lt?e[Je.current++%e.length]:e[0];return Qe.current.set(t.id,n),n},[lt,st]),ln=(null===(s=null==Me?void 0:Me.colors)||void 0===s?void 0:s.border)||(null===(c=null==Me?void 0:Me.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==Me?void 0:Me.colors)||void 0===u?void 0:u.primary)||"#999",an=a(t=>{var e,n;return t?"object"==typeof t?t:null!==(n=null===(e=Fe.current)||void 0===e?void 0:e.nodes.get(t))&&void 0!==n?n:null:null},[]),cn=a(t=>{if("function"==typeof at)return at(t);const e=an(t.source),n=an(t.target);return"target"===at&&n?on(n):e?on(e):ln},[at,on,ln,an]),un=a(t=>{if("function"==typeof De.color){const e=an(t.source);return e?De.color(t,e):ln}if(!(null==it?void 0:it.colorBy))return cn(t);const e=De.colorBy,n=an(t.source),i=an(t.target);return"target"===e&&i?on(i):n?on(n):ln},[null==it?void 0:it.colorBy,De.color,De.colorBy,on,cn,ln,an]),dn=("sankey"===C||!!le)&&nt||!!Bt||null!==(f=null===(h=Fe.current)||void 0===h?void 0:h.isAnimating)&&void 0!==f&&f;l(()=>{var t;null===(t=Fe.current)||void 0===t||t.updateConfig(Ne),ce.current=!0,Se()},[Ne,Se]);const hn=a(()=>{var t,e;Ke(null!==(e=null===(t=Fe.current)||void 0===t?void 0:t.customLayoutOverlays)&&void 0!==e?e:null)},[]);l(()=>{var t;const e=Fe.current;if(e){e.buildScene([ye,pe]),hn();for(const n of e.sceneNodes)n.id&&"string"==typeof(null===(t=n.style)||void 0===t?void 0:t.fill)&&Qe.current.set(n.id,n.style.fill);ce.current=!0,Se()}},[Me,ye,pe,Se,hn]);const fn=a(()=>{var t;const e=Fe.current;if(!e)return;e.runLayout([ye,pe]),e.buildScene([ye,pe]),hn(),ce.current=!0;for(const n of e.sceneNodes)n.id&&"string"==typeof(null===(t=n.style)||void 0===t?void 0:t.fill)&&Qe.current.set(n.id,n.style.fill);const n=Array.isArray(st)?st:ne,i=Array.from(e.nodes.values());for(let t=0;i.length>t;t++){const e=i[t];Qe.current.has(e.id)||Qe.current.set(e.id,n[t%n.length])}if(Je.current=i.length,He(e.layoutVersion),Et){const{nodes:t,edges:n}=e.getLayoutData();Et(t,n)}},[ye,pe,Et,st,hn]),gn=a(t=>{if(null==t||"object"!=typeof t)return;const e=Fe.current;e&&(e.ingestEdge(t)&&fn(),Se())},[fn,Se]),yn=a(t=>{const e=Fe.current;if(!e)return;let n=!1;for(const i of t)null!=i&&"object"==typeof i&&e.ingestEdge(i)&&(n=!0);n&&fn(),Se()},[fn,Se]),pn=a(()=>{var t;null===(t=Fe.current)||void 0===t||t.clear(),Qe.current.clear(),Je.current=0,He(0),je(null),Ze.current=null,ce.current=!0,Se()},[Se]),vn=a(()=>{const t=Fe.current;t&&(t.tension+=999,fn(),Se())},[fn,Se]);y(i,()=>({push:gn,pushMany:yn,removeNode:t=>{var e,n,i;const o=null!==(n=null===(e=Fe.current)||void 0===e?void 0:e.removeNode(t))&&void 0!==n&&n;if(o){const e=(null===(i=Ze.current)||void 0===i?void 0:i.data)?"function"==typeof L?L(Ze.current.data):Ze.current.data[L]:void 0;Ze.current&&"node"===Ze.current.nodeOrEdge&&e===t&&(Ze.current=null,je(null)),Qe.current.delete(t),fn(),ce.current=!0,Se()}return o},removeEdge:(t,e)=>{var n,i;const o=null!==(i=null===(n=Fe.current)||void 0===n?void 0:n.removeEdge(t,e))&&void 0!==i&&i;if(o){if(Ze.current&&"edge"===Ze.current.nodeOrEdge){const n=Ze.current.data;let i;i=void 0!==e?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===t&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===e:!z||!n||("function"==typeof z?z:t=>null==t?void 0:t[z])(n)===t,i&&(Ze.current=null,je(null))}fn(),ce.current=!0,Se()}return o},updateNode:(t,e)=>{var n,i;const o=null!==(i=null===(n=Fe.current)||void 0===n?void 0:n.updateNode(t,e))&&void 0!==i?i:null;return o&&(ce.current=!0,Se()),o},updateEdge:(t,e,n)=>{var i,o;const r=null!==(o=null===(i=Fe.current)||void 0===i?void 0:i.updateEdge(t,e,n))&&void 0!==o?o:[];return r.length>0&&(fn(),ce.current=!0,Se()),r},clear:pn,getTopology:()=>{var t,e;return null!==(e=null===(t=Fe.current)||void 0===t?void 0:t.getLayoutData())&&void 0!==e?e:{nodes:[],edges:[]}},getTopologyDiff:()=>{const t=Fe.current;return t?{addedNodes:Array.from(t.addedNodes),removedNodes:Array.from(t.removedNodes),addedEdges:Array.from(t.addedEdges),removedEdges:Array.from(t.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:vn,getTension:()=>{var t,e;return null!==(e=null===(t=Fe.current)||void 0===t?void 0:t.tension)&&void 0!==e?e:0}}),[gn,yn,pn,vn,fn,Se]);const mn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),xn=mn?O||(Array.isArray(E)?void 0:E):void 0;l(()=>{var t;const e=Fe.current;if(e)if(mn&&xn)e.ingestHierarchy(xn,[ye,pe]),e.buildScene([ye,pe]),hn(),ce.current=!0,Se();else{const n=Te,i=Array.isArray(Ee)?Ee:[];if(0===n.length&&0===i.length)return;e.ingestBounded(n,i,[ye,pe]),e.buildScene([ye,pe]),hn();for(const n of e.sceneNodes)n.id&&(null===(t=n.style)||void 0===t?void 0:t.fill)&&Qe.current.set(n.id,n.style.fill+"");const o=Array.isArray(st)?st:ne,r=Array.from(e.nodes.values());for(let t=0;r.length>t;t++){const e=r[t];Qe.current.has(e.id)||Qe.current.set(e.id,o[t%o.length])}Je.current=r.length,ce.current=!0,Se()}},[Te,Ee,O,xn,mn,ye,pe,Ne,Se,st,hn]),l(()=>{D&&D.length>0&&yn(D)},[]);const bn=a(t=>{if(Mt&&Mt(t),Ct){const e=Date.now();Ct(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt}:{type:"hover-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt})}},[Mt,Ct,Tt]),kn=a(t=>{if(Pt&&Pt(t),Ct){const e=Date.now();Ct(t?{type:"click",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt}:{type:"click-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt})}},[Pt,Ct,Tt]),{hoverHandlerRef:wn,hoverLeaveRef:An,onPointerMove:_n,onPointerLeave:Sn}=ue;wn.current=t=>{if(!_t)return;const e=$e.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-ge.left,o=t.clientY-n.top-ge.top;if(0>i||i>ye||0>o||o>pe)return void(Ze.current&&(Ze.current=null,je(null),bn&&(bn(null),ce.current=!0),Se()));const r=Fe.current;if(!r)return;const l=Yr(r.sceneNodes,r.sceneEdges,i,o);if(!l)return void(Ze.current&&(Ze.current=null,je(null),bn&&(bn(null),ce.current=!0),Se()));const s=to(l.datum||{},l.x,l.y,{nodeOrEdge:l.type});Ze.current=s,je(s),bn&&(bn(s),ce.current=!0),Se()},An.current=()=>{Ze.current&&(Ze.current=null,je(null),bn&&(bn(null),ce.current=!0),Se())};const Mn=o(()=>{});Mn.current=t=>{if(!Pt&&!Ct)return;const e=$e.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-ge.left,o=t.clientY-n.top-ge.top;if(0>i||i>ye||0>o||o>pe)return;const r=Fe.current;if(!r)return;const l=Yr(r.sceneNodes,r.sceneEdges,i,o);kn(l?to(l.datum||{},l.x,l.y,{nodeOrEdge:l.type}):null)};const Pn=a(t=>Mn.current(t),[]),Cn=o(-1),Tn=o(null),En=o(-1),On=a(t=>{var e;const n=Fe.current;if(!n)return;const i=function(t){var e,n,i,o,r,l;const s=[];for(const a of t)if("circle"===a.type&&null!=a.cx){if(0>=a.r)continue;s.push({x:a.cx,y:a.cy,datum:a.datum,shape:"circle",group:null!==(n=null===(e=a.datum)||void 0===e?void 0:e.id)&&void 0!==n?n:"_default"})}else if("rect"===a.type&&null!=a.x){if(0>=a.w||0>=a.h)continue;s.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=null===(i=a.datum)||void 0===i?void 0:i.id)&&void 0!==o?o:"_default"})}else"arc"===a.type&&null!=a.cx&&s.push({x:a.cx,y:a.cy,datum:a.datum,shape:"circle",group:null!==(l=null===(r=a.datum)||void 0===r?void 0:r.id)&&void 0!==l?l:"_default"});return s.sort((t,e)=>t.x-e.x||t.y-e.y),s}(n.sceneNodes);if(0===i.length)return;const o=tn(i),r=Cn.current;if(0>r){if("Escape"===t.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(t.key))return;t.preventDefault(),Cn.current=0,En.current=-1;const e=o.flat[0];Tn.current={shape:e.shape,w:e.w,h:e.h};const n=to(e.datum||{},e.x,e.y,{nodeOrEdge:"node"});return Ze.current=n,je(n),bn&&(bn(n),ce.current=!0),void Se()}const l=en(o,r),s=function(t,e,n,i,o){var r,l,s;const a=n.flat[e.flatIndex];if(!a)return nn(t,e,n);const c=null===(r=a.datum)||void 0===r?void 0:r.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const i=null!==(l=function(t,e,n){let i=null,o=1/0;for(let r=0;t.flat.length>r;r++){const l=t.flat[r];if(l===e)continue;const s=l.x-e.x,a=l.y-e.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(a);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(a);break;case"down":c=a>0&&Math.abs(a)>=Math.abs(s);break;case"up":c=0>a&&Math.abs(a)>=Math.abs(s)}if(!c)continue;const u=s*s+a*a;o>u&&(o=u,i=r)}return i}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up"))&&void 0!==l?l:e.flatIndex;return i!==e.flatIndex&&(o.current=-1),i}case"Enter":{if(null==c)return e.flatIndex;const t=function(t,e){var n;const i=t+"",o=[];for(const t of e){const e=null!==(n=t.datum)&&void 0!==n?n:t,r=rn(e.source),l=rn(e.target),s=null!=r,a=null!=l;s&&r+""===i&&a?o.push(l+""):a&&l+""===i&&s&&o.push(r+"")}return o}(c,i);if(0===t.length)return e.flatIndex;const r=null!==(s=n.idToIdx.get(t[(o.current+1)%t.length]))&&void 0!==s?s:-1;return 0>r?e.flatIndex:(o.current=-1,r)}default:{const i=nn(t,e,n);return null!==i&&i!==e.flatIndex&&(o.current=-1),i}}}(t.key,l,o,null!==(e=n.sceneEdges)&&void 0!==e?e:[],En);if(null===s)return;if(t.preventDefault(),0>s)return Cn.current=-1,Tn.current=null,En.current=-1,Ze.current=null,je(null),bn&&(bn(null),ce.current=!0),void Se();Cn.current=s;const a=o.flat[s];Tn.current={shape:a.shape,w:a.w,h:a.h};const c={data:a.datum||{},x:a.x,y:a.y,__semioticHoverData:!0,nodeOrEdge:"node"};Ze.current=c,je(c),bn&&(bn(c),ce.current=!0),Se()},[bn,Se]),Dn=a(t=>{Cn.current=-1,Tn.current=null,_n(t)},[_n]);Ae.current=()=>{var t,e,n,i,o,r,l;we.current=0;const s=$e.current;if(!s)return;const a=s.getContext("2d");if(!a)return;const c=Fe.current;if(!c)return;const u=performance.now(),d=Ie.current?Math.min((u-Ie.current)/1e3,.1):.016;Ie.current=u;const h=c.advanceTransition(de.current?u+1e6:u),f=!de.current&&h,g=!de.current&&c.tickAnimation([ye,pe],d);(h||ce.current||g)&&c.buildScene([ye,pe]);const y=Ri();if(!zi(s,fe,ge,y))return;if(a.clearRect(-ge.left,-ge.top,fe[0],fe[1]),At){const t=We(a,At);t&&(a.fillStyle=t,a.fillRect(0,0,ye,pe))}jt&&c.applyDecay(),Bt&&c.applyPulse(u),Vt&&c.applyThresholds(u),c.applyTopologyDiff(u);const p=null!==(t=null==Gt?void 0:Gt.threshold)&&void 0!==t?t:5e3,v=Gt&&c.lastIngestTime>0&&u-c.lastIngestTime>p;if(v&&(a.globalAlpha=null!==(e=null==Gt?void 0:Gt.dimOpacity)&&void 0!==e?e:.5),function(t,e){for(const n of e)switch(n.type){case"bezier":Kr(t,n);break;case"line":Zr(t,n);break;case"ribbon":Qr(t,n);break;case"curved":Jr(t,n)}}(a,c.sceneEdges),function(t,e){var n,i,o;for(const r of e){if("rect"!==r.type)continue;const e=r;e.w>0&&e.h>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fillRect(e.x,e.y,e.w,e.h)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.strokeRect(e.x,e.y,e.w,e.h)),Hi(t,e),t.restore())}}(a,c.sceneNodes),function(t,e){var n,i,o;for(const r of e){if("circle"!==r.type)continue;const e=r;e.r>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.r,0,2*Math.PI),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),Xi(t,e),t.restore())}}(a,c.sceneNodes),function(t,e){var n,i,o;for(const r of e){if("arc"!==r.type)continue;const e=r;t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.outerR,e.startAngle,e.endAngle),t.arc(e.cx,e.cy,e.innerR,e.endAngle,e.startAngle,!0),t.closePath(),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),t.restore()}}(a,c.sceneNodes),nt&&c.particlePool&&!v){const t=Array.from(c.edges.values());if(t.length>0){!function(t,e,n,i){var o,r;const l=null!==(o=i.spawnRate)&&void 0!==o?o:vo.spawnRate,s=null!==(r=i.maxPerEdge)&&void 0!==r?r:vo.maxPerEdge;for(let i=0;e.length>i;i++){const o=e[i];if(!o.bezier)continue;if(t.countForEdge(i)>=s)continue;const r=o.value*l*n*(o.bezier.circular?.3:1),a=Math.floor(r),c=r-a;let u=a;Math.random()<c&&u++;for(let e=0;u>e&&t.countForEdge(i)<s;e++)t.spawn(i)}}(c.particlePool,t,d,De);const e=.5*(null!==(n=De.speedMultiplier)&&void 0!==n?n:1);let i;if(De.proportionalSpeed){const e=t.reduce((t,e)=>Math.max(t,e.value||1),1);i=t.map(t=>.3+(t.value||1)/e*1.7)}c.particlePool.step(d,e,t,i),function(t,e,n,i,o){var r,l;const s=null!==(r=i.radius)&&void 0!==r?r:vo.radius,a=null!==(l=i.opacity)&&void 0!==l?l:vo.opacity;t.globalAlpha=a;for(let r=0;e.particles.length>r;r++){const l=e.particles[r];if(!l.active)continue;const a=n[l.edgeIndex];if(!a)continue;let c;c="string"==typeof i.color&&"inherit"!==i.color?i.color:o(a),t.fillStyle=We(t,c)||c,t.beginPath(),t.arc(l.x,l.y,s,0,2*Math.PI),t.fill()}t.globalAlpha=1}(a,c.particlePool,t,De,un)}}v&&(a.globalAlpha=1);const m=ce.current;if(ce.current=!1,m||f||g){const t=$e.current;t&&t.setAttribute("aria-label",vi(null!==(o=null===(i=c.sceneNodes)||void 0===i?void 0:i.length)&&void 0!==o?o:0,null!==(l=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==l?l:0,"Network chart"))}const x=m||f||g||Re.current;x&&u-ze.current>=33?(Ge(t=>t+1),ze.current=u,Re.current=!1):Re.current=!!x,(dn||f||null!=c.transition||g||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Re.current)&&(we.current=requestAnimationFrame(()=>Ae.current()))},ai({hydrated:Pe,wasHydratingFromSSR:Ce,storeRef:Fe,dirtyRef:ce,renderFnRef:Ae}),l(()=>{ce.current=!0,Se()},[C,ye,pe,At,Se]),sn(Gt,Fe,ce,Se,Ve,qe);const Ln=_t&&Ye?t(Ni,{x:Ye.x,y:Ye.y,containerWidth:ye,containerHeight:pe,margin:ge,className:"stream-network-tooltip",zIndex:2,children:St?St(Ye):t(rl,{data:Ye})}):null;if(ei||!Pe&&Ce){const n=Fe.current;if(n){const t=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),e=t?O||(Array.isArray(E)?void 0:E):void 0;if(t&&e)n.ingestHierarchy(e,[ye,pe]),n.buildScene([ye,pe]);else{const t=Te,e=Array.isArray(Ee)?Ee:[];(t.length>0||e.length>0)&&(n.ingestBounded(t,e,[ye,pe]),n.buildScene([ye,pe]))}}const i=null!==(g=null==n?void 0:n.sceneNodes)&&void 0!==g?g:[],o=null!==(p=null==n?void 0:n.sceneEdges)&&void 0!==p?p:[],r=null!==(v=null==n?void 0:n.labels)&&void 0!==v?v:[];return e("div",{ref:he,className:"stream-network-frame"+(wt?" "+wt:""),role:"img","aria-label":Ut||("string"==typeof Rt?Rt:"Network chart"),style:{position:"relative",width:xt?"100%":fe[0],height:bt?"100%":fe[1]},children:[t(Ci,{summary:Kt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:fe[0],height:fe[1],style:{position:"absolute",left:0,top:0},children:[me&&t("g",{transform:`translate(${ge.left},${ge.top})`,children:me}),e("g",{transform:`translate(${ge.left},${ge.top})`,children:[At&&t("rect",{x:0,y:0,width:ye,height:pe,fill:At}),o.map((e,n)=>function(e,n){switch(e.type){case"line":return t("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+n);case"bezier":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"#999"),fillOpacity:i.style.fillOpacity,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-edge-"+n)}case"ribbon":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"#999"),fillOpacity:i.style.fillOpacity,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-edge-"+n)}case"curved":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"none"),stroke:i.style.stroke||"#999",strokeWidth:i.style.strokeWidth||1,opacity:i.style.opacity},"net-edge-"+n)}default:return null}}(e,n)).filter(Boolean),i.map((e,n)=>function(e,n){switch(e.type){case"circle":{const i=e;return t("circle",{cx:i.cx,cy:i.cy,r:i.r,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-circle-"+n)}case"rect":{const i=e;return t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-rect-"+n)}case"arc":{const i=e,o=I().innerRadius(i.innerR).outerRadius(i.outerR).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2)(Jn)||"";return t("path",{d:o,transform:`translate(${i.cx},${i.cy})`,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-arc-"+n)}default:return null}}(e,n)).filter(Boolean),r.map((e,n)=>function(e,n){return t("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"#333",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+n)}(e,n)).filter(Boolean)]})]}),t(qr,{width:ye,height:pe,totalWidth:fe[0],totalHeight:fe[1],margin:ge,labels:r,sceneNodes:i,title:Rt,legend:Lt,legendPosition:Nt,legendHoverBehavior:$t,legendClickBehavior:It,legendHighlightedCategory:Wt,legendIsolatedCategories:zt,foregroundGraphics:_e(ve,null===(m=Fe.current)||void 0===m?void 0:m.customLayoutOverlays),annotations:Ot,svgAnnotationRules:Dt,annotationFrame:0})]})}const Nn=Fe.current;return e("div",{ref:he,className:"stream-network-frame"+(wt?" "+wt:""),role:"group","aria-label":Ut||("string"==typeof Rt?Rt:"Network chart"),tabIndex:0,style:{position:"relative",width:xt?"100%":fe[0],height:bt?"100%":fe[1],overflow:"visible"},onKeyDown:On,children:[qt&&t(Ti,{tableId:ke}),qt&&t(Pi,{nodes:null!==(x=null==Nn?void 0:Nn.sceneNodes)&&void 0!==x?x:[],edges:null!==(b=null==Nn?void 0:Nn.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart",tableId:ke,chartTitle:"string"==typeof Rt?Rt:void 0}),t(Ci,{summary:Kt}),e("div",{role:"img","aria-label":Ut||("string"==typeof Rt?Rt:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?Dn:void 0,onMouseLeave:_t?Sn:void 0,onClick:Pt||Ct?Pn:void 0,children:[me&&t("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:fe[0],height:fe[1],pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${ge.left},${ge.top})`,children:me})}),t("canvas",{ref:$e,"aria-label":vi(null!==(w=null===(k=null==Nn?void 0:Nn.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(_=null===(A=null==Nn?void 0:Nn.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==_?_:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),t(Ei,{hoverPoint:Ye}),t(qr,{width:ye,height:pe,totalWidth:fe[0],totalHeight:fe[1],margin:ge,labels:(null==Nn?void 0:Nn.labels)||[],sceneNodes:null==Nn?void 0:Nn.sceneNodes,title:Rt,legend:Lt,legendPosition:Nt,legendHoverBehavior:$t,legendClickBehavior:It,legendHighlightedCategory:Wt,legendIsolatedCategories:zt,foregroundGraphics:_e(ve,Ue),annotations:Ot,svgAnnotationRules:Dt,annotationFrame:Xe}),t(Di,{active:Cn.current>=0,hoverPoint:Ye,margin:ge,size:fe,shape:null===(S=Tn.current)||void 0===S?void 0:S.shape,width:null===(M=Tn.current)||void 0===M?void 0:M.w,height:null===(P=Tn.current)||void 0===P?void 0:P.h}),Ln,(null==Gt?void 0:Gt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Gt.badgePosition?{top:4,left:4}:"bottom-left"===Gt.badgePosition?{bottom:4,left:4}:"bottom-right"===Gt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Ve?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Ve?"STALE":"LIVE"})]})]})});function sl(t){const e=[];for(const[n,i]of Object.entries(t.fields))if("point"===i.type)e.push(t=>i.values.has(t[n]));else{const[t,o]=i.range;e.push(e=>{const i=e[n];return i>=t&&o>=i})}return t=>e.every(e=>e(t))}function al(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}ll.displayName="StreamNetworkFrame";const[cl,ul]=yt(t=>({selections:new Map,setClause(e,n){t(t=>{const i=new Map(t.selections),o=al(i,e),r=new Map(o.clauses);return r.set(n.clientId,n),i.set(e,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},clearClause(e,n){t(t=>{const i=t.selections.get(e);if(!i)return{};const o=new Map(t.selections),r=new Map(i.clauses);return r.delete(n),o.set(e,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},setResolution(e,n){t(t=>{const i=new Map(t.selections),o=al(i,e);return i.set(e,Object.assign(Object.assign({},o),{resolution:n})),{selections:i}})},clearSelection(e){t(t=>{const n=new Map(t.selections),i=n.get(e);return i&&n.set(e,Object.assign(Object.assign({},i),{clauses:new Map})),{selections:n}})}})),[dl,hl]=yt(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const n=t.observations;return n.push(e),n.length>t.maxObservations&&n.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}}));function fl(t){const e=g(),n=t.clientId||e,{name:i}=t,o=ul(t=>t.selections.get(i)),l=ul(t=>t.setClause),s=ul(t=>t.clearClause),c=r(()=>!!o&&o.clauses.size>0,[o]);return{predicate:r(()=>o&&0!==o.clauses.size?function(t,e){const n=[];for(const[i,o]of t.clauses)"crossfilter"===t.resolution&&i===e||n.push(sl(o));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(o,n):()=>!0,[o,n]),isActive:c,selectPoints:a(t=>{const e={};for(const[n,i]of Object.entries(t))e[n]={type:"point",values:new Set(i)};l(i,{clientId:n,type:"point",fields:e})},[n,i,l]),selectInterval:a(t=>{const e={};for(const[n,i]of Object.entries(t))e[n]={type:"interval",range:i};l(i,{clientId:n,type:"interval",fields:e})},[n,i,l]),clear:a(()=>{s(i,n)},[s,i,n]),clientId:n}}function gl(t){return 2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function yl(t,e,n){var i;const o=null!==(i=t.xValue)&&void 0!==i?i:null==e?void 0:e[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function pl(t){let e=t.data||t.datum||t;return Array.isArray(e)&&(e=e[0]),null!=t.xValue&&e&&"object"==typeof e&&!Array.isArray(e)&&null==e.xValue?Object.assign(Object.assign({},e),{xValue:t.xValue}):e||{}}function vl({selection:t,linkedHover:e,fallbackFields:n=[],unwrapData:i=!1,onObservation:o,chartType:s,chartId:c,onClick:u,hoverHighlight:h,colorByField:f}){const y=g(),p=function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields||e||[],mode:t.mode,xField:t.xField}:null}(e,n),v=fl({name:(null==t?void 0:t.name)||"__unused__"}),m=function(t){const e=t.name||"hover",{fields:n}=t,{predicate:i,isActive:o,selectPoints:r,clear:l}=fl({name:e});return{onHover:a(t=>{if(!t)return void l();const e={};for(const i of n){const n=t[i];void 0!==n&&(e[i]=[n])}Object.keys(e).length>0&&r(e)},[n,r,l,e]),predicate:i,isActive:o}}({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||n||[]}),x=hl(t=>t.pushObservation),b=t?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=d(null),A=f||n[0],_=r(()=>{if(!h||null==k||!A)return null;const t=k,e=A;return{isActive:!0,predicate:n=>{var i;return("string"==typeof n[e]?n[e]:(null!==(i=n[e])&&void 0!==i?i:"")+"")===t}}},[h,k,A]),S=a(t=>{var n,i;if(e)if(t){let e=t.data||t.datum||t;if(Array.isArray(e)&&(e=e[0]),"x-position"===(null==p?void 0:p.mode)&&p.xField){const n=yl(t,e,p.xField);null!=n&&function(t,e,n){const i=Dn.positions.get(t);(null==i?void 0:i.locked)||i&&i.xValue===e&&i.sourceId===n||(Dn={positions:new Map(Dn.positions).set(t,{xValue:e,sourceId:n})},Nn())}(p.name||"hover",n,y)}"x-position"!==(null==p?void 0:p.mode)&&m.onHover(e)}else"x-position"===(null==p?void 0:p.mode)&&$n(p.name||"hover",y),"x-position"!==(null==p?void 0:p.mode)&&m.onHover(null);if(h&&A)if(t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=null==e?void 0:e[A];w(null!=n?n+"":null)}else w(null);if(o||x){const e={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(t){const r=pl(t),l=Object.assign(Object.assign({},e),{type:"hover",datum:r||{},x:null!==(n=t.x)&&void 0!==n?n:0,y:null!==(i=t.y)&&void 0!==i?i:0});o&&o(l),x&&x(l)}else{const t=Object.assign(Object.assign({},e),{type:"hover-end"});o&&o(t),x&&x(t)}}},[e,m,p,y,o,s,c,x,h,A]),M=a(t=>{var e,n,i,r;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=yl(t,e,p.xField);null!=n&&function(t,e,n){const i=Dn.positions.get(t);if(null==i?void 0:i.locked){const e=new Map(Dn.positions);return e.delete(t),Dn={positions:e},Nn(),!1}Dn={positions:new Map(Dn.positions).set(t,{xValue:e,sourceId:n,locked:!0})},Nn()}(p.name||"hover",n,y)}if(t&&u){let i=t.data||t.datum||t;Array.isArray(i)&&(i=i[0]),u(i,{x:null!==(e=t.x)&&void 0!==e?e:0,y:null!==(n=t.y)&&void 0!==n?n:0})}if(o||x){const e={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(t){const n=pl(t),l=Object.assign(Object.assign({},e),{type:"click",datum:n||{},x:null!==(i=t.x)&&void 0!==i?i:0,y:null!==(r=t.y)&&void 0!==r?r:0});o&&o(l),x&&x(l)}else{const t=Object.assign(Object.assign({},e),{type:"click-end"});o&&o(t),x&&x(t)}}},[u,o,x,s,c,p,y]);return l(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const t=p.name||"hover";return()=>{In(t,y),$n(t,y)}},[null==p?void 0:p.mode,null==p?void 0:p.name,y]),{activeSelectionHook:b,hoverSelectionHook:_,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:y}}const ml={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 xl(t,e,n){var i,o,r,l,s,a,c;const u=ml[t||"primary"],d="context"===t||"sparkline"===t;return{width:null!==(i=e.width)&&void 0!==i?i:u.width,height:null!==(o=e.height)&&void 0!==o?o:u.height,showAxes:null!==(r=e.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=e.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=e.enableHover)&&void 0!==s?s:!!e.linkedHover||u.enableHover,showLegend:null!==(a=e.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=e.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:d?void 0:e.xLabel,yLabel:d?void 0:e.yLabel,categoryLabel:d?void 0:e.categoryLabel,valueLabel:d?void 0:e.valueLabel,marginDefaults:bl(u.marginDefaults,e.showCategoryTicks,e.orientation),compactMode:d}}function bl(t,e,n){if(!1!==e)return t;const i=Object.assign({},t);return"horizontal"===n?i.left=Math.min(i.left,15):i.bottom=Math.min(i.bottom,15),i}const kl={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},wl={opacity:.7,marginRight:4};function Al(t,e,n){if(null!=t)return"function"==typeof e?e(t):t["string"==typeof e?e:n]}function _l(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function Sl(t={}){const{timeAccessor:n,valueAccessor:i,xLabel:o="x",yLabel:r="y"}=t;return t=>{var l;const s=null!==(l=null==t?void 0:t.data)&&void 0!==l?l:null,a=Al(s,n,"time"),c=Al(s,i,"value");return e("div",{className:"semiotic-tooltip",style:kl,children:[e("div",{children:[e("span",{style:wl,children:[o,":"]}),_l(a)]}),e("div",{children:[e("span",{style:wl,children:[r,":"]}),_l(c)]})]})}}"undefined"!=typeof process&&process;const Ml={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"},Pl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Cl(e,n,i,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},Ml),{width:n,height:i}),children:o||"No data available"}):null}function Tl(e,n,i,o){if(!e)return null;if(!1===o)return null;if(null!=o)return t("div",{style:{width:n,height:i,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(i/40)),l=Math.max(8,Math.floor(i/(3*r))),s=Math.max(6,Math.floor(i/(2.5*r))),a=Math.floor((i-(r*(l+s)-s))/2);return t("div",{style:{width:n,height:i,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,i)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Pl),{position:"absolute",top:a+i*(l+s),left:Math.floor(.1*n),width:30+(37*i+13)%50+"%",height:l,opacity:.5+i%2*.2})},i))})}function El(t,e){var n;return null!=t?t:Math.max(null!==(n=null==e?void 0:e.length)&&void 0!==n?n:0,200)}const Ol=f(function(e,n){var i,r,l,s,c;const u=xl(e.mode,{width:null!==(r=null===(i=e.size)||void 0===i?void 0:i[0])&&void 0!==r?r:e.width,height:null!==(s=null===(l=e.size)||void 0===l?void 0:l[1])&&void 0!==s?s:e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0}),{size:d,margin:h,className:f,arrowOfTime:g="right",windowMode:p="sliding",windowSize:v,data:m,timeAccessor:x,valueAccessor:b,timeExtent:k,valueExtent:w,extentPadding:A,stroke:_="#007bff",strokeWidth:S=2,strokeDasharray:M,opacity:P,background:C,tooltipContent:T,tooltip:E,onHover:O,annotations:D,svgAnnotationRules:L,tickFormatTime:N,tickFormatValue:$,decay:I,pulse:W,staleness:z,transition:R,linkedHover:F,selection:Y,onObservation:j,chartId:B,loading:H,loadingContent:X,emptyContent:G,emphasis:V,legendPosition:q}=e,U=u.showAxes,K=u.enableHover,Z=null!=h?h:u.marginDefaults,Q=null!=d?d:[u.width,u.height],J=null!==(c=null!=T?T:E)&&void 0!==c?c:Sl({timeAccessor:x,valueAccessor:b}),tt=o(null),{customHoverBehavior:et}=vl({selection:Y,linkedHover:F,unwrapData:!0,onObservation:j,chartType:"RealtimeLineChart",chartId:B}),nt=a(t=>{O&&O(t),et(t)},[O,et]);y(n,()=>({push:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=tt.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=tt.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=tt.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const it=Tl(H,Q[0],Q[1],X),ot=it?null:Cl(m,Q[0],Q[1],G),rt={stroke:_,strokeWidth:S,strokeDasharray:M};null!=P&&(rt.opacity=P);const lt=El(v,m);return it||ot||t(yo,{ref:tt,chartType:"line",runtimeMode:"streaming",size:Q,margin:Z,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:g,windowMode:p,windowSize:lt,data:m,timeAccessor:x,valueAccessor:b,xExtent:k,yExtent:w,extentPadding:A,lineStyle:rt,showAxes:U,background:C,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:nt,annotations:D,svgAnnotationRules:L,tickFormatTime:N,tickFormatValue:$,decay:I,pulse:W,staleness:z,transition:R,pointIdAccessor:e.pointIdAccessor,legendPosition:q})});Ol.displayName="RealtimeLineChart";const Dl=f(function(n,i){var l,s,c,u,d;const h=xl(n.mode,{width:null!==(s=null===(l=n.size)||void 0===l?void 0:l[0])&&void 0!==s?s:n.width,height:null!==(u=null===(c=n.size)||void 0===c?void 0:c[1])&&void 0!==u?u:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:f,size:g,margin:p,className:v,arrowOfTime:m="right",windowMode:x="sliding",windowSize:b,data:k,timeAccessor:w,valueAccessor:A,timeExtent:_,valueExtent:S,extentPadding:M,categoryAccessor:P,colors:C,fill:T,stroke:E,strokeWidth:O,opacity:D,gap:L,background:N,tooltipContent:$,tooltip:I,onHover:W,annotations:z,svgAnnotationRules:R,tickFormatTime:F,tickFormatValue:Y,linkedHover:j,selection:B,decay:H,pulse:X,staleness:G,transition:V,onObservation:q,chartId:U,loading:K,loadingContent:Z,emptyContent:Q,emphasis:J,legendPosition:tt,brush:et,onBrush:nt,linkedBrush:it}=n,ot=h.showAxes,rt=h.enableHover,lt=null!=p?p:h.marginDefaults,st=null!=g?g:[h.width,h.height],at=null!==(d=null!=$?$:I)&&void 0!==d?d:function(n={}){const{timeAccessor:i,valueAccessor:o}=n;return n=>{var r;const l=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==l?void 0:l.binStart)||null==(null==l?void 0:l.binEnd)){const n=Al(l,i,"time"),r=Al(l,o,"value");return e("div",{className:"semiotic-tooltip",style:kl,children:[e("div",{children:[t("span",{style:wl,children:"x:"}),_l(n)]}),e("div",{children:[t("span",{style:wl,children:"y:"}),_l(r)]})]})}return e("div",{className:"semiotic-tooltip",style:kl,children:[e("div",{children:[t("span",{style:wl,children:"range:"}),_l(l.binStart),"–",_l(l.binEnd)]}),null!=l.total&&e("div",{children:[t("span",{style:wl,children:"count:"}),_l(l.total)]}),null!=l.category&&e("div",{children:[t("span",{style:wl,children:"category:"}),_l(l.category)]})]})}}({timeAccessor:w,valueAccessor:A}),ct=o(null),{customHoverBehavior:ut}=vl({selection:B,linkedHover:j,unwrapData:!0,onObservation:q,chartType:"RealtimeHistogram",chartId:U}),dt=a(t=>{W&&W(t),ut(t)},[W,ut]),ht=!0===et?{dimension:"x",snap:"bin"}:"x"===et?{dimension:"x"}:"object"==typeof et?et:void 0,ft=(gt=it)?"string"==typeof gt?{name:gt}:gt:null;var gt;const yt=function(t){const{name:e,xField:n,yField:i}=t,{predicate:o,isActive:l,selectInterval:s,clear:c}=fl({name:e}),u=n&&i?"xyBrush":n?"xBrush":"yBrush",d=a(t=>{if(!t)return void c();const e={};"xyBrush"===u&&function(t){return 2===t.length&&Array.isArray(t[0])&&2===t[0].length&&Array.isArray(t[1])&&2===t[1].length}(t)?(n&&(e[n]=[Math.min(t[0][0],t[1][0]),Math.max(t[0][0],t[1][0])]),i&&(e[i]=[Math.min(t[0][1],t[1][1]),Math.max(t[0][1],t[1][1])])):"xBrush"===u&&gl(t)?n&&(e[n]=[Math.min(...t),Math.max(...t)]):"yBrush"===u&&gl(t)&&i&&(e[i]=[Math.min(...t),Math.max(...t)]),Object.keys(e).length>0&&s(e)},[u,n,i,s,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:o,isActive:l,clear:c}}(Object.assign({name:(null==ft?void 0:ft.name)||"__unused_hist_brush__",xField:(null==ft?void 0:ft.xField)||("string"==typeof w?w:"time")},(null==ft?void 0:ft.yField)?{yField:ft.yField}:{})),pt=o(yt.brushInteraction);pt.current=yt.brushInteraction;const vt=a(t=>{if(nt&&nt(t),q&&q(t?{type:"brush",extent:t,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:U}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:U}),ft){const e=pt.current;e.end(t?"xBrush"===e.brush?t.x:"yBrush"===e.brush?t.y:[[t.x[0],t.y[0]],[t.x[1],t.y[1]]]:null)}},[nt,q,U,ft]);y(i,()=>({push:t=>{var e;return null===(e=ct.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=ct.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=ct.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=ct.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=ct.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=ct.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=ct.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const mt=Tl(K,st[0],st[1],Z),xt=mt?null:Cl(k,st[0],st[1],Q),bt={};null!=T&&(bt.fill=T),null!=E&&(bt.stroke=E),null!=O&&(bt.strokeWidth=O),null!=D&&(bt.opacity=D),null!=L&&(bt.gap=L);const kt=J?`${v||""} semiotic-emphasis-${J}`.trim():v,wt=El(b,k);return mt||xt||t(yo,{ref:ct,chartType:"bar",runtimeMode:"streaming",size:st,margin:lt,className:kt,arrowOfTime:m,windowMode:x,windowSize:wt,data:k,timeAccessor:w,valueAccessor:A,xExtent:_,yExtent:S,extentPadding:M,binSize:f,categoryAccessor:P,barColors:C,barStyle:bt,showAxes:ot,background:N,hoverAnnotation:rt,tooltipContent:at,customHoverBehavior:dt,annotations:z,svgAnnotationRules:R,tickFormatTime:F,tickFormatValue:Y,decay:H,pulse:X,staleness:G,transition:V,pointIdAccessor:n.pointIdAccessor,legendPosition:tt,brush:ht||(it?{dimension:"x"}:void 0),onBrush:ht||it?vt:void 0})});Dl.displayName="RealtimeHistogram";const Ll=f(function(e,n){var i,r,l,s,c;const u=xl(e.mode,{width:null!==(r=null===(i=e.size)||void 0===i?void 0:i[0])&&void 0!==r?r:e.width,height:null!==(s=null===(l=e.size)||void 0===l?void 0:l[1])&&void 0!==s?s:e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0}),{size:d,margin:h,className:f,arrowOfTime:g="right",windowMode:p="sliding",windowSize:v,data:m,timeAccessor:x,valueAccessor:b,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:_,colors:S,radius:M,fill:P,opacity:C,stroke:T,strokeWidth:E,background:O,tooltipContent:D,tooltip:L,onHover:N,annotations:$,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:z,linkedHover:R,selection:F,onObservation:Y,chartId:j,loading:B,loadingContent:H,emptyContent:X,emphasis:G,legendPosition:V}=e,q=u.showAxes,U=u.enableHover,K=null!=h?h:u.marginDefaults,Z=null!=d?d:[u.width,u.height],Q=null!==(c=null!=D?D:L)&&void 0!==c?c:Sl({timeAccessor:x,valueAccessor:b}),J=o(null),{customHoverBehavior:tt}=vl({selection:F,linkedHover:R,unwrapData:!0,onObservation:Y,chartType:"RealtimeSwarmChart",chartId:j}),et=a(t=>{N&&N(t),tt(t)},[N,tt]);y(n,()=>({push:t=>{var e;return null===(e=J.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=J.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=J.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=J.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=J.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=J.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=J.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const nt=Tl(B,Z[0],Z[1],H),it=nt?null:Cl(m,Z[0],Z[1],X),ot={};null!=M&&(ot.radius=M),null!=P&&(ot.fill=P),null!=C&&(ot.opacity=C),null!=T&&(ot.stroke=T),null!=E&&(ot.strokeWidth=E);const rt=G?`${f||""} semiotic-emphasis-${G}`.trim():f,lt=El(v,m);return nt||it||t(yo,{ref:J,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:K,className:rt,arrowOfTime:g,windowMode:p,windowSize:lt,data:m,timeAccessor:x,valueAccessor:b,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:_,barColors:S,swarmStyle:ot,showAxes:q,background:O,hoverAnnotation:U,tooltipContent:Q,customHoverBehavior:et,annotations:$,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:z,legendPosition:V,pointIdAccessor:e.pointIdAccessor})});Ll.displayName="RealtimeSwarmChart";const Nl=f(function(n,i){var r,l,s,c,u;const d=xl(n.mode,{width:null!==(l=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==l?l:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:f,className:g,arrowOfTime:p="right",windowMode:v="sliding",windowSize:m,data:x,timeAccessor:b,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:_,positiveColor:S,negativeColor:M,connectorStroke:P,connectorWidth:C,gap:T,stroke:E,strokeWidth:O,opacity:D,background:L,tooltipContent:N,tooltip:$,onHover:I,annotations:W,svgAnnotationRules:z,tickFormatTime:R,tickFormatValue:F,linkedHover:Y,selection:j,onObservation:B,chartId:H,loading:X,loadingContent:G,emptyContent:V,emphasis:q,legendPosition:U}=n,K=d.showAxes,Z=d.enableHover,Q=null!=f?f:d.marginDefaults,J=null!=h?h:[d.width,d.height],tt=null!==(u=null!=N?N:$)&&void 0!==u?u:function(n={}){const{timeAccessor:i,valueAccessor:o}=n;return n=>{var r,l;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,a=Al(s,i,"time"),c=null!==(l=null==s?void 0:s.delta)&&void 0!==l?l:Al(s,o,"value"),u=null==s?void 0:s.cumEnd,d="number"==typeof c?0>c?_l(c):"+"+_l(c):_l(c);return e("div",{className:"semiotic-tooltip",style:kl,children:[e("div",{children:[t("span",{style:wl,children:"x:"}),_l(a)]}),e("div",{children:[t("span",{style:wl,children:"Δ:"}),d]}),null!=u&&e("div",{children:[t("span",{style:wl,children:"total:"}),_l(u)]})]})}}({timeAccessor:b,valueAccessor:k}),et=o(null),{customHoverBehavior:nt}=vl({selection:j,linkedHover:Y,unwrapData:!0,onObservation:B,chartType:"RealtimeWaterfallChart",chartId:H}),it=a(t=>{I&&I(t),nt(t)},[I,nt]);y(i,()=>({push:t=>{var e;return null===(e=et.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=et.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=et.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=et.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=et.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=et.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=et.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const ot=Tl(X,J[0],J[1],G),rt=ot?null:Cl(x,J[0],J[1],V),lt={};null!=S&&(lt.positiveColor=S),null!=M&&(lt.negativeColor=M),null!=P&&(lt.connectorStroke=P),null!=C&&(lt.connectorWidth=C),null!=T&&(lt.gap=T),null!=E&&(lt.stroke=E),null!=O&&(lt.strokeWidth=O),null!=D&&(lt.opacity=D);const st=q?`${g||""} semiotic-emphasis-${q}`.trim():g,at=El(m,x);return ot||rt||t(yo,{ref:et,chartType:"waterfall",runtimeMode:"streaming",size:J,margin:Q,className:st,arrowOfTime:p,windowMode:v,windowSize:at,data:x,timeAccessor:b,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:_,waterfallStyle:lt,showAxes:K,background:L,hoverAnnotation:Z,tooltipContent:tt,customHoverBehavior:it,annotations:W,svgAnnotationRules:z,tickFormatTime:R,tickFormatValue:F,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});Nl.displayName="RealtimeWaterfallChart";const $l=f(function(n,i){var r,l,s,c,u;const d=xl(n.mode,{width:null!==(l=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==l?l:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:f,className:g,arrowOfTime:p="right",windowMode:v="sliding",windowSize:m,data:x,timeAccessor:b,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:_,extentPadding:S,heatmapXBins:M=20,heatmapYBins:P=20,aggregation:C="count",background:T,tooltipContent:E,tooltip:O,onHover:D,annotations:L,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:I,decay:W,pulse:z,staleness:R,linkedHover:F,selection:Y,onObservation:j,chartId:B,loading:H,loadingContent:X,emptyContent:G,emphasis:V,legendPosition:q}=n,U=d.showAxes,K=d.enableHover,Z=null!=f?f:d.marginDefaults,Q=null!=h?h:[d.width,d.height],J=null!==(u=null!=E?E:O)&&void 0!==u?u:function(n={}){const{timeAccessor:i,valueAccessor:o,xLabel:r="x",yLabel:l="y"}=n;return n=>{var s,a,c,u;const d=null!==(s=null==n?void 0:n.data)&&void 0!==s?s:null,h=null!==(a=null==d?void 0:d.xCenter)&&void 0!==a?a:Al(d,i,"time"),f=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:Al(d,o,"value"),g=null==d?void 0:d.count,y=null==d?void 0:d.sum,p=null==d?void 0:d.value,v=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return e("div",{className:"semiotic-tooltip",style:kl,children:[e("div",{children:[e("span",{style:wl,children:[r,":"]}),_l(h)]}),e("div",{children:[e("span",{style:wl,children:[l,":"]}),_l(f)]}),null!=g&&e("div",{children:[t("span",{style:wl,children:"count:"}),_l(g)]}),"sum"===v&&null!=y&&e("div",{children:[t("span",{style:wl,children:"sum:"}),_l(y)]}),"mean"===v&&null!=p&&e("div",{children:[t("span",{style:wl,children:"mean:"}),_l(p)]})]})}}({timeAccessor:b,valueAccessor:k}),tt=o(null),{customHoverBehavior:et}=vl({selection:Y,linkedHover:F,unwrapData:!0,onObservation:j,chartType:"RealtimeHeatmap",chartId:B}),nt=a(t=>{D&&D(t),et(t)},[D,et]);y(i,()=>({push:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=tt.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=tt.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=tt.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const it=Tl(H,Q[0],Q[1],X),ot=it?null:Cl(x,Q[0],Q[1],G),rt=V?`${g||""} semiotic-emphasis-${V}`.trim():g,lt=El(m,x);return it||ot||t(yo,{ref:tt,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:Z,className:rt,arrowOfTime:p,windowMode:v,windowSize:lt,data:x,timeAccessor:b,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:_,extentPadding:S,heatmapXBins:M,heatmapYBins:P,heatmapAggregation:C,showAxes:U,background:T,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:nt,annotations:L,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:I,decay:W,pulse:z,staleness:R,legendPosition:q,pointIdAccessor:n.pointIdAccessor})});$l.displayName="RealtimeHeatmap";const Il=Symbol("semiotic.useStreamStatus.wrapped");function Wl(t={}){const{staleThresholdMs:e=5e3,pollIntervalMs:n=1e3}=t,i=o(null),[s,c]=d("idle"),[u,h]=d(null),f=r(()=>{const t={_frame:null,_origPush:null,_origPushMany:null};return{get current(){return t._frame},set current(e){const n=t._frame;if(n&&n!==e&&t._origPush&&t._origPushMany&&(n.push=t._origPush,n.pushMany=t._origPushMany,delete n[Il]),t._frame=e,!e)return t._origPush=null,void(t._origPushMany=null);if(e[Il])return;e[Il]=!0;const i=e.push,o=e.pushMany,r=i.bind(e),l=o.bind(e);t._origPush=i,t._origPushMany=o,e.push=t=>(g(),r(t)),e.pushMany=t=>(t&&t.length>0&&g(),l(t))}}},[]),g=a(()=>{const t="undefined"!=typeof performance?performance.now():Date.now();i.current=t,h(t),c(t=>"active"===t?t:"active")},[]);return l(()=>{const t=setInterval(()=>{const t=i.current;if(null==t)return;const n=("undefined"!=typeof performance?performance.now():Date.now())-t>e;c(t=>{const e=n?"stale":"active";return t===e?t:e})},n);return()=>clearInterval(t)},[e,n]),{ref:f,status:s,lastPushTime:u}}export{Pt as IncrementalExtent,$l as RealtimeHeatmap,Dl as RealtimeHistogram,Ol as RealtimeLineChart,Ll as RealtimeSwarmChart,Nl as RealtimeWaterfallChart,Mt as RingBuffer,ll as StreamNetworkFrame,yo as StreamXYFrame,Wl as useStreamStatus};
2
+ import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRef as o,useMemo as r,useEffect as l,useContext as s,useCallback as a,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as f,useId as g,useImperativeHandle as y}from"react";import{select as p}from"d3-selection";import{brushX as v,brushY as m,brush as x}from"d3-brush";import{scaleLinear as b,scaleLog as k,scaleTime as w}from"d3-scale";import{quadtree as A}from"d3-quadtree";import{curveNatural as S,curveBasis as M,curveStepAfter as _,curveStepBefore as P,curveStep as C,curveCatmullRom as T,curveCardinal as E,curveMonotoneY as O,curveMonotoneX as D,line as L,area as N,curveLinear as $,arc as I,pie as W}from"d3-shape";import{bin as z,min as R,groups as F,max as Y,sum as j,mean as B,group as H}from"d3-array";import{packEnclose as X,hierarchy as G,partition as V,pack as q,treemap as U,treemapBinary as K,cluster as Z,tree as Q}from"d3-hierarchy";import J from"regression";import{interpolateNumber as tt}from"d3-interpolate";import{forceLink as et,forceSimulation as nt,forceManyBody as it,forceCenter as ot,forceX as rt,forceY as lt}from"d3-force";import{ribbon as st,chord as at}from"d3-chord";function ct(t,e){let n=0,i=e.length-1;for(;i>n;){const o=n+i+1>>1;e[o]>t?i=o-1:n=o}return e[n]}function ut(t,e){let n=0,i=e.length-1;for(;i>n;){const o=n+i>>1;t>e[o]?n=o+1:i=o}return e[n]}function dt({width:e,height:n,totalWidth:i,totalHeight:s,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:g,snapDuring:y,streaming:b}){const k=o(null),w=o(null),A=o(d);A.current=d;const S=o(u);S.current=u;const M=r(()=>g?[...g].sort((t,e)=>t-e):void 0,[g]),_=o(M);_.current=M;const P=o(!1),C=o(null);return l(()=>{if(!k.current)return;const t=p(k.current).select(".brush-g"),i="x"===c?v():"y"===c?m():x();return i.extent([[0,0],[e,n]]),i.on("brush end",o=>{if(P.current)return;const r=S.current;if(!r)return;if(!o.selection)return C.current=null,void A.current(null);let l,s;if("x"===c){const[t,e]=o.selection;l=[r.x.invert(t),r.x.invert(e)],s=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[t,n]=o.selection;l=[r.x.invert(0),r.x.invert(e)],s=[r.y.invert(n),r.y.invert(t)]}else{const[[t,e],[n,i]]=o.selection;l=[r.x.invert(t),r.x.invert(n)],s=[r.y.invert(i),r.y.invert(e)]}if("bin"===f&&"y"!==c&&("end"===o.type||"brush"===o.type&&y)){const e=_.current;e&&e.length>0?l=function(t,e){return 0===e.length?t:[ct(t[0],e),ut(t[1],e)]}(l,e):h&&h>0&&(l=[Math.floor(l[0]/h)*h,Math.ceil(l[1]/h)*h]);const n=r.x(l[0]),s=r.x(l[1]);if(P.current=!0,"x"===c)t.call(i.move,[n,s]);else if("xy"===c){const e=o.selection;t.call(i.move,[[n,e[0][1]],[s,e[1][1]]])}P.current=!1}const a={x:l,y:s};C.current=a,A.current(a)}),t.call(i),w.current=i,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null),w.current=null}},[e,n,c,f,h,y]),l(()=>{if(!(b&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const t=C.current,e=u.x.domain()[0],n=p(k.current).select(".brush-g");if(e>=t.x[1])return P.current=!0,n.call(w.current.move,null),P.current=!1,C.current=null,void A.current(null);let i=t.x[0],o=!1;if(e>t.x[0]){if(i=e,"bin"===f){const t=_.current;t&&t.length>0?i=ut(e,t):h&&h>0&&(i=Math.ceil(e/h)*h)}if(i>=t.x[1])return P.current=!0,n.call(w.current.move,null),P.current=!1,C.current=null,void A.current(null);o=!0}const r=u.x(i),l=u.x(t.x[1]);if(P.current=!0,"x"===c)n.call(w.current.move,[r,l]);else{const e=u.y(t.y[1]),i=u.y(t.y[0]);n.call(w.current.move,[[r,e],[l,i]])}if(P.current=!1,o){const e={x:[i,t.x[1]],y:t.y};C.current=e,A.current(e)}},[u,b,c,f,h]),t("svg",{ref:k,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const ht=Object.freeze([]);function ft(t){if(!t)return ht;let e=!1;for(let n=0;t.length>n;n++){const i=t[n];if(null==i||"object"!=typeof i){e=!0;break}}if(!e)return t;const n=[];for(const e of t)null!=e&&"object"==typeof e&&n.push(e);return n}class gt{constructor(t,e){var n,i;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=null!==(n=null==e?void 0:e.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(i=null==e?void 0:e.chunkSize)&&void 0!==i?i:5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=ft(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=ft(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const i=t[n];null!=i&&"object"==typeof i&&(this.pushBuffer.push(i),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function yt(e){let n=null;const i=()=>(n||(n=u(null)),n),l=pt(e);return[function({children:n,initialState:l}){const s=o(l),a=r(()=>pt(e,s.current),[]),c=i();return t(c.Provider,{value:a,children:n})},t=>{var e;const n=i(),r=null!==(e=s(n))&&void 0!==e?e:l,u=o(t);u.current=t;const d=a(()=>u.current(r.getState()),[r]),h=a(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function pt(t,e){const n=new EventTarget;let i=Object.assign(Object.assign({},t(function(t){i=Object.assign(Object.assign({},i),t(i)),n.dispatchEvent(new Event("update"))})),null!=e?e:{});return{getState:()=>i,subscribe:function(t){return n.addEventListener("update",t),()=>n.removeEventListener("update",t)}}}function vt(t){if(!(null==t?void 0:t.colors))return;const e=t.colors;return{primary:e.primary,secondary:e.secondary||e.primary,surface:e.surface||e.background,success:e.success,danger:e.danger,warning:e.warning,error:e.error,info:e.info,text:e.text,textSecondary:e.textSecondary,border:e.border,grid:e.grid}}function mt(t){if(!t.accessibility)return t;let e=t;if(t.accessibility.colorBlindSafe&&(e=Object.assign(Object.assign({},e),{colors:Object.assign(Object.assign({},e.colors),{categorical:xt})})),t.accessibility.highContrast){const t="dark"===e.mode;e=Object.assign(Object.assign({},e),{colors:Object.assign(Object.assign({},e.colors),{text:t?"#ffffff":"#000000",textSecondary:t?"#cccccc":"#333333",grid:t?"#666666":"#999999",border:t?"#888888":"#000000"})})}return e}const xt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],bt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},wt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function At(t,e){if("light"===e)return bt;if("dark"===e)return kt;if("high-contrast"===e)return wt;if("string"==typeof e)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${e}". Keeping current theme.`),t;if(e.mode&&"auto"!==e.mode){const t="dark"===e.mode?kt:bt;return mt(Object.assign(Object.assign(Object.assign({},t),e),{colors:Object.assign(Object.assign({},t.colors),e.colors||{}),typography:Object.assign(Object.assign({},t.typography),e.typography||{})}))}return mt(Object.assign(Object.assign(Object.assign({},t),e),{colors:Object.assign(Object.assign({},t.colors),e.colors||{}),typography:Object.assign(Object.assign({},t.typography),e.typography||{})}))}const[St,Mt]=yt(t=>({theme:bt,setTheme(e){t(t=>({theme:At(t.theme,e)}))}}));class _t{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const n of t){const t=this.push(n);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+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 t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const e=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)t(this.buffer[(e+n)%this._capacity],n)}toArray(){const t=Array(this._size),e=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)t[n]=this.buffer[(e+n)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray(),n=[];for(;e.length>t;)n.push(e.shift());this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(const t of e)this.push(t);return n}update(t,e){const n=[],i=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const r=(i+o)%this._capacity,l=this.buffer[r];if(t(l)){let t;t="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(t),this.buffer[r]=e(l)}}return n}remove(t){const e=[],n=[];if(this.forEach(i=>{t(i)?n.push(i):e.push(i)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of e)this.push(t);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 Pt{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}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 Ct(t,e,n,i,o){const r=new Map;for(const l of t){const t=e(l),s=n(l);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const a=Math.floor(t/i)*i;let c=r.get(a);if(c||(c={start:a,end:a+i,total:0,categories:new Map},r.set(a,c)),c.total+=s,o){const t=o(l);c.categories.set(t,(c.categories.get(t)||0)+s)}}return r}function Tt(t,e,n,i,o,r){const l=[];for(const o of t){const t=n(o),r=i(o);Number.isFinite(t)&&Number.isFinite(r)&&l.push({px:e.x(t),py:e.y(r),rawY:r,d:o})}l.sort((t,e)=>t.px-e.px);const s=Array(l.length),a=Array(l.length),c=Array(l.length);for(let t=0;l.length>t;t++){const e=l[t];s[t]=[e.px,e.py],a[t]=e.rawY,c[t]=e.d}return{type:"line",path:s,rawValues:a,style:o,datum:c,group:r}}function Et(t,e,n,i,o,r,l,s){const a=[];for(const r of t){const t=n(r),l=i(r);if(!Number.isFinite(t)||!Number.isFinite(l))continue;const c=e.x(t),u=s?s(r):o;a.push({px:c,topY:e.y(l),botY:e.y(u)})}a.sort((t,e)=>t.px-e.px);const c=Array(a.length),u=Array(a.length);for(let t=0;a.length>t;t++){const e=a[t];c[t]=[e.px,e.topY],u[t]=[e.px,e.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:t,group:l}}function Ot(t,e,n,i){var o,r,l;const s=new Map;if("silhouette"===i)for(const i of t){let t=0;for(const o of e)t+=n(o,i)||0;s.set(i,-t/2)}else if("wiggle"===i){t.length>0&&s.set(t[0],0);for(let i=1;t.length>i;i++){const r=t[i-1],l=t[i];let a=0,c=0,u=0;for(const t of e){const e=n(t,l)||0;a+=(2*u+e)*(e-(n(t,r)||0)),c+=e,u+=e}const d=null!==(o=s.get(r))&&void 0!==o?o:0;s.set(l,d-(c>0?a/(2*c):0))}if(t.length>0){let i=0;for(const o of t){let t=0;for(const i of e)t+=n(i,o)||0;i+=(null!==(r=s.get(o))&&void 0!==r?r:0)+t/2}const o=i/t.length;for(const e of t)s.set(e,(null!==(l=s.get(e))&&void 0!==l?l:0)-o)}}else for(const e of t)s.set(e,0);return s}function Dt(t,e,n,i,o,r,l){const s=n(t),a=i(t);if(!Number.isFinite(s)||!Number.isFinite(a))return null;const c={type:"point",x:e.x(s),y:e.y(a),r:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function Lt(t,e,n,i,o,r,l){return{type:"rect",x:t,y:e,w:n,h:i,style:o,datum:r,group:l}}function Nt(t,e,n,i,o,r,l){const s={type:"heatcell",x:t,y:e,w:n,h:i,fill:o,datum:r};return(null==l?void 0:l.showValues)&&(s.showValues=!0,s.value=l.value,l.valueFormat&&(s.valueFormat=l.valueFormat)),s}function $t(t,e){return t===e||typeof t==typeof e&&"function"==typeof t&&"function"==typeof e&&""+t==""+e}function It(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function Wt(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function zt(t,e){return"function"==typeof t?t:t?e=>e[t]+"":void 0}function Rt(t){return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]}function Ft(t,e,n){const i=t=>t.toString(16).padStart(2,"0");return`#${i(t)}${i(e)}${i(n)}`}function Yt(t){const e=t.map(Rt),n=e.length-1;return t=>{if(0>=t){const[t,n,i]=e[0];return Ft(t,n,i)}if(t>=1){const[t,i,o]=e[n];return Ft(t,i,o)}const i=t*n,o=Math.floor(i),r=i-o,[l,s,a]=e[o],[c,u,d]=e[o+1];return Ft(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}const jt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Bt=Yt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ht=Yt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Xt=Yt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Gt=Yt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Vt=Yt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),qt=Yt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Ut=Yt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Kt=Yt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Zt=Yt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Qt=Yt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Jt=Yt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),te=Yt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Yt(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Yt(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Yt(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Yt(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Yt(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const ee={category10:jt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Bt,reds:Ht,greens:Xt,oranges:Gt,purples:Vt,viridis:Ut,plasma:Kt},ne=jt,ie=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function oe(t,e,n){var i,o,r;if(1>=n)return 1;const l=null!==(i=t.minOpacity)&&void 0!==i?i:.1,s=n-1-e;switch(t.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const e=null!==(o=t.halfLife)&&void 0!==o?o:n/2;return l+Math.pow(.5,s/e)*(1-l)}case"step":return(null!==(r=t.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}function re(t,e,n){var i;const o=null!==(i=t.duration)&&void 0!==i?i:500,r=n-e;return o>r?1-r/o:0}function le(t,e="ease-out-cubic"){return"linear"===e?t:1-Math.pow(1-t,3)}function se(t,e){return Math.min((t-e.startTime)/e.duration,1)}function ae(t,e,n){return t+(e-t)*n}function ce(t,e,n){var i,o,r,l;if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const n=t.getX(e.datum),i=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${n}:${i}`;if(null!=n&&null!=i)return`p:${n}:${i}`}return"p:"+n;case"rect":return`r:${e.group||""}:${null!==(l=null!==(o=null===(i=e.datum)||void 0===i?void 0:i.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:n}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+n:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function ue(t,e,n,i){return"function"==typeof e.style?e.style(i||{},n):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(n,i)}function de(t,e,n,i){if(!t.scales)return null;const o=[],r=[];for(const n of e){const e=t.getX(n);if(!Number.isFinite(e))continue;const l=i.getTop(n),s=i.getBottom(n);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a=t.scales.x(e),c=t.scales.y(l),u=t.scales.y(s);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(o.push([a,c]),r.push([a,u]))}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:ue(t,i,n,e[0]),datum:e,group:n,interactive:i.interactive}}function he(t){const e=[],n=[];if(!t)return{perSeries:e,aggregate:n};for(const i of t)i.perSeries?e.push(i):n.push(i);return{perSeries:e,aggregate:n}}function fe(t,e,n){const i=[];for(const o of n){const n=de(t,e,"__ribbon_aggregate",o);n&&i.push(n)}return i}function ge(t,e,n,i){const o=[];for(const r of i){const i=de(t,e,n,r);i&&o.push(i)}return o}function ye(t,e){if(!t)return{};if(!e||0===e.length)return t;const n=[];for(const i of e){if("band"!==i.kind)continue;const e=i.getTop(t),o=i.getBottom(t);Number.isFinite(o)&&Number.isFinite(e)&&n.push({y0:o,y1:e})}return 0===n.length?t:Object.assign(Object.assign({},t),{band:n[0],bands:n})}function pe(t,e,n,i){var o;if(!t.config.pointStyle)return;const r=null!=i?i:t.getY;for(const i of e){const e=t.resolveGroupColor(i.key);for(const l of i.data){let i=t.config.pointStyle(l);!i.fill&&e&&(i=Object.assign(Object.assign({},i),{fill:e}));const s=null!==(o=i.r)&&void 0!==o?o:3,a=t.getPointId?t.getPointId(l)+"":void 0,c=Dt(l,t.scales,t.getX,r,s,i,a);c&&n.push(c)}}}const ve={topOpacity:.8,bottomOpacity:.05};function me(t){var e,n;if(t)return!0===t?ve:"colorStops"in t?t:{topOpacity:null!==(e=t.topOpacity)&&void 0!==e?e:ve.topOpacity,bottomOpacity:null!==(n=t.bottomOpacity)&&void 0!==n?n:ve.bottomOpacity}}const xe={blues:Bt,reds:Ht,greens:Xt,viridis:Ut,oranges:Gt,purples:Vt,greys:qt,plasma:Kt,inferno:Zt,magma:Qt,cividis:Jt,turbo:te},be=new Map;function ke(t,e){const n="function"==typeof t?t:n=>n[t||e];return t=>{const e=n(t);return null==e?NaN:+e}}function we(t){const e=[],n=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,i=ke(n&&t.valueAccessor||t.yAccessor,n?"value":"y");if(t.boundsAccessor){const n=It(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e+o:e},getBottom:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e-o:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const n=Array.isArray(t.band)?t.band:[t.band];for(const t of n)e.push({kind:"band",getTop:ke(t.y1Accessor,"y1"),getBottom:ke(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}class Ae{constructor(t){if(this.xExtent=new Pt,this.yExtent=new Pt,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=t,this.buffer=new _t(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=It(t.timeAccessor||t.xAccessor,"time"),this.getY=It(t.valueAccessor||t.yAccessor,"value")):(this.getX=It(t.xAccessor,"x"),this.getY=It(t.yAccessor,"y")),this.getGroup=zt(t.groupAccessor),this.getCategory=zt(t.categoryAccessor),this.getSize=t.sizeAccessor?It(t.sizeAccessor,"size"):void 0,this.getColor=zt(t.colorAccessor),this.getY0=t.y0Accessor?It(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=we(t),this.getPointId=zt(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,n=null!=t.closeAccessor;this.getOpen=e?It(t.openAccessor,"open"):void 0,this.getHigh=It(t.highAccessor,"high"),this.getLow=It(t.lowAccessor,"low"),this.getClose=n?It(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!n}t.pulse&&(this.timestampBuffer=new _t(t.windowSize))}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(i)&&this.yExtent.push(i)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return!1;const e="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){if(this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?It(this.config.timeAccessor||this.config.xAccessor,"time"):It(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],n=this.config.xAccessor,i="function"==typeof n?n(e):e[n||"x"],o=i instanceof Date,r="string"==typeof i&&i.length>=10&&!isNaN(new Date(i).getTime())&&isNaN(Number(i));if(this.xIsDate=o||r,r){const t="string"==typeof n?n:void 0;this.getX=t?e=>+new Date(e[t]):t=>+(n(t)instanceof Date?n(t):new Date(n(t)))}}const n=t.totalSize||t.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of t.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(e),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));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const t of this.resolvedRibbons){const e=t.getTop(n),i=t.getBottom(n);Number.isFinite(e)&&this.yExtent.push(e),Number.isFinite(i)&&this.yExtent.push(i)}}}else for(const n of t.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity||1e6;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const t=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(e),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));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const t of this.resolvedRibbons){const e=t.getTop(n),i=t.getBottom(n);Number.isFinite(e)&&this.yExtent.push(e),Number.isFinite(i)&&this.yExtent.push(i)}}if(null!=t)if(this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t));else{this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(i)&&this.yExtent.evict(i)}}}return!0}computeScene(t){var e,n,i,o,r,l,s,a,c,u,d,h,f,g;const{config:y,buffer:p}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(e=this.config.scalePadding)&&void 0!==e?e:0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(p,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),m=this.xExtent.extent,x=this.yExtent.extent;let A=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:m[0],null!==(i=y.xExtent[1])&&void 0!==i?i:m[1]]:m,S=y.yExtent?[null!==(o=y.yExtent[0])&&void 0!==o?o:x[0],null!==(r=y.yExtent[1])&&void 0!==r?r:x[1]]:x;const M=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],_="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!M&&p.size>0)if(y.normalize)S=[0,_?1:1+y.extentPadding];else{const t=`${p.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(s=y.stackOrder)&&void 0!==s?s:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===t)S=this._stackExtentCache.yDomain;else{const e=this.groupData(v),n=new Map,i=new Set;let o=0;const r=new Map,l=new Map;for(const t of e){const e=new Map;let s=0;for(const n of t.data){const t=this.getX(n),l=this.getY(n);if(!Number.isFinite(t)||!Number.isFinite(l))continue;e.set(t,(e.get(t)||0)+l),i.add(t),s+=l;const a=(r.get(t)||0)+l;r.set(t,a),a>o&&(o=a)}n.set(t.key,e),l.set(t.key,s)}const s=null!==(a=y.stackOrder)&&void 0!==a?a:"key",f=(t,e)=>e>t?-1:t>e?1:0;let g;if("insideOut"===s){const t=[...e].map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(e))&&void 0!==n?n:0)-(null!==(i=l.get(t))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}),n=[],i=[];let o=0,r=0;for(const e of t)r>o?(n.push(e),o+=null!==(c=l.get(e))&&void 0!==c?c:0):(i.push(e),r+=null!==(u=l.get(e))&&void 0!==u?u:0);g=[...i.reverse(),...n]}else g="asc"===s?e.map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(t))&&void 0!==n?n:0)-(null!==(i=l.get(e))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}):"desc"===s?e.map(t=>t.key).sort((t,e)=>{var n,i;const o=(null!==(n=l.get(e))&&void 0!==n?n:0)-(null!==(i=l.get(t))&&void 0!==i?i:0);return 0!==o?o:f(t,e)}):e.map(t=>t.key).sort(f);if("wiggle"===y.baseline||"silhouette"===y.baseline){const t=Array.from(i).sort((t,e)=>t-e),e=Ot(t,g,(t,e)=>{var i;return(null===(i=n.get(t))||void 0===i?void 0:i.get(e))||0},y.baseline);let o=1/0,l=-1/0;for(const n of t){const t=null!==(d=e.get(n))&&void 0!==d?d:0,i=null!==(h=r.get(n))&&void 0!==h?h:0;o>t&&(o=t),t+i>l&&(l=t+i)}Number.isFinite(o)&&Number.isFinite(l)||(o=0,l=0);const s=l-o,a=_?0:s>0?s*y.extentPadding:1;S=[o-a,l+a]}else S=[0,o+(_?0:o>0?o*y.extentPadding:1)];this._stackExtentCache={key:t,yDomain:S}}}else if("bar"===y.chartType&&y.binSize&&!M&&p.size>0){const[,t]=function(t,e,n,i,o){const r=Ct(t,e,n,i,o);if(0===r.size)return[0,0];let l=0;for(const t of r.values())t.total>l&&(l=t.total);return[0,l]}(p,this.getX,this.getY,y.binSize,this.getCategory);S=[0,_?t:t+t*y.extentPadding]}else if("waterfall"===y.chartType&&!M&&p.size>0){const[t,e]=function(t,e){let n=0,i=0,o=0;for(const r of t){const t=e(r);null==t||Number.isNaN(t)||(o+=t,n>o&&(n=o),o>i&&(i=o))}return[n,i]}(p,this.getY),n=e-t,i=_?0:n>0?n*y.extentPadding:1;S=[Math.min(0,t-Math.abs(i)),Math.max(0,e+Math.abs(i))]}else if(!M&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const t of v)for(const e of this.resolvedRibbons){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n)),Number.isFinite(i)&&(S[0]>i&&(S[0]=i),i>S[1]&&(S[1]=i))}const t=S[1]-S[0],e=_?0:t>0?t*y.extentPadding:1,n=null===(f=y.yExtent)||void 0===f?void 0:f[0],i=null===(g=y.yExtent)||void 0===g?void 0:g[1];S=[null!=n?S[0]:S[0]-e,null!=i?S[1]:S[1]+e],"log"!==y.yScaleType||S[0]>0||0>=x[0]||_||(S[0]=null!=n?S[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!M){const t=y.yExtent[0],e=y.yExtent[1];null==t&&null==e||(S=[null!=t?t:S[0],null!=e?e:S[1]])}if(A[0]===1/0||A[1]===-1/0)if("time"===y.xScaleType){const t=Date.now();A=[t-864e5,t]}else A=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const P="streaming"===y.runtimeMode,C=Math.max(0,Math.min(y.scalePadding||0,Math.min(t.width,t.height)/2-1));if(P)if("x"==("up"===(T=y.arrowOfTime)||"down"===T?"y":"x")){const e="right"===y.arrowOfTime?[C,t.width-C]:[t.width-C,C];this.scales={x:b().domain(A).range(e),y:b().domain(S).range([t.height-C,C])}}else{const e="down"===y.arrowOfTime?[C,t.height-C]:[t.height-C,C];this.scales={x:b().domain(S).range([C,t.width-C]),y:b().domain(A).range(e)}}else{const e=(t,e,n)=>{if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return k().domain(t).range(n).clamp(!0)}return"time"===t?w().domain([new Date(e[0]),new Date(e[1])]).range(n):b().domain(e).range(n)};this.scales={x:e(y.xScaleType,A,[C,t.width-C]),y:e(y.yScaleType,S,[t.height-C,C])}}var T;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(t,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}rebuildQuadtree(){const t=this.config.chartType;if("scatter"!==t&&"bubble"!==t)return this._quadtree=null,void(this._maxPointRadius=0);let e=0,n=0;for(const t of this.scene)"point"===t.type&&(e++,t.r>n&&(n=t.r));if(this._maxPointRadius=n,Ae.QUADTREE_THRESHOLD>=e)return void(this._quadtree=null);const i=Array(e);let o=0;for(const t of this.scene)"point"===t.type&&(i[o++]=t);this._quadtree=A().x(t=>t.x).y(t=>t.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,n=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const i of t.path)i[0]*=e,i[1]*=n;break;case"area":for(const i of t.topPath)i[0]*=e,i[1]*=n;for(const i of t.bottomPath)i[0]*=e,i[1]*=n;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*n,width:t.clipRect.width*e,height:t.clipRect.height*n});break;case"point":t.x*=e,t.y*=n;break;case"rect":case"heatcell":t.x*=e,t.y*=n,t.w*=e,t.h*=n;break;case"candlestick":t.x*=e,t.openY*=n,t.closeY*=n,t.highY*=n,t.lowY*=n}const i=this.scales.x.domain(),o=this.scales.y.domain(),r=this.scales.x.range(),l=this.scales.y.range(),s=(t,e,n)=>{if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return k().domain(t).range(n).clamp(!0)}return"time"===t?w().domain([new Date(e[0]),new Date(e[1])]).range(n):b().domain(e).range(n)},a=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=l[1]>l[0];this.scales={x:s(this.config.xScaleType,i,r[0]>r[1]?[t.width-a,a]:[a,t.width-a]),y:s(this.config.yScaleType,o,c?[a,t.height-a]:[t.height-a,a])},this.lastLayout={width:t.width,height:t.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(t,e){var n,i,o,r,l,s,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},d={data:e,scales:u,dimensions:{width:t.width,height:t.height,margin:a,plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(i=c.themeSemantic)&&void 0!==i?i:{},categorical:null!==(o=c.themeCategorical)&&void 0!==o?o:ie},resolveColor:(t,e)=>{var n,i;const o=this.resolveGroupColor(t);if(o)return o;const r=this.resolveLineStyle(t,e);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(i=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==i?i:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(t){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(l=h.overlays)&&void 0!==l?l:null,null!==(s=h.nodes)&&void 0!==s?s:[]}if(this.customLayoutOverlays=null,0===e.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(t,e){var n;const i=t.groupData(e),o=[],r=null===(n=t.config.annotations)||void 0===n?void 0:n.filter(t=>"threshold"===t.type&&t.color).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:n,aggregate:r}=he(t.ribbons);if(r.length>0&&o.push(...fe(t,e,r)),n.length>0)for(const e of i)o.push(...ge(t,e.data,e.key,n))}for(const e of i){const n=t.resolveLineStyle(e.key,e.data[0]),i=Tt(e.data,t.scales,t.getX,t.getY,n,e.key);r&&r.length>0&&(i.colorThresholds=r),t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),o.push(i)}return pe(t,i,o),o}(d,e);case"area":return function(t,e){const n=t.groupData(e),i=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:r}=he(t.ribbons);if(r.length>0&&i.push(...fe(t,e,r)),o.length>0)for(const e of n)i.push(...ge(t,e.data,e.key,o))}const o=t.scales.y.domain()[0],r=t.getY0?e=>{const n=t.getY0(e);return null==n?o:n}:void 0;for(const e of n){const n=t.resolveAreaStyle(e.key,e.data[0]),l=Et(e.data,t.scales,t.getX,t.getY,o,n,e.key,r),s=me(t.config.gradientFill);s&&(l.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(l.curve=t.config.curve),t.config.lineGradient&&(l.strokeGradient=t.config.lineGradient),i.push(l)}return pe(t,n,i),i}(d,e);case"mixed":return function(t,e){const n=t.groupData(e),i=[],o=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:r}=he(t.ribbons);if(r.length>0&&i.push(...fe(t,e,r)),o.length>0)for(const e of n)i.push(...ge(t,e.data,e.key,o))}const r=t.scales.y.domain()[0],l=t.getY0?e=>{const n=t.getY0(e);return null==n?r:n}:void 0;for(const e of n)if(o.has(e.key)){const n=t.resolveAreaStyle(e.key,e.data[0]),o=Et(e.data,t.scales,t.getX,t.getY,r,n,e.key,l),s=me(t.config.gradientFill);s&&(o.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),i.push(o)}else{const n=t.resolveLineStyle(e.key,e.data[0]),o=Tt(e.data,t.scales,t.getX,t.getY,n,e.key);t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),i.push(o)}return pe(t,n,i),i}(d,e);case"stackedarea":return function(t,e){var n,i,o,r;const l=t.groupData(e),s=null!==(n=t.config.stackOrder)&&void 0!==n?n:"key",a=()=>l.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("key"===s)a();else if("asc"===s||"desc"===s||"insideOut"===s){const e=new Map;for(const n of l){let i=0;for(const e of n.data){const n=t.getX(e),o=t.getY(e);Number.isFinite(n)&&Number.isFinite(o)&&(i+=o)}e.set(n.key,i)}const n=(t,e)=>e>t?-1:t>e?1:0;if("asc"===s)l.sort((t,i)=>{var o,r;const l=(null!==(o=e.get(t.key))&&void 0!==o?o:0)-(null!==(r=e.get(i.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)});else if("desc"===s)l.sort((t,i)=>{var o,r;const l=(null!==(o=e.get(i.key))&&void 0!==o?o:0)-(null!==(r=e.get(t.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)});else{const t=[...l].sort((t,i)=>{var o,r;const l=(null!==(o=e.get(i.key))&&void 0!==o?o:0)-(null!==(r=e.get(t.key))&&void 0!==r?r:0);return 0!==l?l:n(t.key,i.key)}),r=[],s=[];let a=0,c=0;for(const n of t)c>a?(r.push(n),a+=null!==(i=e.get(n.key))&&void 0!==i?i:0):(s.push(n),c+=null!==(o=e.get(n.key))&&void 0!==o?o:0);l.length=0,l.push(...s.reverse(),...r)}}else a();const c=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,u=t.config.normalize?"zero":null!==(r=t.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(t,e,n,i,o,r,l,s="zero"){var a,c;const u=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&u.add(e)}const d=Array.from(u).sort((t,e)=>t-e),h=new Map;for(const e of t){const t=new Map;for(const o of e.data){const e=n(o),r=i(o);Number.isFinite(e)&&Number.isFinite(r)&&t.set(e,(t.get(e)||0)+r)}h.set(e.key,t)}let f;if(r){f=new Map;for(const e of d){let n=0;for(const i of t)n+=(null===(a=h.get(i.key))||void 0===a?void 0:a.get(e))||0;f.set(e,n||1)}}const g=Ot(d,t.map(t=>t.key),(t,e)=>{var n;return(null===(n=h.get(t))||void 0===n?void 0:n.get(e))||0},s),y=[],p=new Map,v=new Map;for(const t of d)v.set(t,null!==(c=g.get(t))&&void 0!==c?c:0);for(const n of t){const t=h.get(n.key),i=[],s=[],a=new Map;for(const n of d){let o=t.get(n)||0;const l=v.get(n);r&&(o/=f.get(n));const c=l+o,u=e.x(n);s.push([u,e.y(l)]),i.push([u,e.y(c)]),v.set(n,c),a.set(n,c)}p.set(n.key,a);const c={type:"area",topPath:i,bottomPath:s,style:o(n.key,n.data[0]),datum:n.data,group:n.key};l&&(c.curve=l),y.push(c)}return{nodes:y,stackedTops:p}}(l,t.scales,t.getX,t.getY,(e,n)=>t.resolveAreaStyle(e,n),t.config.normalize,c,u),f=d;if(t.config.pointStyle){const e=new WeakMap;for(const n of l){const i=h.get(n.key);if(i)for(const o of n.data){const n=t.getX(o),r=t.getY(o);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!i.has(n)||e.set(o,i.get(n))}}const n=n=>{var i;return null!==(i=e.get(n))&&void 0!==i?i:t.getY(n)};pe(t,l,f,n)}return f}(d,e);case"scatter":case"bubble":return function(t,e){var n;const i=[],o="bubble"===t.config.chartType?10:5,r=t.config.sizeRange||[3,15];let l=null;if(t.getSize&&!t.config.pointStyle){const n=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(n.length>0){let t=1/0,e=-1/0;for(const i of n)t>i&&(t=i),i>e&&(e=i);l=n=>t===e?(r[0]+r[1])/2:r[0]+(n-t)/(e-t)*(r[1]-r[0])}}const s=t.getColor?t.resolveColorMap(e):null,a=(null===(n=t.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of e){let e=t.config.pointStyle?t.config.pointStyle(n):{fill:a,opacity:.8},r=e.r||o;if(l&&t.getSize){const e=t.getSize(n);null==e||Number.isNaN(e)||(r=l(e))}if(s&&t.getColor&&!e.fill){const i=t.getColor(n);i&&s.has(i)&&(e=Object.assign(Object.assign({},e),{fill:s.get(i)}))}const c=t.getPointId?t.getPointId(n)+"":void 0,u=Dt(n,t.scales,t.getX,t.getY,r,e,c);u&&i.push(u)}return i}(d,e);case"heatmap":return function(t,e,n){if(t.config.heatmapAggregation)return function(t,e,n){var i,o,r;const l=Math.max(1,Math.floor(null!==(i=t.config.heatmapXBins)&&void 0!==i?i:20)),s=Math.max(1,Math.floor(null!==(o=t.config.heatmapYBins)&&void 0!==o?o:20)),a=null!==(r=t.config.heatmapAggregation)&&void 0!==r?r:"count",c=It(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[u,d]=t.scales.x.domain(),[h,f]=t.scales.y.domain(),g=(d-u||1)/l,y=(f-h||1)/s,p=l*s;if(p>1e6)return[];const v=new Int32Array(p),m=new Float64Array(p);for(let n=0;e.length>n;n++){const i=e[n],o=t.getX(i),r=t.getY(i);if(!isFinite(o)||!isFinite(r))continue;const a=Math.min(Math.floor((o-u)/g),l-1),d=Math.min(Math.floor((r-h)/y),s-1);if(0>a||0>d)continue;const f=d*l+a;v[f]++;const p=c(i);m[f]+=isFinite(p)?p:0}let x=1/0,b=-1/0;for(let t=0;p>t;t++){if(0===v[t])continue;let e;switch(a){case"sum":e=m[t];break;case"mean":e=m[t]/v[t];break;default:e=v[t]}x>e&&(x=e),e>b&&(b=e)}if(!isFinite(x))return[];const k=b-x||1,w=n.width/l,A=n.height/s,S=t.config.showValues,M=t.config.heatmapValueFormat,_=[];for(let t=0;s>t;t++){const e=t*l;for(let n=0;l>n;n++){const i=e+n;if(0===v[i])continue;let o;switch(a){case"sum":o=m[i];break;case"mean":o=m[i]/v[i];break;default:o=v[i]}const r=(o-x)/k;_.push(Nt(n*w,(s-1-t)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:t,value:o,count:v[i],sum:m[i],xCenter:u+(n+.5)*g,yCenter:h+(t+.5)*y,agg:a},S?{value:o,showValues:!0,valueFormat:M}:void 0))}}return _}(t,e,n);if(0===e.length)return[];const i=It(t.config.valueAccessor,"value"),o=Wt(t.config.xAccessor,"x"),r=Wt(t.config.yAccessor,"y"),l=new Map,s=new Map,a=Array(e.length),c=Array(e.length);for(let t=0;e.length>t;t++){const n=e[t],i=o(n),u=r(n);a[t]=i,c[t]=u,l.has(i)||l.set(i,l.size),s.has(u)||s.set(u,s.size)}const u=l.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(l.keys()),f=Array.from(s.keys()),g=h.every(t=>"number"==typeof t&&!isNaN(t)),y=f.every(t=>"number"==typeof t&&!isNaN(t));if(g){h.sort((t,e)=>t-e),l.clear();for(let t=0;h.length>t;t++)l.set(h[t],t)}if(y){f.sort((t,e)=>t-e),s.clear();for(let t=0;f.length>t;t++)s.set(f[t],t)}const p=new Float64Array(e.length),v=new Float64Array(e.length),m=Array(e.length),x=new Map;let b=0;for(let t=0;e.length>t;t++){const n=e[t],o=l.get(a[t]),r=s.get(c[t]);if(void 0===o||void 0===r)continue;const d=i(n),h=r*u+o,f=x.get(h);let g;void 0!==f?g=f:(g=b++,x.set(h,g)),p[g]=h,v[g]=d,m[g]=n}let k=1/0,w=-1/0;for(let t=0;b>t;t++){const e=v[t];isFinite(e)&&(k>e&&(k=e),e>w&&(w=e))}if(!isFinite(k)||!isFinite(w))return[];const A=function(t){const e=t in xe?t:"blues";let n=be.get(e);if(n)return n;n=Array(256);const i=xe[e]||Bt;for(let t=0;256>t;t++)n[t]=i(t/255);return be.set(e,n),n}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),S=255/(w-k||1),M=n.width/u,_=n.height/d,P=t.config.showValues,C=t.config.heatmapValueFormat,T=[];for(let t=0;b>t;t++){const e=v[t];if(!isFinite(e))continue;const n=p[t],i=n%u;T.push(Nt(i*M,(d-1-(n-i)/u)*_,M,_,A[Math.min((e-k)*S+.5|0,255)],m[t],P?{value:e,showValues:!0,valueFormat:C}:void 0))}return T}(d,e,t);case"bar":{const t=function(t,e){var n,i;if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const o=Ct(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(t.getCategory){const e=new Set;for(const t of o.values())for(const n of t.categories.keys())e.add(n);const n=t.config.barColors?Object.keys(t.config.barColors):[],i=new Set(n),l=Array.from(e).filter(t=>!i.has(t)).sort(),s=n.filter(t=>e.has(t)),a=s.join("\0")+""+l.join("\0");t.barCategoryCache&&t.barCategoryCache.key===a?r=t.barCategoryCache.order:(r=[...s,...l],t.barCategoryCache={key:a,order:r})}const l=[],s=t.scales,[a,c]=s.x.domain(),u=t.config.barStyle,d=null===(n=t.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const e of o.values()){const n=Math.max(e.start,a),o=Math.min(e.end,c);if(n>=o)continue;const h=s.x(n),y=s.x(o),p=Math.abs(y-h),v=p>f+1?f:0,m=Math.min(h,y)+v/2,x=Math.max(p-v,1);if(x>0)if(r&&e.categories.size>0){let n=0;for(const o of r){const r=e.categories.get(o)||0;if(0===r)continue;const a=s.y(n),c=s.y(n+r),h=(null===(i=t.config.barColors)||void 0===i?void 0:i[o])||(null==u?void 0:u.fill)||d||"#4e79a7";l.push(Lt(m,Math.min(a,c),x,Math.abs(a-c),Object.assign({fill:h},g),{binStart:e.start,binEnd:e.end,total:e.total,category:o,categoryValue:r},o)),n+=r}}else{const t=s.y(0),n=s.y(e.total);l.push(Lt(m,Math.min(t,n),x,Math.abs(t-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:e.start,binEnd:e.end,total:e.total}))}}const y=new Set;for(const t of o.values())y.add(t.start),y.add(t.end);return{nodes:l,binBoundaries:Array.from(y).sort((t,e)=>t-e)}}(d,e);return this._barCategoryCache=null!==(a=d.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){var n,i,o,r,l,s;const a=[],c=t.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(i=c.fill)&&void 0!==i?i:null===(o=t.config.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==r?r:"#007bff",h=null!==(l=c.opacity)&&void 0!==l?l:.7,f=c.stroke,g=c.strokeWidth;for(const n of e){const e=t.getX(n),i=t.getY(n);if(null==i||Number.isNaN(i))continue;const o=t.scales.x(e),r=t.scales.y(i);let l=d;if(t.getCategory){const e=t.getCategory(n);l=(null===(s=t.config.barColors)||void 0===s?void 0:s[e])||l}const c={type:"point",x:o,y:r,r:u,style:{fill:l,opacity:h,stroke:f,strokeWidth:g},datum:n};t.getPointId&&(c.pointId=t.getPointId(n)+""),a.push(c)}return a}(d,e);case"waterfall":return function(t,e,n){var i,o,r,l,s,a,c;const u=[],d=t.scales,h=t.config.waterfallStyle,f=e.filter(e=>{const n=t.getY(e),i=t.getX(e);return null!=n&&!Number.isNaN(n)&&null!=i&&isFinite(i)});if(0===f.length)return u;const g=null!==(r=null!==(i=null==h?void 0:h.positiveColor)&&void 0!==i?i:null===(o=t.config.themeSemantic)||void 0===o?void 0:o.success)&&void 0!==r?r:"#28a745",y=null!==(a=null!==(l=null==h?void 0:h.negativeColor)&&void 0!==l?l:null===(s=t.config.themeSemantic)||void 0===s?void 0:s.danger)&&void 0!==a?a:"#dc3545",p=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,v=null==h?void 0:h.stroke,m=null==h?void 0:h.strokeWidth,x=null==h?void 0:h.opacity;let b=0;for(let e=0;f.length>e;e++){const i=f[e],o=t.getX(i),r=t.getY(i),l=b+r;let s;s=f.length-1>e?t.getX(f[e+1])-o:e>0?o-t.getX(f[e-1]):0;const a=d.x(o),c=0!==s?d.x(o+s):a+n.width/10,k=Math.min(a,c)+p/2,w=Math.max(a,c)-p/2-k;if(0>=w){b=l;continue}const A=d.y(b),S=d.y(l),M=Math.min(A,S),_=Math.abs(A-S),P={fill:0>r?y:g,stroke:v,strokeWidth:m};null!=x&&(P.opacity=x),u.push(Lt(k,M,w,_,P,Object.assign(Object.assign({},i),{baseline:b,cumEnd:l,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),b=l}return u}(d,e,t);case"candlestick":return function(t,e){var n,i;if(!t.getHigh||!t.getLow||!t.scales)return[];const o=null!==(n=t.config.candlestickRangeMode)&&void 0!==n&&n;if(!(o||t.getOpen&&t.getClose))return[];const r=[],l=t.config.candlestickStyle||{},s=l.rangeColor||"#6366f1",a=o?s:l.upColor||"#28a745",c=o?s:l.downColor||"#dc3545",u=o?s:l.wickColor||"#333",d=l.wickWidth||(o?2:1),h=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let f=null!==(i=l.bodyWidth)&&void 0!==i?i:0;if(null==l.bodyWidth)if(h.length>1){let e=1/0;for(let n=1;h.length>n;n++){const i=Math.abs(t.scales.x(h[n])-t.scales.x(h[n-1]));i>0&&e>i&&(e=i)}f=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else f=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const i=t.getHigh(n),l=t.getLow(n);if(null==i||Number.isNaN(i)||null==l||Number.isNaN(l))continue;const s=o?i:t.getOpen(n),h=o?l:t.getClose(n);if(!o&&[s,h].some(t=>null==t||Number.isNaN(t)))continue;const g=h>=s,y={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(s),closeY:t.scales.y(h),highY:t.scales.y(i),lowY:t.scales.y(l),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};o&&(y.isRange=!0),r.push(y)}return r}(d,e);default:return[]}}resolveBoundsStyle(t,e){var n;const i=this.config.boundsStyle;return"function"==typeof i?i(e||{},t):i&&"object"==typeof i?i:{fill:this.resolveLineStyle(t,e).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(t,e){const n=this.config.decay;return n&&e>1?oe(n,t,e):1}applyDecay(t,e){this.config.decay&&function(t,e,n){var i,o;const r=n.length;if(1>=r)return;const l=new Map;for(let t=0;n.length>t;t++)l.set(n[t],t);for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const i=Array(e.length);let o=!1;for(let n=0;e.length>n;n++){const s=l.get(e[n]);null!=s?(i[n]=oe(t,s,r),1>i[n]&&(o=!0)):i[n]=1}o&&(n._decayOpacities=i);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:e.length;if(2>i)continue;if(e.length===i){const o=Array(i);let s=!1;for(let n=0;e.length>n;n++){const i=l.get(e[n]);null!=i?(o[n]=oe(t,i,r),1>o[n]&&(s=!0)):o[n]=1}s&&(n._decayOpacities=o)}else{let o=1;for(const n of e){const e=l.get(n);if(null!=e){const n=oe(t,e,r);o>n&&(o=n)}}if(1>o){const t=Array(i);t.fill(o),n._decayOpacities=t}}continue}const e=l.get(n.datum);if(null==e)continue;const s=oe(t,e,r);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const t=null!==(o=null===(i=n.style)||void 0===i?void 0:i.opacity)&&void 0!==o?o:1;n.style=Object.assign(Object.assign({},n.style),{opacity:t*s})}}}(this.config.decay,t,e)}applyPulse(t,e){this.config.pulse&&this.timestampBuffer&&function(t,e,n,i){var o,r;const l="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=t.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",a=null!==(r=t.glowRadius)&&void 0!==r?r:4,c=new Map;for(let t=0;n.length>t;t++)c.set(n[t],t);for(const n of e){if("line"===n.type)continue;if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[n.datum];let o=0;for(const n of e){const e=c.get(n);if(null==e)continue;const r=i.get(e);if(null==r)continue;const s=re(t,r,l);s>o&&(o=s)}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=i.get(e);if(null==o)continue;const r=re(t,o,l);r>0&&(n._pulseIntensity=r,n._pulseColor=s,n._pulseGlowRadius=a)}}(this.config.pulse,t,e,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(t,e){var n;if(!e||0===e.size)return!1;const i="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(n=t.duration)&&void 0!==n?n:500,r=e.peek();return null!=r&&o>i-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,n,i){var o,r,l,s;n.clear(),i.clear();for(let a=0;e.length>a;a++){const c=e[a],u=ce(t,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(o=c.style)||void 0===o?void 0:o.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?i.set(u,{path:c.path.map(t=>[t[0],t[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}):"area"===c.type&&i.set(u,{topPath:c.topPath.map(t=>[t[0],t[1]]),bottomPath:c.bottomPath.map(t=>[t[0],t[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var t,e,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const i=null!==(e=null===(t=this.scales)||void 0===t?void 0:t.y(0))&&void 0!==e?e:0;for(let t=0;this.scene.length>t;t++){const e=this.scene[t],o=ce(this.transitionContext,e,t);o&&("point"===e.type?this.prevPositionMap.set(o,{x:e.x,y:e.y,r:0,opacity:0}):"rect"===e.type?this.prevPositionMap.set(o,{x:e.x,y:i,w:e.w,h:0,opacity:null!==(n=e.style.opacity)&&void 0!==n?n:1}):"heatcell"===e.type?this.prevPositionMap.set(o,{x:e.x,y:e.y,w:e.w,h:e.h,opacity:0}):"line"===e.type?(e._introClipFraction=0,this.prevPathMap.set(o,{path:e.path.map(t=>[t[0],t[1]]),opacity:e.style.opacity})):"area"===e.type&&(e._introClipFraction=0,this.prevPathMap.set(o,{topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),opacity:e.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,n,i,o){var r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,S,M,_,P,C,T,E,O,D,L,N,$,I,W,z,R,F,Y,j,B,H,X;if(0===i.size&&0===o.size)return n;const G=null!==(r=e.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let e=0;n.scene.length>e;e++){const r=n.scene[e],E=ce(t,r,e);if(!E)continue;if(r._transitionKey=E,"line"===r.type||"area"===r.type){const t=o.get(E);if(t){if(U.add(E),"line"===r.type&&t.path&&t.path.length===r.path.length){r._targetPath=r.path.map(t=>[t[0],t[1]]),r._prevPath=t.path;for(let e=0;r.path.length>e;e++)r.path[e]=[t.path[e][0],t.path[e][1]];V=!0}else if("area"===r.type&&t.topPath&&t.bottomPath&&t.topPath.length===r.topPath.length&&t.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(t=>[t[0],t[1]]),r._targetBottomPath=r.bottomPath.map(t=>[t[0],t[1]]),r._prevTopPath=t.topPath,r._prevBottomPath=t.bottomPath;for(let e=0;r.topPath.length>e;e++)r.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;r.bottomPath.length>e;e++)r.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];V=!0}r._targetOpacity=null!==(l=r.style.opacity)&&void 0!==l?l:1,r._startOpacity=null!==(a=null!==(s=t.opacity)&&void 0!==s?s:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const O=i.get(E);if("point"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,O.x===t.x&&O.y===t.y&&O.r===t.r||(r._targetX=t.x,r._targetY=t.y,r._targetR=t.r,r.x=O.x,r.y=O.y,r.r=null!==(d=O.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,O.x===t.x&&O.y===t.y&&O.w===t.w&&O.h===t.h||(r._targetX=t.x,r._targetY=t.y,r._targetW=t.w,r._targetH=t.h,r.x=O.x,r.y=O.y,r.w=null!==(g=O.w)&&void 0!==g?g:r.w,r.h=null!==(y=O.h)&&void 0!==y?y:r.h,V=!0)}else r._targetOpacity=null!==(p=r.style.opacity)&&void 0!==p?p:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(O){q.add(E);const t={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m:1,O.x===t.x&&O.y===t.y&&O.w===t.w&&O.h===t.h||(r._targetX=t.x,r._targetY=t.y,r._targetW=t.w,r._targetH=t.h,r.x=O.x,r.y=O.y,r.w=null!==(x=O.w)&&void 0!==x?x:r.w,r.h=null!==(b=O.h)&&void 0!==b?b:r.h,V=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(O&&null!=O.openY){q.add(E);const t={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(O.x!==t.x||O.openY!==t.openY||O.closeY!==t.closeY||O.highY!==t.highY||O.lowY!==t.lowY)&&(r._targetX=t.x,r._targetOpenY=t.openY,r._targetCloseY=t.closeY,r._targetHighY=t.highY,r._targetLowY=t.lowY,r.x=O.x,r.openY=O.openY,r.closeY=null!==(M=O.closeY)&&void 0!==M?M:r.closeY,r.highY=null!==(_=O.highY)&&void 0!==_?_:r.highY,r.lowY=null!==(P=O.lowY)&&void 0!==P?P:r.lowY,V=!0)}else r._targetOpacity=null!==(T=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==T?T:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[t,e]of o)if(!U.has(t))if(t.startsWith("l:")&&e.path){const i={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(E=e.opacity)&&void 0!==E?E:1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(i),V=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const i={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:null!==(O=e.opacity)&&void 0!==O?O:1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(i),V=!0}for(const[t,e]of i)if(!q.has(t)){if(t.startsWith("p:")){const i={type:"point",x:e.x,y:e.y,r:null!==(D=e.r)&&void 0!==D?D:3,style:{opacity:null!==(L=e.opacity)&&void 0!==L?L:1},datum:null,_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("r:")){const i={type:"rect",x:e.x,y:e.y,w:null!==(N=e.w)&&void 0!==N?N:0,h:null!==($=e.h)&&void 0!==$?$:0,style:{opacity:null!==(I=e.opacity)&&void 0!==I?I:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("h:")){const i={type:"heatcell",x:e.x,y:e.y,w:null!==(W=e.w)&&void 0!==W?W:0,h:null!==(z=e.h)&&void 0!==z?z:0,fill:"#999",datum:null,style:{opacity:null!==(R=e.opacity)&&void 0!==R?R:1},_targetOpacity:0,_transitionKey:t};n.exitNodes.push(i)}else if(t.startsWith("c:")){const i=null!==(F=e.openY)&&void 0!==F?F:e.y,o={type:"candlestick",x:e.x,openY:i,closeY:null!==(Y=e.closeY)&&void 0!==Y?Y:i,highY:null!==(j=e.highY)&&void 0!==j?j:i,lowY:null!==(B=e.lowY)&&void 0!==B?B:i,bodyWidth:null!==(H=e.w)&&void 0!==H?H:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(X=e.opacity)&&void 0!==X?X:1},_targetOpacity:0,_transitionKey:t};n.exitNodes.push(o)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:G}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(t,e,n,i){var o,r,l,s,a,c;if(!n.activeTransition)return!1;const u=se(t,n.activeTransition),d=le(u,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of n.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;t.style.opacity=ae(r,t._targetOpacity,d)}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==t._targetR&&void 0!==n.r&&(t.r=ae(n.r,t._targetR,d))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;t.style.opacity=ae(o,t._targetOpacity,d)}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==n.w&&(t.w=ae(n.w,t._targetW,d)),void 0!==n.h&&(t.h=ae(n.h,t._targetH,d))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;t.style=Object.assign(Object.assign({},t.style||{}),{opacity:ae(o,t._targetOpacity,d)})}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),t.y=ae(n.y,t._targetY,d),void 0!==n.w&&(t.w=ae(n.w,t._targetW,d)),void 0!==n.h&&(t.h=ae(n.h,t._targetH,d))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const n=e?i.get(e):void 0,o=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;t.style=Object.assign(Object.assign({},t.style||{}),{opacity:ae(o,t._targetOpacity,d)})}if(void 0===t._targetX)continue;if(!e)continue;const n=i.get(e);if(!n)continue;t.x=ae(n.x,t._targetX,d),void 0!==n.openY&&(t.openY=ae(n.openY,t._targetOpenY,d)),void 0!==n.closeY&&(t.closeY=ae(n.closeY,t._targetCloseY,d)),void 0!==n.highY&&(t.highY=ae(n.highY,t._targetHighY,d)),void 0!==n.lowY&&(t.lowY=ae(n.lowY,t._targetLowY,d))}else if("line"===t.type){if(void 0!==t._targetOpacity){const e=null!==(a=t._startOpacity)&&void 0!==a?a:0;t.style=Object.assign(Object.assign({},t.style),{opacity:ae(e,t._targetOpacity,d)})}void 0!==t._introClipFraction&&(t._introClipFraction=d);const e=t._prevPath,n=t._targetPath;if(e&&n&&e.length===t.path.length)for(let i=0;t.path.length>i;i++)t.path[i][0]=ae(e[i][0],n[i][0],d),t.path[i][1]=ae(e[i][1],n[i][1],d)}else if("area"===t.type){if(void 0!==t._targetOpacity){const e=null!==(c=t._startOpacity)&&void 0!==c?c:0;t.style=Object.assign(Object.assign({},t.style),{opacity:ae(e,t._targetOpacity,d)})}void 0!==t._introClipFraction&&(t._introClipFraction=d);const e=t._prevTopPath,n=t._prevBottomPath,i=t._targetTopPath,o=t._targetBottomPath;if(e&&i&&e.length===t.topPath.length)for(let n=0;t.topPath.length>n;n++)t.topPath[n][0]=ae(e[n][0],i[n][0],d),t.topPath[n][1]=ae(e[n][1],i[n][1],d);if(n&&o&&n.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=ae(n[e][0],o[e][0],d),t.bottomPath[e][1]=ae(n[e][1],o[e][1],d)}}if(u>=1){for(const t of n.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style=Object.assign(Object.assign({},"line"===t.type||"area"===t.type?t.style:t.style||{}),{opacity:0===e?0:e}),t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let n=0;t.path.length>n;n++)t.path[n]=e[n];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,n=t._targetBottomPath;if(e)for(let n=0;t.topPath.length>n;n++)t.topPath[n]=e[n];if(n)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=n[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const t of this.scene)"line"!==t.type&&"area"!==t.type||(t._introClipFraction=void 0)}groupData(t){if(!this.getGroup)return[{key:"_default",data:t}];const e=new Map;for(const n of t){const t=this.getGroup(n);e.has(t)||e.set(t,[]),e.get(t).push(n)}return Array.from(e.entries()).map(([t,e])=>({key:t,data:e}))}resolveColorMap(t){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const e=new Set;for(const n of t){const t=this.getColor(n);t&&e.add(t)}const n=Array.from(e).sort(),i=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===i)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ie,r=new Map;for(let t=0;n.length>t;t++)r.set(n[t],o[t%o.length]);return this._colorMapCache={key:i,map:r,version:this._ingestVersion},r}resolveLineStyle(t,e){var n;const i=this.config.lineStyle;if("function"==typeof i){const n=i(e||{},t);if(n&&!n.stroke&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{stroke:e})}return n}const o=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return i&&"object"==typeof i?{stroke:i.stroke||o||"#007bff",strokeWidth:i.strokeWidth||2,strokeDasharray:i.strokeDasharray,fill:i.fill,fillOpacity:i.fillOpacity,opacity:i.opacity}:{stroke:this.resolveGroupColor(t)||o||"#007bff",strokeWidth:2}}resolveAreaStyle(t,e){var n,i;if(this.config.areaStyle){const n=this.config.areaStyle(e||{});if(n&&!n.fill&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{fill:e,stroke:n.stroke||e})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(e||{},t);if(n&&!n.fill&&t){const e=this.resolveGroupColor(t);if(e)return Object.assign(Object.assign({},n),{fill:e,stroke:n.stroke||e})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||r||"#4e79a7",fillOpacity:null!==(i=o.fillOpacity)&&void 0!==i?i:.7,stroke:o.stroke||r||"#4e79a7",strokeWidth:o.strokeWidth||2};const l=this.resolveGroupColor(t)||r||"#4e79a7";return{fill:l,fillOpacity:.7,stroke:l,strokeWidth:2}}resolveGroupColor(t){if(this._colorMapCache){const e=this._colorMapCache.map.get(t);if(e)return e}const e=this._groupColorMap.get(t);if(e)return e;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ie;if(0===n.length)return null;const i=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(t,i),this._groupColorMap.size>Ae.GROUP_COLOR_MAP_CAP){const t=this._groupColorMap.keys().next().value;void 0!==t&&this._groupColorMap.delete(t)}return i}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=new Set(Array.isArray(t)?t:[t]),n=this.getPointId,i=t=>e.has(n(t));if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),e=new Set;this.buffer.forEach((t,n)=>{i(t)&&e.add(n)}),this.timestampBuffer.clear();for(let n=0;t.length>n;n++)e.has(n)||this.timestampBuffer.push(t[n])}const o=this.buffer.remove(i);if(0===o.length)return o;for(const t of o)this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t))):(this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,o}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(t)?t:[t]),i=this.getPointId,o=new Set;this.buffer.forEach((t,e)=>{n.has(i(t))&&o.add(e)});const r=this.buffer.update(t=>n.has(i(t)),e);if(0===r.length)return r;for(const t of r)this.xExtent.evict(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(t)),this.yExtent.evict(this.getLow(t))):(this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t)));return this.buffer.forEach((t,e)=>{o.has(e)&&(this.xExtent.push(this.getX(t)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(t)),this.yExtent.push(this.getLow(t))):(this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(t){var e,n,i,o;const r=Object.assign({},this.config);("colorScheme"in t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let l=!1,s=!1;Object.assign(this.config,t);const a="chartType"in t&&t.chartType!==r.chartType||"runtimeMode"in t&&t.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const c=a||!$t(null!==(e=t.xAccessor)&&void 0!==e?e:t.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!$t(null!==(i=t.yAccessor)&&void 0!==i?i:t.valueAccessor,null!==(o=r.yAccessor)&&void 0!==o?o:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=It(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=It(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=It(this.config.xAccessor,"x"),this.getY=It(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=we(this.config)),l=!0,s=!0)}if("groupAccessor"in t&&!$t(t.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?zt(this.config.groupAccessor):void 0,l=!0),"categoryAccessor"in t&&!$t(t.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?zt(this.config.categoryAccessor):void 0,l=!0),"sizeAccessor"in t&&!$t(t.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?It(this.config.sizeAccessor,"size"):void 0,l=!0),"colorAccessor"in t&&!$t(t.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?zt(this.config.colorAccessor):void 0,l=!0),"y0Accessor"in t&&!$t(t.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?It(this.config.y0Accessor,"y0"):void 0,l=!0,s=!0),("boundsAccessor"in t&&!$t(t.boundsAccessor,r.boundsAccessor)||"band"in t&&t.band!==r.band||"boundsStyle"in t&&t.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=we(this.config),l=!0,s=!0),"pointIdAccessor"in t&&!$t(t.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?zt(this.config.pointIdAccessor):void 0,l=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in t&&!$t(t.openAccessor,r.openAccessor)||"closeAccessor"in t&&!$t(t.closeAccessor,r.closeAccessor)||"highAccessor"in t&&!$t(t.highAccessor,r.highAccessor)||"lowAccessor"in t&&!$t(t.lowAccessor,r.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?It(this.config.openAccessor,"open"):void 0,this.getHigh=It(this.config.highAccessor,"high"),this.getLow=It(this.config.lowAccessor,"low"),this.getClose=e?It(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,l=!0,s=!0}if(!l){const e=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const n of e)if(t[n]!==r[n]){l=!0;break}}l&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Se(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:i.createElement(i.Fragment,null,...e)}function Me(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>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 _e(t,e=30){return Math.max((null!=t?t:4)+5,12,e)}function Pe(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function Ce(t,e){const n=Pe(t);if(!n)return!1;const i=Pe(e);return!i||n.getFullYear()!==i.getFullYear()||n.getMonth()!==i.getMonth()}function Te(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}Ae.GROUP_COLOR_MAP_CAP=1e3,Ae.QUADTREE_THRESHOLD=500;const Ee=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Oe=new WeakMap;let De=0,Le=!1,Ne=null,$e=null,Ie=null;function We(t,e){var n,i;if(!e)return e;const o=Ee.exec(e);if(!o)return e;const r=t.canvas;if(!r)return(null===(n=o[2])||void 0===n?void 0:n.trim())||e;!function(){if(Le)return;if("undefined"==typeof window||"undefined"==typeof document)return;Le=!0;const t=()=>{De++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ne=new MutationObserver(t),Ne.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{$e=window.matchMedia("(prefers-color-scheme: dark)"),Ie=t,"function"==typeof $e.addEventListener?$e.addEventListener("change",Ie):"function"==typeof $e.addListener&&$e.addListener(Ie)}catch(t){}}();let l=Oe.get(r);l&&l.version===De||(l={version:De,map:new Map},Oe.set(r,l));const s=l.map.get(e);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(o[1]).trim()||(null===(i=o[2])||void 0===i?void 0:i.trim())||e;return l.map.set(e,a),a}function ze(t){switch(t){case"monotoneX":return D;case"monotoneY":return O;case"cardinal":return E;case"catmullRom":return T;case"step":return C;case"stepBefore":return P;case"stepAfter":return _;case"basis":return M;case"natural":return S;default:return null}}function Re(t,e,n){return null==e?n:"string"!=typeof e?e:We(t,e)||n}function Fe(t,e,n,i,o,r,l){if("colorStops"in e){const n=e.colorStops.filter(t=>Number.isFinite(t.offset)).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color}));if(2>n.length)return null;const s=t.createLinearGradient(i,o,r,l);for(const t of n)s.addColorStop(t.offset,t.color);return s}const{topOpacity:s,bottomOpacity:a}=e;if(!Number.isFinite(s)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,a)),d=t.createLinearGradient(i,o,r,l),[h,f,g]=function(t,e){const n=t.fillStyle,i="#010203";try{t.fillStyle=i,t.fillStyle=e}catch(e){return t.fillStyle=n,[78,121,167]}const o=t.fillStyle;if(t.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===i&&e.trim().toLowerCase()!==i)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const r=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(t,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function Ye(t,e,n,i,o,r){const l=e.colorStops.filter(t=>Number.isFinite(t.offset)).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color}));if(2>l.length)return null;const s=t.createLinearGradient(n,i,o,r);for(const t of l)s.addColorStop(t.offset,t.color);return s}const je=new WeakMap;function Be(t,e){const n=ze(e);if(!n)return t;const i=je.get(t);if(i)return i;const o=function(t,e,n=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const i=[];let o=null;const r={moveTo(t,e){o=[t,e],i.push([t,e])},lineTo(t,e){o=[t,e],i.push([t,e])},bezierCurveTo(t,e,r,l,s,a){if(!o)return o=[s,a],void i.push([s,a]);const[c,u]=o;for(let o=1;n>=o;o++){const d=o/n,h=1-d;i.push([h*h*h*c+3*h*h*d*t+3*h*d*d*r+d*d*d*s,h*h*h*u+3*h*h*d*e+3*h*d*d*l+d*d*d*a])}o=[s,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,n,r){o=[n,r],i.push([n,r])}};return L().x(t=>t[0]).y(t=>t[1]).curve(e).context(r)(t),i}(t,n);return je.set(t,o),o}function He(t,e,n,i=30,o,r=0){let l=null;if(o){const t=function(t,e,n,i,o){const r=Math.max(i,o+5,12),l=e-r,s=e+r,a=n-r,c=n+r;let u=null,d=1/0;return t.visit((t,o,r,h,f)=>{if(o>s||l>h||r>c||a>f)return!0;if(!t.length){let o=t;do{const t=o.data,r=t.x-e,l=t.y-n,s=Math.sqrt(r*r+l*l);_e(t.r,i)>=s&&d>s&&(u=t,d=s),o=o.next}while(o)}return!1}),u?{node:u,distance:d}:null}(o,e,n,i,r);t&&(l={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const r of t){let t=null;switch(r.type){case"point":if(o)break;t=Ge(r,e,n,i);break;case"line":t=Ve(r,e,n,i);break;case"rect":if(null==r.datum)break;t=Ue(r,e,n);break;case"heatcell":t=Ke(r,e,n);break;case"area":if(!1===r.interactive)break;t=Qe(r,e,n);break;case"candlestick":t=Ze(r,e,n)}t&&i>t.distance&&(l&&t.distance>=l.distance||(l=t))}return l}function Xe(t,e,n){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const i=Je(t,e);if(0>i)return null;if(Math.abs(t[i][0]-e)>n)return null;let o=i,r=i;i>0&&t[i][0]>=e?(o=i-1,r=i):t.length-1>i&&(o=i,r=i+1);const[l,s]=t[o],[a,c]=t[r];return a===l?s:s+Math.max(0,Math.min(1,(e-l)/(a-l)))*(c-s)}function Ge(t,e,n,i=30){const o=e-t.x,r=n-t.y,l=Math.sqrt(o*o+r*r);return l>_e(t.r,i)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:l}}function Ve(t,e,n,i=30){var o,r;if(0===t.path.length)return null;const l=Je(t.path,e);if(0>l)return null;const[s,a]=t.path[l];let c;if(t.path.length>1){let i=1/0;const o=Math.max(0,l-1),r=Math.min(t.path.length-2,l);for(let l=o;r>=l;l++){const[o,r]=t.path[l],[s,a]=t.path[l+1],c=qe(e,n,o,r,s,a);i>c&&(i=c)}c=i}else{const t=e-s,i=n-a;c=Math.sqrt(t*t+i*i)}const u=t.style,d=null!==(r=null!==(o=u.strokeWidth)&&void 0!==o?o:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,i)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[l]?t.datum[l]:t.datum,x:s,y:a,distance:c}}function qe(t,e,n,i,o,r){const l=o-n,s=r-i,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-i,2));let c=((t-n)*l+(e-i)*s)/a;c=Math.max(0,Math.min(1,c));const u=i+c*s;return Math.sqrt(Math.pow(t-(n+c*l),2)+Math.pow(e-u,2))}function Ue(t,e,n){const i=Me(e,n,t);return i.hit?{node:t,datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}function Ke(t,e,n){const i=Me(e,n,t);return i.hit?{node:t,datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}function Ze(t,e,n){const i=t.bodyWidth/2,o=Math.min(t.openY,t.closeY);if(!(t.x-i-3>e||e>t.x+i+3||t.highY-3>n||n>t.lowY+3)){const i=o+Math.max(Math.max(t.openY,t.closeY)-o,1)/2,r=e-t.x,l=n-i;return{node:t,datum:t.datum,x:t.x,y:i,distance:Math.sqrt(r*r+l*l)}}return null}function Qe(t,e,n){if(0===t.topPath.length)return null;const i=Je(t.topPath,e);if(0>i)return null;const[o,r]=t.topPath[i],l=e-o,s=n-r,a=Math.sqrt(l*l+s*s);return{node:t,datum:Array.isArray(t.datum)&&t.datum[i]?t.datum[i]:t.datum,x:o,y:r,distance:a}}function Je(t,e){if(0===t.length)return-1;let n=0,i=t.length-1;for(;i>n;){const o=n+i>>1;e>t[o][0]?n=o+1:i=o}return n>0&&Math.abs(t[n][0]-e)>=Math.abs(t[n-1][0]-e)?n-1:n}function tn(t){var e,n;const i=new Map;for(const n of t){const t=null!==(e=n.group)&&void 0!==e?e:"_default";let o=i.get(t);o||(o=[],i.set(t,o)),o.push(n)}for(const t of i.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const o=Array.from(i.keys()).sort((t,e)=>{const n=i.get(t),o=i.get(e);return(n.length>0?n[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(i.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const l=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=null===(n=r[t].datum)||void 0===n?void 0:n.id;null!=e&&l.set(e+"",t)}return{flat:r,groups:o,byGroup:i,idToIdx:l}}function en(t,e){var n,i;if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[o];return{flatIndex:o,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(i=r._groupIndex)&&void 0!==i?i:0}}function nn(t,e,n){const{group:i,indexInGroup:o}=e,r=n.byGroup.get(i);switch(t){case"ArrowRight":return r.length-1>o?r[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?r[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(i);return n.groups.length-1>t?on(n,n.groups[t+1],r[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(i);return t>0?on(n,n.groups[t-1],r[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function on(t,e,n){const i=t.byGroup.get(e);let o=0,r=Math.abs(i[0].x-n.x);for(let t=1;i.length>t;t++){const e=Math.abs(i[t].x-n.x);r>e&&(r=e,o=t)}return i[o]._flatIndex}function rn(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function ln(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function sn(t,e,n,i,o,r){l(()=>{if(!t)return;const l=setInterval(()=>{var l;const s=e.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(l=t.threshold)&&void 0!==l?l:5e3,u=a-s.lastIngestTime>c;u!==o&&(r(u),n.current=!0,i())},1e3);return()=>clearInterval(l)},[t,o,i])}const an={fill:(e,n)=>t("rect",{style:e,width:n,height:n}),line:(e,n)=>t("line",{style:e,x1:0,y1:0,x2:n,y2:n})};function cn(t,e,n,i,o){let r;return r="function"==typeof n?n(t):(0,an[n])(i(t,e),o),r}function un({swatchSize:e}){return t("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function dn(t,e,n){return n&&n.size>0?n.has(t.label)?1:.3:null!=e?t.label===e?1:.3:1}const hn=(n,i,o,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:y}=n,p=[];let v=0;const m=!(!i&&!o),x="isolate"===d||void 0===d&&null!=l,{swatchSize:b,labelGap:k,rowHeight:w}=h;return y.forEach((n,d)=>{const h=cn(n,d,f,g,b),A=dn(n,r,l),S=l&&l.size>0&&l.has(n.label);p.push(e("g",{transform:`translate(0,${v})`,onClick:i?()=>i(n):void 0,onMouseEnter:o?()=>o(n):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?c===s&&d===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&x?S||!1:void 0,"aria-current":m&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?t=>{var e;if("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i&&i(n)),"ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault();const n=(d+("ArrowDown"===t.key?1:-1)+y.length)%y.length;u(c,n);const i=null===(e=t.currentTarget.parentElement)||void 0===e?void 0:e.children[n];i instanceof SVGElement&&i.focus()}}:void 0,onFocus:m?t=>{u(c,d),o&&o(n);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","visible")}:void 0,onBlur:m?t=>{o&&o(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+k+2+7*n.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&t(un,{swatchSize:b}),t("text",{y:b/2,x:b+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),v+=w}),p};function fn({config:n,orientation:o="vertical",width:r=100}){const{colorFn:l,domain:s,label:a,format:c}=n,u=c||(t=>Math.round(100*t)/100+""),d="grad-legend-"+i.useId();if("horizontal"===o){const n=12,i=Math.min(r,200),o=Math.max(0,(r-i)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:l(s[0]+n*(s[1]-s[0]))},e))}return e("g",{"aria-label":a||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&t("text",{x:o+i/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),t("rect",{x:o,y:0,width:i,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:o,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),t("text",{x:o+i,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:l(s[1]-n*(s[1]-s[0]))},e))}return e("g",{"aria-label":a||"Gradient legend",children:[a&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function gn(n){const{legendGroups:o,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical",legendLayout:g}=n,y=function(t){var e,n,i,o,r;const l=Math.max(1,null!==(e=null==t?void 0:t.swatchSize)&&void 0!==e?e:16),s=Math.max(l,null!==(n=null==t?void 0:t.rowHeight)&&void 0!==n?n:22);return{swatchSize:l,labelGap:Math.max(0,null!==(i=null==t?void 0:t.labelGap)&&void 0!==i?i:6),itemGap:Math.max(0,null!==(o=null==t?void 0:t.itemGap)&&void 0!==o?o:10),rowHeight:s,align:"left"===(null==t?void 0:t.align)?"start":"right"===(null==t?void 0:t.align)?"end":null!==(r=null==t?void 0:t.align)&&void 0!==r?r:"start",maxWidth:null==t?void 0:t.maxWidth}}(g),[p,v]=i.useState(0),[m,x]=i.useState(0),b=i.useCallback((t,e)=>{v(t),x(e)},[]),k="vertical"===f?(({legendGroups:e,width:n,customClickBehavior:i,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return e.forEach((e,g)=>{h+=5,f.push(t("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,e.label&&(h+=16,f.push(t("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),h+=8),f.push(t("g",{className:"legend-item",transform:`translate(0,${h})`,children:hn(e,i,o,r,l,s,a,g,c,u,d)},"legend-group-"+g)),h+=e.items.length*d.rowHeight+8}),f})({legendGroups:o||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:c,metrics:y}):(({legendGroups:n,height:i,width:o,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var g;let y=0;const p=[];n.forEach((n,i)=>{var g;let v=0;n.label&&(v+=16);const m=((n,i,o,r,l,s,a,c,u,d,h,f)=>{const{type:g="fill",styleFn:y,items:p}=n,v=[],{swatchSize:m,labelGap:x,itemGap:b,rowHeight:k,align:w}=h,A=!(!i&&!o),S="isolate"===d||void 0===d&&null!=l,M=p.map(t=>m+x+7*t.label.length),_=[];let P=0,C=0;M.forEach((t,e)=>{const n=0===C?t:C+b+t;f&&f>0&&C>0&&n>f?(_.push({start:P,end:e,width:C}),P=e,C=t):C=n}),p.length>0&&_.push({start:P,end:p.length,width:C}),_.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=p[f],w=cn(n,f,g,y,m),_=dn(n,r,l),P=l&&l.size>0&&l.has(n.label);v.push(e("g",{transform:`translate(${h},${d*k})`,onClick:i?()=>i(n):void 0,onMouseEnter:o?()=>o(n):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:A?c===s&&f===a?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?P||!1:void 0,"aria-current":A&&!S&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?t=>{var e;if("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i&&i(n)),"ArrowRight"===t.key||"ArrowLeft"===t.key){t.preventDefault();const n=(f+("ArrowRight"===t.key?1:-1)+p.length)%p.length;u(c,n);const i=null===(e=t.currentTarget.parentElement)||void 0===e?void 0:e.children[n];i instanceof SVGElement&&i.focus()}}:void 0,onFocus:A?t=>{u(c,f),o&&o(n);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","visible")}:void 0,onBlur:A?t=>{o&&o(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:_,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+x+2+7*n.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,P&&t(un,{swatchSize:m}),t("text",{y:m/2,x:m+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=M[f]+b}});const T=Math.max(0,..._.map(t=>t.width)),E=_.length;return{items:v,offset:T,totalRows:E,totalHeight:E*k}})(n,r,l,s,a,c,u,i,d,h,f,null!==(g=f.maxWidth)&&void 0!==g?g:o);v+=m.offset+5,p.push(Object.assign(Object.assign({label:n.label},m),{offset:v,totalRows:m.totalRows,totalHeight:m.totalHeight})),y+=v+12});const v=null!==(g=f.maxWidth)&&void 0!==g?g:o;let m=y>v?0:"center"===f.align?Math.max(0,(v-y)/2):"end"===f.align?Math.max(0,v-y):0;const x=[];return p.forEach((e,o)=>{const r=n[o];r.label&&(x.push(t("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),m+=16),x.push(t("g",{className:"legend-item",transform:`translate(${m},0)`,children:e.items},"legend-group-"+o)),m+=e.offset+5,n[o+1]&&x.push(t("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(e.totalHeight||i)+0+8},"legend-top-line legend-symbol-"+o)),m+=12}),t("g",{children:x})})({legendGroups:o||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:c,metrics:y}),w=!(!r&&!l);return e("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),k]})}function yn(t){return"object"==typeof t&&null!==t&&"legendGroups"in t}function pn(t){return"object"==typeof t&&null!==t&&"gradient"in t}function vn(e){var n;const{legend:i,totalWidth:o,totalHeight:r,margin:l,legendPosition:s="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=e;if(!i)return null;const y="top"===s||"bottom"===s,p=!!c,v=Math.max(1,y?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,o-l.left-l.right):100);let m,x;return"left"===s?(m=Math.max(4,l.left-v-10),x=l.top):"top"===s?(m=l.left,x=p?32:8):"bottom"===s?(m=l.left,x=r-l.bottom+38):(m=o-l.right+10,x=l.top),t("g",{transform:`translate(${m}, ${x})`,children:pn(i)?t(fn,{config:i.gradient,orientation:y?"horizontal":"vertical",width:v}):yn(i)?t(gn,{legendGroups:i.legendGroups,title:"",width:v,orientation:y?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):i})}function mn(t){return"string"==typeof t?{type:t}:t}function xn({orient:n,config:i,values:o,scale:l,size:s,length:a}){const c=function(t){var e,n,i,o,r;return{type:t.type,bins:null!==(e=t.bins)&&void 0!==e?e:20,fill:null!==(n=t.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:.5,stroke:null!==(o=t.stroke)&&void 0!==o?o:"none",strokeWidth:null!==(r=t.strokeWidth)&&void 0!==r?r:1}}(i),u="top"===n||"bottom"===n,d=r(()=>{if(0===o.length)return null;const i=l.domain(),r=s-8;if("boxplot"===c.type){const i=function(t){const e=[...t].sort((t,e)=>t-e),n=e.length;if(0===n)return null;const i=e[Math.floor(.25*n)],o=e[Math.floor(.5*n)],r=e[Math.floor(.75*n)],l=r-i;return{q1:i,median:o,q3:r,whiskerLow:Math.max(e[0],i-1.5*l),whiskerHigh:Math.min(e[n-1],r+1.5*l)}}(o);if(!i)return null;const{q1:s,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=i,g=Math.min(.5*r,20),y=(r-g)/2+4;if(u){const i=l(s),o=l(d),r=l(a),u=l(h),p=l(f),v="top"===n?-1:1,m=0;return e("g",{"data-testid":"marginal-boxplot-"+n,children:[t("line",{x1:u,y1:m+v*(y+g/2),x2:p,y2:m+v*(y+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:u,y1:m+v*y,x2:u,y2:m+v*(y+g),stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:p,y1:m+v*y,x2:p,y2:m+v*(y+g),stroke:c.fill,strokeWidth:c.strokeWidth}),t("rect",{x:Math.min(i,o),y:"top"===n?m-y-g:m+y,width:Math.abs(o-i),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),t("line",{x1:r,y1:"top"===n?m-y-g:m+y,x2:r,y2:"top"===n?m-y:m+y+g,stroke:c.fill,strokeWidth:2})]})}{const i=l(s),o=l(d),r=l(a),u=l(h),p=l(f),v="left"===n?-1:1,m=0;return e("g",{"data-testid":"marginal-boxplot-"+n,children:[t("line",{x1:m+v*(y+g/2),y1:u,x2:m+v*(y+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:m+v*y,y1:u,x2:m+v*(y+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),t("line",{x1:m+v*y,y1:p,x2:m+v*(y+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),t("rect",{x:"left"===n?m-y-g:m+y,y:Math.min(i,o),width:g,height:Math.abs(o-i),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),t("line",{x1:"left"===n?m-y-g:m+y,y1:r,x2:"left"===n?m-y:m+y+g,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=z().domain(i).thresholds(c.bins)(o);if(0===d.length)return null;const h=Math.max(...d.map(t=>t.length));if(0===h)return null;if("histogram"===c.type)return t("g",{"data-testid":"marginal-histogram-"+n,children:d.map((e,i)=>{if(null==e.x0||null==e.x1)return null;const o=e.length/h*r;if(u){const r=l(e.x0),s=l(e.x1)-l(e.x0);return t("rect",{x:r,y:"top"===n?-4-o:4,width:Math.max(s,.5),height:o,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const r=l(e.x0),s=l(e.x1)-l(e.x0);return t("rect",{x:"left"===n?-4-o:4,y:Math.min(r,r+s),width:o,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const e=r/2+4,i=[];for(const t of d){if(null==t.x0||null==t.x1)continue;const o=t.length/h*(r/2),s=l((t.x0+t.x1)/2);i.push(u?`${s},${"top"===n?-(e-o):e-o}`:`${"left"===n?-(e-o):e-o},${s}`)}for(let t=d.length-1;t>=0;t--){const o=d[t];if(null==o.x0||null==o.x1)continue;const s=o.length/h*(r/2),a=l((o.x0+o.x1)/2);i.push(u?`${a},${"top"===n?-(e+s):e+s}`:`${"left"===n?-(e+s):e+s},${a}`)}return t("g",{"data-testid":"marginal-violin-"+n,children:t("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const e=[];if(u){const t=0,i=null!=d[0].x0?l(d[0].x0):0;e.push(`M${i},${t}`);for(const t of d){if(null==t.x0||null==t.x1)continue;const i=t.length/h*r,o=l((t.x0+t.x1)/2);e.push(`L${o},${"top"===n?-i-4:i+4}`)}const o=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;e.push(`L${o},${t}`),e.push("Z")}else{const t=0,i=null!=d[0].x0?l(d[0].x0):0;e.push(`M${t},${i}`);for(const t of d){if(null==t.x0||null==t.x1)continue;const i=t.length/h*r,o=l((t.x0+t.x1)/2);e.push(`L${"left"===n?-i-4:i+4},${o}`)}const o=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;e.push(`L${t},${o}`),e.push("Z")}return t("g",{"data-testid":"marginal-ridgeline-"+n,children:t("path",{d:e.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[o,l,c,s,a,n,u,4]);return d?t("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function bn(t,e=120,n=8){if(!t)return[];const i=Math.max(1,Math.floor(e/n)),o=t.split(/\s+/),r=[];let l="";for(const t of o)l&&l.length+1+t.length>i?(r.push(l),l=t):l=l?`${l} ${t}`:t;return l&&r.push(l),r}function kn(t,e,n,i){return"curly"===t?i?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:i?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function wn(n,i,o,r){if(!n)return t("g",{className:"annotation-note"});const{label:l,title:s,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!s)return t("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(i)>Math.abs(o)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>i?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===h?"right"===f?g="end":"middle"===f&&(g="middle"):g=0>i?"end":"start";const y=16,p=s?d?[s]:bn(s,u):[],v=l?d?[l]:bn(l,u):[],m="leftRight"===h?"end"===g?-4:4:0;let x=0;const b=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(t("text",{className:"annotation-note-title",fill:k,textAnchor:g,fontWeight:"bold",children:p.map((e,n)=>t("tspan",{x:m,dy:0===n?0:y,children:e},n))},"annotation-note-title")),x=p.length*y),v.length>0&&b.push(t("text",{className:"annotation-note-label",fill:k,textAnchor:g,y:x,children:v.map((e,n)=>t("tspan",{x:m,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let w=null;if((s||l)&&(0!==i||0!==o))if("topBottom"===h){const e=Math.min(u,120);let n=0,i=e;"end"===g?(n=-e,i=0):"middle"===g&&(n=-e/2,i=e/2),w=t("line",{className:"note-line",x1:n,x2:i,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+v.length)*y+(v.length>0?y:0);let n=0,i=e;"bottom"===f?(n=-e,i=0):"middle"===f&&(n=-e/2,i=e/2),w=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:i,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,p.length+v.length-1)*y;let S=0;return"topBottom"===h?S=0>o?-(A+2):18:"leftRight"===h&&(S="middle"===f?-(A+y+(v.length>0&&p.length>0?2:0))/2+8:"bottom"===f||0>o?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${i},${o})`,children:[t("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:b}),w]})}function An(e,n,i,o,r){var l;const s=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&s.push(t("circle",{r:e,fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,o=(null==n?void 0:n.height)||0;(e>0||o>0)&&s.push(t("rect",{width:e,height:o,fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));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 e=o||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const o=(n.x||0)-e;s.push(t("line",{x1:o,y1:(n.y1||0)-l,x2:o,y2:(n.y2||0)-l,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const o=(n.y||0)-l;s.push(t("line",{x1:(n.x1||0)-e,y1:o,x2:(n.x2||0)-e,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(t("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:i||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==e&&s.push(t("path",{d:kn((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:i||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:s})}function Sn(e,n,i,o,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const t=l.width||0,i=l.height||0;if(t>0||i>0){const o=t/2,r=i/2,l=e-o,s=n-r;if(0!==l||0!==s){const e=Math.abs(l),n=Math.abs(s),u=t/2,d=i/2,h=e*d>n*u?u/e:d/n;a=o+l*h,c=r+s*h}}}else if("bracket"===r&&l){const t=l.width,e=l.height,n=l.depth||30;void 0!==t?(a=t/2,c=n):void 0!==e&&(a=n,c=e/2)}}else{const t=(l.radius||0)+(l.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const i=Math.atan2(n,e);a=Math.cos(i)*t,c=Math.sin(i)*t}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(n-c,2))>.5&&(s.push(t("line",{x1:a,y1:c,x2:e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==i?void 0:i.end))){const i=10,r=16/180*Math.PI,l=Math.atan2(n-c,e-a);s.push(t("path",{d:`M${a},${c}L${a+i*Math.cos(l+r)},${c+i*Math.sin(l+r)}L${a+i*Math.cos(l-r)},${c+i*Math.sin(l-r)}Z`,fill:o||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:s})}function Mn(t){const{x:n=0,y:i=0,dx:o,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:g,events:y={},"data-testid":p}=t,v=new Set(Array.isArray(g)?g:[]);let m=o||0,x=r||0;null!=l&&(m=l-n),null!=s&&(x=s-i);const b="string"==typeof d?d:"label";if("bracket"===b&&u&&0===m&&0===x)if(void 0!==u.width){m=u.width/2;const t=u.depth||30;x=t+(0>t?-5:5)}else if(void 0!==u.height){const t=u.depth||30;m=t+(0>t?-5:5),x=u.height/2}return e("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${i})`,"data-testid":p},y,{children:[!v.has("connector")&&Sn(m,x,c,h,b,u),!v.has("subject")&&An(b,u,h,n,i),!v.has("note")&&wn(a,m,x,h)]}))}function _n(e){var n,i;const{noteData:o}=e,{screenCoordinates:r}=o,l="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(n=o.dx)&&void 0!==n?n:0),s=o.ny||r[0][1]+(null!==(i=o.dy)&&void 0!==i?i:0),a=r.map((n,i)=>{const r=Object.assign({},o,{note:0===i?o.note:{label:""},x:n[0],y:n[1],nx:e,ny:s});return t(Mn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+i)});return t("g",{children:a})}const a=o.note||{title:"none",label:o.label},c=`${a.label}-${a.title}-${o.i}`;return t(Mn,Object.assign({"data-testid":"semiotic-annotation",events:s},o,{type:l}),c)}function Pn(t,e){var n,i,o;const r=null!==(i=null===(n=e.scales)||void 0===n?void 0:n.x)&&void 0!==i?i:null===(o=e.scales)||void 0===o?void 0:o.time;return r?null!=t.x?r(t.x):e.xAccessor&&null!=t[e.xAccessor]?r(t[e.xAccessor]):null:null}function Cn(t,e){var n,i,o;const r=null!==(i=null===(n=e.scales)||void 0===n?void 0:n.y)&&void 0!==i?i:null===(o=e.scales)||void 0===o?void 0:o.value;return r?null!=t.y?r(t.y):e.yAccessor&&null!=t[e.yAccessor]?r(t[e.yAccessor]):null:null}function Tn(t,e,n){var i,o,r,l;const s=t.anchor||"fixed";if("latest"===s){if(null!=t.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===t.pointId){const t={x:r.x,y:r.y};return null===(i=n.stickyPositionCache)||void 0===i||i.set(e,t),t}}const r=function(t){var e,n,i,o,r,l;const s=t.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(e=t.scales)||void 0===e?void 0:e.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time,u=null!==(r=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==r?r:null===(l=t.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[t.xAccessor||"x"],h=a[t.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(o=n.stickyPositionCache)||void 0===o||o.set(e,r)),r}let a=null,c=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(a=e.x,c=e.y)}if(null!=a&&null!=c||(a=Pn(t,n),c=Cn(t,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(e,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const t=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(e);if(t)return t}return null}function En(t,e,n,i=50){return!(-i>t||t>(n.width||0)+i||-i>e||e>(n.height||0)+i)}const On={linear:$,monotoneX:D,monotoneY:O,step:C,stepAfter:_,stepBefore:P,basis:M,cardinal:E,catmullRom:T};let Dn={positions:new Map};const Ln=new Set;function Nn(){for(const t of Ln)t()}function $n(t,e){const n=Dn.positions.get(t);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==e)return;const i=new Map(Dn.positions);i.delete(t),Dn={positions:i},Nn()}function In(t,e){const n=Dn.positions.get(t);if(!(null==n?void 0:n.locked))return;if(e&&n.sourceId!==e)return;const i=new Map(Dn.positions);i.delete(t),Dn={positions:i},Nn()}function Wn(){return Dn}function zn(t){return Ln.add(t),()=>Ln.delete(t)}const Rn={positions:new Map};function Fn(){return()=>{}}function Yn(){return Rn}function jn(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),i=n[0],o=n[n.length-1],r=i instanceof Date,l=i instanceof Date?i.getTime():i,s=o instanceof Date?o.getTime():o;if(2>e||l===s)return r?[new Date(l),new Date(s)]:[l,s];const a=(s-l)/(e-1),c=Array(e);for(let t=0;e>t;t++){const n=t===e-1?s:l+t*a;c[t]=r?new Date(n):n}return c}(t,e):t.ticks(e)}function Bn(t,e,n){if("edges"===t){if(e)return"start";if(n)return"end"}return"middle"}function Hn(t,e,n){if("edges"===t){if(e)return"hanging";if(n)return"auto"}return"middle"}function Xn(t){if(0===t.length)return{min:null,max:null};let e=1/0,n=-1/0;for(const i of t)e>i.pixel&&(e=i.pixel),i.pixel>n&&(n=i.pixel);return{min:e,max:n}}function Gn(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function Vn(t,e,n){if("left"===t||"right"===t){const i="left"===t?n:0,o="left"===t?-1:1,r=Math.ceil(e/8);let l="M0,"+i;for(let t=0;r>t;t++){const n=8*(t+1);l+=`L${Math.min(8*t+4,e)},${i+4*o}`,l+=`L${Math.min(n,e)},${i}`}return l}{const i="bottom"===t?0:e,o="bottom"===t?1:-1,r=Math.ceil(n/8);let l=`M${i},0`;for(let t=0;r>t;t++){const e=8*(t+1);l+=`L${i+4*o},${Math.min(8*t+4,n)}`,l+=`L${i},${Math.min(e,n)}`}return l}}function qn(n){const{width:i,height:o,totalWidth:l,totalHeight:s,margin:a,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:f,yFormat:g,axisExtent:y}=n,p=r(()=>{var t,e;if(!c)return[];const n=null==d?void 0:d.find(t=>"bottom"===t.orient),o=(null==n?void 0:n.tickFormat)||f||Un,r=Math.max(2,Math.floor(i/70)),l=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5,s=null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(c.x,"exact"===y?Math.max(2,l):Math.min(l,r),y),a=s.map(t=>t.valueOf()),u=s.map((t,e)=>({value:t,pixel:c.x(t),label:o(t,e,a)})),h=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return Kn(u,Math.max(55,h+8))},[c,d,f,i,y]),v=r(()=>{var t,e;if(!c)return[];const n=null==d?void 0:d.find(t=>"left"===t.orient),i=(null==n?void 0:n.tickFormat)||g||Un,r=Math.max(2,Math.floor(o/30)),l=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5;return Kn((null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(c.y,"exact"===y?Math.max(2,l):Math.min(l,r),y)).map(t=>({value:t,pixel:c.y(t),label:i(t)})),22)},[c,d,g,o,y]),m=h&&c,x=u&&c;if(!m&&!x)return null;const b=null==d?void 0:d.find(t=>"bottom"===t.orient),k=null==d?void 0:d.find(t=>"left"===t.orient),w=x&&(!b||!1!==b.baseline),A=x&&(!k||!1!==k.baseline),S=(null==b?void 0:b.jaggedBase)||!1,M=(null==k?void 0:k.jaggedBase)||!1,_="var(--semiotic-border, #ccc)";return t("svg",{width:l,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var n,r;const l=Gn(null===(n=null==d?void 0:d.find(t=>"bottom"===t.orient))||void 0===n?void 0:n.gridStyle),s=Gn(null===(r=null==d?void 0:d.find(t=>"left"===t.orient))||void 0===r?void 0:r.gridStyle);return e("g",{className:"stream-grid",children:[p.map((e,n)=>t("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:l},"xgrid-"+n)),v.map((e,n)=>t("line",{x1:0,y1:e.pixel,x2:i,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),w&&!S&&t("line",{x1:0,y1:o,x2:i,y2:o,stroke:_,strokeWidth:1}),S&&t("path",{d:Vn("bottom",i,o),fill:"none",stroke:_,strokeWidth:1}),A&&!M&&t("line",{x1:0,y1:0,x2:0,y2:o,stroke:_,strokeWidth:1}),M&&t("path",{d:Vn("left",i,o),fill:"none",stroke:_,strokeWidth:1})]})})}function Un(t,e,n){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function Kn(t,e){if(2>=t.length)return t;const n=[t[0]];for(let i=1;t.length-1>i;i++)e>Math.abs(t[i].pixel-n[n.length-1].pixel)||n.push(t[i]);const i=t[t.length-1];return e>Math.abs(i.pixel-n[n.length-1].pixel)?n[n.length-1]=i:n.push(i),n}function Zn(i){var s,a;const{width:u,height:d,totalWidth:h,totalHeight:f,margin:g,scales:y,showAxes:p,axes:v,xLabel:m,yLabel:x,yLabelRight:b,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:M,legend:_,legendHoverBehavior:P,legendClickBehavior:C,legendHighlightedCategory:T,legendIsolatedCategories:E,legendPosition:O="right",legendLayout:D,foregroundGraphics:L,marginalGraphics:I,xValues:W,yValues:z,annotations:R,svgAnnotationRules:F,xAccessor:Y,yAccessor:j,annotationData:B,pointNodes:H,curve:G,underlayRendered:V,canvasObscuresUnderlay:q=!0,linkedCrosshairName:U,linkedCrosshairSourceId:K,children:Z}=i,Q=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"bottom"===t.orient),i=(null==n?void 0:n.tickFormat)||k||Un,o=Math.max(2,Math.floor(u/70)),r=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5,l=null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(y.x,"exact"===A?Math.max(2,r):Math.min(r,o),A),s=l.map(t=>t.valueOf()),a=l.map((t,e)=>({value:t,pixel:y.x(t),label:i(t,e,s)})),c=a.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=Kn(a,d);if(h.length>1&&(h=h.filter((t,e)=>0===e||t.label+""!=h[e-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const t=y.x.domain()[1],e=y.x(t),n=h[h.length-1].pixel;if(Math.abs(e-n)>1){const o=i(t,h.length,s);d>e-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:t,pixel:e,label:o})}}return h},[p,y,v,k,u,A]),tt=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"left"===t.orient),i=(null==n?void 0:n.tickFormat)||w||Un,o=Math.max(2,Math.floor(d/30)),r=null!==(t=null==n?void 0:n.ticks)&&void 0!==t?t:5;let l=Kn((null!==(e=null==n?void 0:n.tickValues)&&void 0!==e?e:jn(y.y,"exact"===A?Math.max(2,r):Math.min(r,o),A)).map(t=>({value:t,pixel:y.y(t),label:i(t)})),22);if(l.length>1&&(l=l.filter((t,e)=>0===e||t.label+""!=l[e-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const t=y.y.domain()[1],e=y.y(t),n=l[l.length-1].pixel;if(Math.abs(e-n)>1){const o=i(t);22>Math.abs(e-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:t,pixel:e,label:o})}}return l},[p,y,v,w,d,A]),et=r(()=>{var t,e;if(!p||!y)return[];const n=null==v?void 0:v.find(t=>"right"===t.orient);if(!n)return[];const i=n.tickFormat||w||Un,o=Math.max(2,Math.floor(d/30)),r=null!==(t=n.ticks)&&void 0!==t?t:5;return Kn((null!==(e=n.tickValues)&&void 0!==e?e:jn(y.y,"exact"===A?Math.max(2,r):Math.min(r,o),A)).map(t=>({value:t,pixel:y.y(t),label:i(t)})),22)},[p,y,v,w,d,A]),nt=o(new Map),it=o(null!==(s=null==R?void 0:R.length)&&void 0!==s?s:0),ot=null!==(a=null==R?void 0:R.length)&&void 0!==a?a:0;it.current!==ot&&(it.current=ot,nt.current=new Map);const rt=r(()=>{if(!R||0===R.length)return null;const n=function(n,i,o){var r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,S,M,_,P,C,T,E,O,D,L,I,W,z,R,F,Y,j,B,H,G,V,q,U,K,Z,Q,tt,et,nt;switch(n.type){case"label":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return En(r,l,o)?t(_n,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+i):null}case"callout":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return En(r,l,o)?t(_n,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+i):null}case"x-threshold":{const r=Pn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,o);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:a,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"y-threshold":{const r=Cn(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,o);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"right";let a,c;return"left"===s?(a=4,c="start"):"center"===s?(a=(o.width||0)/2,c="middle"):(a=(o.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:a,y:r-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"enclose":{const r=(n.coordinates||[]).map(t=>({x:Pn(Object.assign(Object.assign({},t),{type:"point"}),o),y:Cn(Object.assign(Object.assign({},t),{type:"point"}),o),r:1})).filter(t=>null!=t.x&&null!=t.y);if(2>r.length)return null;const l=X(r),s=n.padding||10;return e("g",{children:[t("circle",{cx:l.x,cy:l.y,r:l.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:l.x,y:l.y-l.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const r=(n.coordinates||[]).map(t=>({x:Pn(Object.assign(Object.assign({},t),{type:"point"}),o),y:Cn(Object.assign(Object.assign({},t),{type:"point"}),o)})).filter(t=>null!=t.x&&null!=t.y);if(2>r.length)return null;const l=n.padding||10,s=r.map(t=>t.x),a=r.map(t=>t.y),c=Math.min(...s)-l,u=Math.max(...s)+l,d=Math.min(...a)-l,h=Math.max(...a)+l;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const e=o.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(t=>t[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,i)=>{const r=Pn(e,o),s=Cn(e,o);if(null==r||null==s)return null;const a="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||l;return t("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+i)})},"ann-"+i)}case"bracket":{const e=Pn(n,o),r=Cn(n,o);return t(_n,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const h=o.data||[];if(2>h.length)return null;const f=o.xAccessor||"x",g=o.yAccessor||"y",y="ordinal"===o.frameType,p="horizontal"===o.projection,v=y?f:null,m=y?g:null;let x;const b=[],k=new Map;if(y&&v&&m){for(const t of h){const e=t[v];if(null==e)continue;const n=e+"";k.has(n)||(k.set(n,b.length),b.push(n))}x=h.map(t=>{const e=t[v],n=t[m];if(null==e||null==n)return null;const i=k.get(e+"");return null!=i?[i,+n]:null}).filter(t=>null!==t)}else x=h.map(t=>[t[f],t[g]]).filter(t=>null!=t[0]&&null!=t[1]);if(2>x.length)return null;const w=null!==(l=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==l?l:null===(s=o.scales)||void 0===s?void 0:s.time,A=null!==(c=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=o.scales)||void 0===u?void 0:u.value;if(!w||!A)return null;const S=t=>e=>{const n=Math.max(0,Math.floor(e)),i=Math.min(b.length-1,n+1),o=e-n,r=t(b[n]);return r+(t(b[i])-r)*o},M=w,_=A;let P;if(y)if(p){const t=S(_);P=(e,n)=>[M(n),t(e)]}else{const t=S(M);P=(e,n)=>[t(e),_(n)]}else P=(t,e)=>[M(t),_(e)];const C=n.method||"linear";let T;T="loess"===C?function(t,e=.3){const n=t.length;if(2>n)return t.slice();const i=t.slice().sort((t,e)=>t[0]-e[0]),o=i.map(t=>t[0]),r=i.map(t=>t[1]),l=Math.max(2,Math.ceil(e*n)),s=[];for(let t=0;n>t;t++){const e=o[t],i=o.map(t=>Math.abs(t-e)),a=i.slice().sort((t,e)=>t-e)[Math.min(l-1,n-1)]||1,c=[];for(let t=0;n>t;t++){const e=0===a?0:i[t]/a;c[t]=1>e?Math.pow(1-Math.pow(e,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let t=0;n>t;t++){const e=c[t];0!==e&&(u+=e,d+=e*o[t],h+=e*r[t],f+=e*o[t]*o[t],g+=e*o[t]*r[t])}if(0===u){s.push([e,r[t]]);continue}const y=u*f-d*d;if(1e-12>Math.abs(y))s.push([e,h/u]);else{const t=(u*g-d*h)/y;s.push([e,(h-t*d)/u+t*e])}}return s}(x,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===C?J.polynomial(x,{order:n.order||2}):J.linear(x)).points;const E=T.map(([t,e])=>{const[n,i]=P(t,e);return`${n},${i}`}).join(" "),O=n.color||"#6366f1",D=T[T.length-1],[L,N]=P(D[0],D[1]);return e("g",{children:[t("polyline",{points:E,fill:"none",stroke:O,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:L+4,y:N-4,fill:O,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const r=null!==(f=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(g=o.scales)||void 0===g?void 0:g.value,l=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,s=null!==(p=null==r?void 0:r(n.y1))&&void 0!==p?p:o.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(l,s),width:o.width||0,height:Math.abs(s-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(o.width||0)-4,y:Math.min(l,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+i)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const l=o.xAccessor||"x",s=null!==(m=null===(v=o.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(x=o.scales)||void 0===x?void 0:x.time,a=null!==(k=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==k?k:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(t=>null!=t[c]&&null!=t[u]&&!(d&&!d(t))).sort((t,e)=>t[l]-e[l]);if(2>h.length)return null;const f=On[o.curve||"linear"]||$,g=N().x(t=>s(t[l])).y0(t=>a(t[u])).y1(t=>a(t[c])).curve(f)(h);if(!g)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:g,fill:y,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:s(h[h.length-1][l])+4,y:a(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const l=o.yAccessor||"y",s=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(C=null===(P=o.scales)||void 0===P?void 0:P.y)&&void 0!==C?C:null===(T=o.scales)||void 0===T?void 0:T.value;if(!s||!a)return null;const c=r.map(t=>t[l]).filter(t=>null!=t&&isFinite(t));if(2>c.length)return null;const u=c.reduce((t,e)=>t+e,0)/c.length,d=c.reduce((t,e)=>t+Math.pow(e-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(E=n.threshold)&&void 0!==E?E:2,g=u-f*h,y=!1!==n.showBand,p=n.fill||"#6366f1",v=null!==(O=n.fillOpacity)&&void 0!==O?O:.1,m=n.anomalyColor||"#ef4444",x=null!==(D=n.anomalyRadius)&&void 0!==D?D:6,b=a(u+f*h),k=a(g),w=r.filter(t=>{const e=t[l];return null!=e&&Math.abs(e-u)>f*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(b,k),width:o.width||0,height:Math.abs(k-b),fill:p,fillOpacity:v}),w.map((e,n)=>{const i=Pn(e,o),r=Cn(e,o);return null==i||null==r?null:t("circle",{cx:i,cy:r,r:x,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(o.width||0)-4,y:Math.min(b,k)-4,textAnchor:"end",fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const l=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==I?I:null===(W=o.scales)||void 0===W?void 0:W.time,c=null!==(R=null===(z=o.scales)||void 0===z?void 0:z.y)&&void 0!==R?R:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!c)return null;const u=r.map(t=>[t[l],t[s]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,e)=>t[0]-e[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const t=J.polynomial(u,{order:n.order||2}).equation;d=e=>t.reduce((t,n,i)=>t+n*Math.pow(e,i),0)}else{const t=u.length;let e=0,n=0,i=0,o=0;for(const[t,r]of u)e+=t,n+=r,i+=t*t,o+=t*r;const r=t*i-e*e;if(1e-12>Math.abs(r))return null;const l=(t*o-e*n)/r,s=(n-l*e)/t;d=t=>s+l*t}const h=u.length,f=u.map(([t,e])=>e-d(t)).reduce((t,e)=>t+e*e,0),g=Math.sqrt(f/Math.max(h-2,1)),y=u.reduce((t,e)=>t+e[0],0)/h,p=u.reduce((t,e)=>t+Math.pow(e[0]-y,2),0),v=null!==(Y=n.confidence)&&void 0!==Y?Y:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,x=null!==(j=n.steps)&&void 0!==j?j:5,b=u[h-1][0],k=(b-u[0][0])/Math.max(h-1,1),w=[];for(let t=1;x>=t;t++)w.push(b+t*k);const A=[];for(const t of w){const e=d(t),n=g*Math.sqrt(1+1/h+(p>0?Math.pow(t-y,2)/p:0))*m;A.push({x:t,yCenter:e,yUpper:e+n,yLower:e-n})}const S=`M${A.map(t=>`${a(t.x)},${c(t.yUpper)}`).join(" L")} L${A.slice().reverse().map(t=>`${a(t.x)},${c(t.yLower)}`).join(" L")} Z`,M=A.map(t=>`${a(t.x)},${c(t.yCenter)}`).join(" "),_=`${a(b)},${c(d(b))}`,P=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:S,fill:n.fill||"#6366f1",fillOpacity:null!==(B=n.fillOpacity)&&void 0!==B?B:.15,stroke:"none"}),t("polyline",{points:`${_} ${M}`,fill:"none",stroke:P,strokeWidth:null!==(H=n.strokeWidth)&&void 0!==H?H:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&A.length>0&&t("text",{x:a(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:P,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=Tn(n,i,o);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!En(e,r,o))return null;const l=null!==(V=n.dx)&&void 0!==V?V:0,s=null!==(q=n.dy)&&void 0!==q?q:0,a=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const e=Tn(n,i,o);if(!e)return null;const{x:r,y:l}=e;return t("text",{x:r+(n.dx||0),y:l+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+i)}case"category-highlight":{const r=n.category;if(null==r)return null;const l=t=>"function"==typeof t&&"function"==typeof t.bandwidth,s=null===(Q=o.scales)||void 0===Q?void 0:Q.o,a=null===(tt=o.scales)||void 0===tt?void 0:tt.x,c=null===(et=o.scales)||void 0===et?void 0:et.y,u=l(s)?s:l(a)?a:l(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(nt=n.opacity)&&void 0!==nt?nt:.15,y=n.label;return e("g",(o.projection?"vertical"===o.projection:u===a)?{children:[t("rect",{x:d,y:0,width:h,height:o.height||0,fill:f,fillOpacity:g}),y&&t("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:y})]}:{children:[t("rect",{x:0,y:d,width:o.width||0,height:h,fill:f,fillOpacity:g}),y&&t("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:y})]},"ann-"+i)}default:return null}},i={scales:y?{x:y.x,y:y.y,time:y.x,value:y.y}:null,timeAxis:"x",xAccessor:Y,yAccessor:j,width:u,height:d,data:B,frameType:"xy",pointNodes:H,curve:G,stickyPositionCache:nt.current};return R.map((t,e)=>{if(F){const o=F(t,e,i);return null!=o?o:n(t,e,i)}return n(t,e,i)}).filter(Boolean)},[R,F,u,d,Y,j,B,y,H,G]),lt=function(t){var e;const n=c(t?zn:Fn,t?Wn:Yn,t?Wn:Yn);return t&&null!==(e=n.positions.get(t))&&void 0!==e?e:null}(U);return l(()=>{if(!(null==lt?void 0:lt.locked)||!U)return;const t=t=>{"Escape"===t.key&&In(U)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[null==lt?void 0:lt.locked,U]),p||M||_||L||I||rt&&rt.length>0||S||Z||lt?e("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof M?M:"XY Chart"}),t("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),e("g",{transform:`translate(${g.left},${g.top})`,children:[S&&y&&(!V||q)&&(()=>{var n,i;const o=Gn(null===(n=null==v?void 0:v.find(t=>"bottom"===t.orient))||void 0===n?void 0:n.gridStyle),r=Gn(null===(i=null==v?void 0:v.find(t=>"left"===t.orient))||void 0===i?void 0:i.gridStyle);return e("g",{className:"stream-grid",children:[Q.map((e,n)=>t("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),tt.map((e,n)=>t("line",{x1:0,y1:e.pixel,x2:u,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),p&&y&&(()=>{const n=null==v?void 0:v.find(t=>"left"===t.orient),i=null==v?void 0:v.find(t=>"bottom"===t.orient),o=!n||!1!==n.baseline,r=!i||!1!==i.baseline,l=(null==n?void 0:n.jaggedBase)||!1,s=(null==i?void 0:i.jaggedBase)||!1,a=null==i?void 0:i.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",p=!!(null==i?void 0:i.autoRotate)&&Q.length>1&&(()=>{const t=u/Math.max(Q.length-1,1),e=Q.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0);return e+8>t})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==i?void 0:i.tickAnchor,M=null==n?void 0:n.tickAnchor,_=Xn(Q),P=Xn(tt);return e("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!V||q)&&r&&!s&&t("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!V||q)&&s&&t("path",{d:Vn("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),Q.map((n,i)=>{const o=!!a&&("function"==typeof a?a(n.value,i):Ce(n.value,i>0?Q[i-1].value:void 0));return e("g",{transform:`translate(${n.pixel},${d})`,children:[t("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:p?10:18,textAnchor:p?"end":Bn(S,n.pixel===_.min,n.pixel===_.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?w:k),transform:p?"rotate(-45)":void 0,children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+i)}),m&&t("text",{x:u/2,y:d+40,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:m})]}),e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!V||q)&&o&&!l&&t("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!V||q)&&l&&t("path",{d:Vn("left",u,d),fill:"none",stroke:h,strokeWidth:1}),tt.map((n,i)=>{const o=!!c&&("function"==typeof c?c(n.value,i):Ce(n.value,i>0?tt[i-1].value:void 0));return e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:Hn(M,n.pixel===P.min,n.pixel===P.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?w:k),children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+i)}),(()=>{const e=(null==n?void 0:n.label)||x;return e?t("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:e}):null})()]}),(()=>{const n=null==v?void 0:v.find(t=>"right"===t.orient);if(!n||0===et.length)return null;const i=!1!==n.baseline,o=n.landmarkTicks,r=n.label||b,l=n.tickAnchor,s=Xn(et);return e("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[i&&t("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),et.map((n,i)=>{const r=!!o&&("function"==typeof o?o(n.value,i):Ce(n.value,i>0?et[i-1].value:void 0));return e("g",{transform:`translate(${u},${n.pixel})`,children:[t("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:8,textAnchor:"start",dominantBaseline:Hn(l,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):t("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+i)}),r&&t("text",{x:u+g.right-15,y:d/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${u+g.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),rt,I&&y&&W&&z&&e(n,{children:[I.top&&t("g",{transform:"translate(0, 0)",children:t(xn,{orient:"top",config:mn(I.top),values:W,scale:y.x,size:g.top,length:u})}),I.bottom&&t("g",{transform:`translate(0, ${d})`,children:t(xn,{orient:"bottom",config:mn(I.bottom),values:W,scale:y.x,size:g.bottom,length:u})}),I.left&&t("g",{transform:"translate(0, 0)",children:t(xn,{orient:"left",config:mn(I.left),values:z,scale:y.y,size:g.left,length:d})}),I.right&&t("g",{transform:`translate(${u}, 0)`,children:t(xn,{orient:"right",config:mn(I.right),values:z,scale:y.y,size:g.right,length:d})})]}),L,lt&&lt.sourceId!==K&&(null==y?void 0:y.x)&&(()=>{const e=y.x(lt.xValue);if(null==e||0>e||e>u)return null;const n=lt.locked;return t("line",{x1:e,y1:0,x2:e,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Z]}),M&&t("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof M?M:null}),vn({legend:_,totalWidth:h,totalHeight:f,margin:g,legendPosition:O,title:M,legendLayout:D,legendHoverBehavior:P,legendClickBehavior:C,legendHighlightedCategory:T,legendIsolatedCategories:E})]}):null}function Qn(t){var e,n,i,o;return(null!==(e=t.tl)&&void 0!==e?e:0)>0||(null!==(n=t.tr)&&void 0!==n?n:0)>0||(null!==(i=t.br)&&void 0!==i?i:0)>0||(null!==(o=t.bl)&&void 0!==o?o:0)>0}const Jn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ti(t,e="#4e79a7"){return t&&"string"==typeof t?t:e}const ei="undefined"==typeof window||"undefined"==typeof document,ni="undefined"!=typeof window?h:l;function ii(){const[t,e]=d(!1);return ni(()=>{e(!0)},[]),t}const oi=()=>()=>{},ri=()=>!1,li=()=>!0;function si(){const t=c(oi,ri,li);return o(t).current}function ai(t){const{hydrated:e,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=t;ni(()=>{var t,o;e&&n&&(null===(o=null===(t=i.current)||void 0===t?void 0:t.cancelIntroAnimation)||void 0===o||o.call(t)),r.current=!0,s.current()},[e,n]);const c=o(a);c.current=a,l(()=>()=>{var t;return null===(t=c.current)||void 0===t?void 0:t.call(c)},[])}function ci(t){const e=o(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return di(t,e);if(!hi(t)||!hi(e))return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n){if(!Object.prototype.hasOwnProperty.call(e,i))return!1;const n=t[i],o=e[i];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!di(n,o))return!1}else{if(!hi(n)||!hi(o))return!1;if(!ui(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function ui(t,e){const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n){if(!Object.prototype.hasOwnProperty.call(e,i))return!1;if(!Object.is(t[i],e[i]))return!1}return!0}function di(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function hi(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}const fi=i.createContext(null);function gi(){return i.useContext(fi)}const yi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function pi(t,e){if(!t||0===t.length)return e+", empty";const n={};for(const e of t){if(null===(null==e?void 0:e.datum))continue;const t=e.type+"";n[t]=(n[t]||0)+1}if(0===Object.keys(n).length)return e+", empty";const i=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((t,e)=>{const n=r.indexOf(t),i=r.indexOf(e);return(-1===n?999:n)-(-1===i?999:i)});for(const t of l)i.push(`${n[t]} ${o[t]||t}`);return`${e}, ${i.join(", ")}`}function vi(t,e,n){const i=[];return t>0&&i.push(t+" nodes"),e>0&&i.push(e+" edges"),0===i.length?n+", empty":`${n}, ${i.join(", ")}`}const mi=t=>{if(null==t)return"";const e=Math.round(100*t)/100;return Number.isNaN(e)?"":e+""},xi="semiotic-accessible-data-table",bi=xi+" semiotic-accessible-data-table-hidden",ki=xi+" semiotic-accessible-data-table-visible",wi=ki+" semiotic-accessible-data-table-network",Ai={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Si={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Mi={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},_i={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Pi={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Ci={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ti={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function Ei({scene:n,chartType:o,tableId:r,chartTitle:l}){var s;const[a,c]=i.useState(!1),u=gi(),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,h=a||d,f=i.useRef(null),g=l?"Data summary for "+l:r?`Data summary for ${o} ${r}`:"Data summary for "+o,y=i.useCallback(()=>{a||d||c(!0)},[a,d]),p=i.useCallback(t=>{var e;d||(null===(e=f.current)||void 0===e?void 0:e.contains(t.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:yi}):null;if(!h)return t("div",{id:r,className:bi,tabIndex:-1,onFocus:y,style:yi,role:"region","aria-label":g,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const v=function(t){var e,n,i,o,r,l,s,a,c,u,d,h,f,g,y,p,v,m,x,b,k,w,A,S,M;const _=[];if(!Array.isArray(t))return _;for(const P of t)if(P&&"object"==typeof P&&null!==P.datum)try{switch(P.type){case"point":_.push({label:"Point",values:{x:P.x,y:P.y}});break;case"line":{const t=P.path,e=Array.isArray(P.datum)?P.datum:[];if(!Array.isArray(t))break;for(let n=0;t.length>n&&e.length>n;n++){const e=t[n];Array.isArray(e)&&_.push({label:"Line point",values:{x:e[0],y:e[1]}})}break}case"area":{const t=P.topPath,e=Array.isArray(P.datum)?P.datum:[];if(!Array.isArray(t))break;for(let n=0;t.length>n&&e.length>n;n++){const e=t[n];Array.isArray(e)&&_.push({label:"Area point",values:{x:e[0],y:e[1]}})}break}case"rect":{const t=null!=P.datum&&"object"==typeof P.datum?P.datum:{},r=null!==(n=null!==(e=t.category)&&void 0!==e?e:P.group)&&void 0!==n?n:"",l=null!==(o=null!==(i=t.value)&&void 0!==i?i:t.__aggregateValue)&&void 0!==o?o:t.total;_.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":_.push({label:"Cell",values:{x:P.x,y:P.y,value:P.value}});break;case"wedge":_.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=P.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=P.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=P.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":_.push({label:"Node",values:{id:null!==(h=null===(d=P.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=P.cx)&&void 0!==f?f:P.x,y:null!==(g=P.cy)&&void 0!==g?g:P.y}});break;case"arc":_.push({label:"Arc",values:{id:null!==(p=null===(y=P.datum)||void 0===y?void 0:y.id)&&void 0!==p?p:"",x:null!==(v=P.cx)&&void 0!==v?v:P.x,y:null!==(m=P.cy)&&void 0!==m?m:P.y}});break;case"candlestick":_.push({label:"Candlestick",values:{x:P.x,open:P.open,high:P.high,low:P.low,close:P.close}});break;case"geoarea":_.push({label:"Region",values:{name:null!==(A=null!==(k=null===(b=null===(x=P.datum)||void 0===x?void 0:x.properties)||void 0===b?void 0:b.name)&&void 0!==k?k:null===(w=P.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(M=null===(S=P.datum)||void 0===S?void 0:S.value)&&void 0!==M?M:""}})}}catch(t){}return _}(n),m=function(t){if(!t||0===t.length)return[];const e=new Set;for(const n of t)if(n&&n.values)for(const t of Object.keys(n.values))e.add(t);const n=[];for(const i of e){const e=[],o=new Set;for(const n of t){if(!n||!n.values)continue;const t=n.values[i];null!=t&&""!==t&&("number"==typeof t&&!Number.isNaN(t)&&Number.isFinite(t)?e.push(t):"number"==typeof t||"object"!=typeof t&&"function"!=typeof t&&o.add(t+""))}if(e.length>0){let t=e[0],o=e[0],r=0;for(const n of e)t>n&&(t=n),n>o&&(o=n),r+=n;n.push({name:i,count:e.length,numeric:!0,min:t,max:o,mean:r/e.length})}else if(o.size>0){const t=Array.from(o);n.push({name:i,count:t.length,numeric:!1,uniqueValues:t.slice(0,5)})}}return n}(v),x=function(t,e){const n=[t+" data points."];for(const t of e)if(t.numeric)n.push(`${t.name}: ${mi(t.min)} to ${mi(t.max)}, mean ${mi(t.mean)}.`);else{const e=t.uniqueValues,i=e.length>3?`${e.slice(0,3).join(", ")}… (${t.count} unique)`:e.join(", ");n.push(`${t.name}: ${i}.`)}return n.join(" ")}(v.length,m),b=v.slice(0,5),k=new Set;for(const t of b)for(const e of Object.keys(t.values))k.add(e);const w=Array.from(k);return e("div",{ref:f,id:r,className:ki,tabIndex:-1,onBlur:p,style:Ai,role:"region","aria-label":g,children:[t("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Mi,children:"×"}),t("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Si,children:x}),e("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+o,style:_i,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Ti,children:["First ",b.length," of ",v.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Pi,children:"type"}),w.map(e=>t("th",{style:Pi,children:e},e))]})}),t("tbody",{children:b.map((n,i)=>e("tr",{children:[t("td",{style:Ci,children:n.label}),w.map(e=>{return t("td",{style:Ci,children:(i=n.values[e],null==i||""===i?"—":"number"==typeof i?Number.isNaN(i)?"—":mi(i):"boolean"==typeof i?i?"true":"false":"object"==typeof i?"—":i+"")},e);var i})]},i))})]})]})}function Oi({nodes:n,edges:o,chartType:r,tableId:l,chartTitle:s}){var a,c,u,d,h,f,g,y,p,v,m,x,b,k;const[w,A]=i.useState(!1),S=gi(),M=null!==(a=null==S?void 0:S.visible)&&void 0!==a&&a,_=w||M,P=s?"Data summary for "+s:l?`Data summary for ${r} ${l}`:"Data summary for "+r,C=i.useRef(null),T=i.useCallback(()=>{w||M||A(!0)},[w,M]),E=i.useCallback(t=>{var e;M||(null===(e=C.current)||void 0===e?void 0:e.contains(t.relatedTarget))||A(!1)},[M]);if(!n||0===n.length)return l?t("span",{id:l,tabIndex:-1,style:yi}):null;if(!_)return t("div",{id:l,className:bi,tabIndex:-1,onFocus:T,style:yi,role:"region","aria-label":P,children:e("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",o.length," edges)"]})});const O=Array.isArray(n)?n:[],D=Array.isArray(o)?o:[],L=new Map,N=new Map,$=new Map,I=new Map;for(const t of D){if(!t||"object"!=typeof t)continue;const e=null!==(c=t.datum)&&void 0!==c?c:t,n="object"==typeof e.source?null===(u=e.source)||void 0===u?void 0:u.id:e.source,i="object"==typeof e.target?null===(d=e.target)||void 0===d?void 0:d.id:e.target,o="number"==typeof e.value&&Number.isFinite(e.value)?e.value:0;if(null!=n&&""!==n){const t=n+"";N.set(t,(null!==(h=N.get(t))&&void 0!==h?h:0)+1),I.set(t,(null!==(f=I.get(t))&&void 0!==f?f:0)+o)}if(null!=i&&""!==i){const t=i+"";L.set(t,(null!==(g=L.get(t))&&void 0!==g?g:0)+1),$.set(t,(null!==(y=$.get(t))&&void 0!==y?y:0)+o)}}const W=[];for(let t=0;O.length>t;t++){const e=O[t];if(!e||"object"!=typeof e)continue;const n=null!==(v=null===(p=e.datum)||void 0===p?void 0:p.id)&&void 0!==v?v:e.id,i=null!=n?n+"":"node-"+t,o=null!==(m=L.get(i))&&void 0!==m?m:0,r=null!==(x=N.get(i))&&void 0!==x?x:0,l=null!==(b=$.get(i))&&void 0!==b?b:0,s=null!==(k=I.get(i))&&void 0!==k?k:0;W.push({id:i,degree:o+r,inDeg:o,outDeg:r,wDegree:l+s,wInDeg:l,wOutDeg:s})}W.sort((t,e)=>e.degree-t.degree);let z=0,R=0;if(W.length>0){let t=0;for(const e of W)t+=e.degree,e.degree>R&&(R=e.degree);z=t/W.length}const F=D.some(t=>{var e;const n=null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),Y=[`${W.length} nodes, ${D.length} edges.`];W.length>0&&Y.push(`Mean degree: ${mi(z)}, max degree: ${R}.`);const j=W.slice(0,5);return e("div",{ref:C,id:l,className:wi,tabIndex:-1,onBlur:E,style:Ai,role:"region","aria-label":P,children:[t("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{M&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Mi,children:"×"}),t("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Si,children:Y.join(" ")}),e("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:_i,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Ti,children:["Top ",j.length," of ",W.length," nodes by degree"]}),t("thead",{children:e("tr",{children:[t("th",{style:Pi,children:"id"}),t("th",{style:Pi,children:"degree"}),t("th",{style:Pi,children:"in"}),t("th",{style:Pi,children:"out"}),F&&t("th",{style:Pi,children:"w. degree"}),F&&t("th",{style:Pi,children:"w. in"}),F&&t("th",{style:Pi,children:"w. out"})]})}),t("tbody",{children:j.map((n,i)=>e("tr",{children:[t("td",{style:Ci,children:n.id}),t("td",{style:Ci,children:n.degree}),t("td",{style:Ci,children:n.inDeg}),t("td",{style:Ci,children:n.outDeg}),F&&t("td",{style:Ci,children:mi(n.wDegree)}),F&&t("td",{style:Ci,children:mi(n.wInDeg)}),F&&t("td",{style:Ci,children:mi(n.wOutDeg)})]},i))})]})]})}function Di({summary:e}){return e?t("div",{role:"note",style:yi,children:e}):null}function Li({tableId:e}){return t("a",{href:"#"+e,style:yi,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:t=>{Object.assign(t.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:t=>{const e=t.currentTarget;e.removeAttribute("style"),Object.assign(e.style,yi)},children:"Skip to data table"})}function Ni({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,t])=>"object"!=typeof t&&"function"!=typeof t).map(([t,e])=>`${t}: ${e}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:yi,children:n})}const $i="var(--semiotic-focus, #005fcc)";function Ii({active:e,hoverPoint:n,margin:i,size:o,shape:r="circle",width:l,height:s}){if(!e||!n)return null;const a=n.x+i.left,c=n.y+i.top;let u;if("rect"===r&&null!=l&&null!=s){const e=Math.max(l,4),n=Math.max(s,4);u=t("rect",{x:a-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:$i,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:$i,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:$i,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Wi(t){return Array.isArray(t)?t[0]:t}function zi(t,e,n,i){return Object.assign({data:Wi(t),x:e,y:n,__semioticHoverData:!0},i)}const Ri={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Fi({x:e,y:n,containerWidth:o,containerHeight:r,margin:l,children:s,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(e)&&Number.isFinite(n),d=i.useRef(null),[h,f]=i.useState(null);i.useLayoutEffect(()=>{const t=d.current;if(!t)return;const e=t.getBoundingClientRect();f(t=>t&&t.width===e.width&&t.height===e.height?t:{width:e.width,height:e.height})},[s,a,o,r]);let g;g=h?`translate(${h.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const y=function(t){if(!i.isValidElement(t))return!1;const e=t.type;if("string"!=typeof e&&e&&!0===e.ownsChrome)return!0;const n=t.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),p=y?null:Ri;return u?t("div",{ref:d,className:y?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:l.left+e,top:l.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}const Yi="undefined"==typeof window?l:h;function ji(t,e,n){return"function"==typeof t?t({size:e,margin:n}):t}function Bi(t){const e=function(){const[t,e]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-reduced-motion: reduce)");return e(t.matches),function(t,e){if("function"==typeof t.addEventListener)return t.addEventListener("change",e),()=>t.removeEventListener("change",e);const n=t;return n.addListener(e),()=>n.removeListener(e)}(t,t=>e(t.matches))},[]),t}(),n=o(e);n.current=e;const[s,c]=function(t,e,n){const i=o(null),[r,s]=d(null);return l(()=>{if(!e&&!n)return;const t=i.current;if(!t)return;const o=new ResizeObserver(t=>{for(const e of t){const{width:t,height:n}=e.contentRect;s(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n})}});return o.observe(t),()=>o.disconnect()},[e,n]),[i,[e&&r?r.w:t[0],n&&r?r.h:t[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),u=r(()=>Object.assign(Object.assign({},t.marginDefault),t.userMargin),[t.marginDefault,t.userMargin]),h=c[0]-u.left-u.right,f=c[1]-u.top-u.bottom,g=ji(t.foregroundGraphics,c,u),y=ji(t.backgroundGraphics,c,u),p=Mt(t=>t.theme),{transition:v,introEnabled:m}=function(t,e){var n,i;if(!1===t)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:t?!0===t?{duration:300}:{duration:null!==(i=t.duration)&&void 0!==i?i:300,easing:"linear"===t.easing?"linear":"ease-out"}:e,introEnabled:!(o||!t||!0!==t&&!1===t.intro)}}(t.animate,t.transitionProp),x="semiotic-table-"+i.useId(),b=o(0),k=o(()=>{}),w=a(()=>{b.current||(b.current=requestAnimationFrame(()=>k.current()))},[]);l(()=>()=>{b.current&&(cancelAnimationFrame(b.current),b.current=0)},[]);const A=o(()=>{}),S=o(()=>{}),M=o(null),_=o(0),P=a(()=>{_.current=0;const t=M.current;M.current=null,t&&A.current(t)},[]),C=a(t=>{M.current={clientX:t.clientX,clientY:t.clientY},0===_.current&&(_.current=requestAnimationFrame(P))},[P]),T=a(()=>{M.current=null,0!==_.current&&(cancelAnimationFrame(_.current),_.current=0),S.current()},[]);l(()=>()=>{M.current=null,0!==_.current&&(cancelAnimationFrame(_.current),_.current=0)},[]);const E=t.themeDirtyRef;return Yi(()=>{E&&(De++,E.current=!0,w())},[p,w,E]),{reducedMotion:e,reducedMotionRef:n,responsiveRef:s,size:c,margin:u,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:y,currentTheme:p,transition:v,introEnabled:m,tableId:x,rafRef:b,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:C,onPointerLeave:T}}function Hi(t,e,n,i){const o=t.getContext("2d");if(!o)return null;const r=e[0]*i,l=e[1]*i,s=e[0]+"px",a=e[1]+"px";return t.style.width!==s&&(t.style.width=s),t.style.height!==a&&(t.style.height=a),t.width===r&&t.height===l||(t.width=r,t.height=l),o.setTransform(i,0,0,i,0,0),o.translate(n.left,n.top),o}function Xi(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Gi(t,e,n){let i=n;for(const n of e)"lesser"===n.thresholdType?n.value>t&&(i=n.color):t>n.value&&(i=n.color);return i}function Vi(t,e,n,i,o,r){if(2>e.length)return;const l=[0];for(let t=1;e.length>t;t++){const n=e[t][0]-e[t-1][0],i=e[t][1]-e[t-1][1];l.push(l[t-1]+Math.sqrt(n*n+i*i))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);t.strokeStyle=n,t.lineWidth=i,t.lineCap=r;for(let n=0;e.length-1>n;n++){const i=(l[n]+l[n+1])/2;let r=o;a>i&&(r*=i/a),a>s-i&&(r*=(s-i)/a),t.globalAlpha=Math.max(0,r),t.beginPath(),t.moveTo(e[n][0],e[n][1]),t.lineTo(e[n+1][0],e[n+1][1]),t.stroke()}}const qi=(t,e,n,i)=>{var o,r;const l=e.filter(t=>"line"===t.type);for(const s of l){if(2>s.path.length)continue;const a=s._introClipFraction;void 0!==a&&1>a&&(t.save(),t.beginPath(),t.rect(0,0,i.width*a,i.height),t.clip());const c=s.style.stroke||"#007bff",u=We(t,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,f=s.rawValues;if(t.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(t.globalAlpha=s.style.opacity),t.lineWidth=d,t.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const v=null!==(o=s.style.opacity)&&void 0!==o?o:1;Vi(t,s.path,u,d,v,s.style.strokeLinecap||"butt"),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt";continue}const g=ze(s.curve),y=h&&h.length>0&&f&&f.length===s.path.length,p=s._decayOpacities;if(p&&p.length===s.path.length&&!y){t.strokeStyle=u;const m=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let x=0;s.path.length-1>x;x++)t.globalAlpha=.5*(p[x]+p[x+1])*m,t.beginPath(),t.moveTo(s.path[x][0],s.path[x][1]),t.lineTo(s.path[x+1][0],s.path[x+1][1]),t.stroke()}else if(y){let b=null,k=null,w=null,A=null,S=!1;function M(e,n,i){t.beginPath(),t.strokeStyle=e,t.moveTo(n,i),S=!0}function _(){S&&(t.stroke(),S=!1)}for(let P=0;s.path.length>P;P++){const[C,T]=s.path[P],E=f[P],O=Gi(E,h,u);if(null!==b&&null!==A&&null!==w){if(O===A)t.lineTo(C,T);else{const D=[];for(const N of h){const $=N.value;(w>$||$>E)&&($>w||E>$)||w===$||E===$||D.push({t:($-w)/(E-w)})}D.sort((t,e)=>t.t-e.t);for(const I of D){const W=b+(C-b)*I.t,z=k+(T-k)*I.t,R=Gi(w+(E-w)*Math.min(I.t+1e-4,1),h,u);t.lineTo(W,z),_(),M(R,W,z)}t.lineTo(C,T)}b=C,k=T,w=E,A=O}else M(O,C,T),b=C,k=T,w=E,A=O}_()}else{t.beginPath();const F=s.strokeGradient&&s.path.length>=2?Ye(t,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(t.strokeStyle=F||u,g)L().x(t=>t[0]).y(t=>t[1]).curve(g).context(t)(s.path);else{const[Y,j]=s.path[0];t.moveTo(Y,j);for(let B=1;s.path.length>B;B++)t.lineTo(s.path[B][0],s.path[B][1])}t.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(t.beginPath(),t.globalAlpha=s.style.fillOpacity,t.fillStyle=Re(t,s.style.fill,s.style.fill),g&&!y)L().x(t=>t[0]).y(t=>t[1]).curve(g).context(t)(s.path);else{const[X,G]=s.path[0];t.moveTo(X,G);for(let V=1;s.path.length>V;V++)t.lineTo(s.path[V][0],s.path[V][1])}const H=s.path[0][0];t.lineTo(s.path[s.path.length-1][0],i.height),t.lineTo(H,i.height),t.closePath(),t.fill()}void 0!==a&&1>a&&t.restore(),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt"}};function Ui(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Ki(t,e,n=.3){Ui(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Zi(t,e,n=.6){var i,o,r,l,s;if(!Ui(e))return;const a=null!==(i=e._pulseGlowRadius)&&void 0!==i?i:4,c=e.r+a*e._pulseIntensity,u=null!==(r=null!==(o=e.cx)&&void 0!==o?o:e.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=e.cy)&&void 0!==l?l:e.y)&&void 0!==s?s:0;t.beginPath(),t.arc(u,d,c,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Qi(t,e,n,i=.35){Ui(e)&&(t.globalAlpha=e._pulseIntensity*i,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fill())}function Ji(t,e){const n=ze(e.curve);if(!n||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1]);for(let n=e.bottomPath.length-1;n>=0;n--)t.lineTo(e.bottomPath[n][0],e.bottomPath[n][1]);t.closePath()}else{const i=N().x(t=>t[0]).y0((t,n)=>e.bottomPath[n][1]).y1(t=>t[1]).curve(n).context(t);t.beginPath(),i(e.topPath)}}const to=(t,e,n,i)=>{var o,r,l;const s=e.filter(t=>"area"===t.type);for(const e of s){if(2>e.topPath.length)continue;let n=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),n=!0);const s=e._introClipFraction;void 0!==s&&1>s&&(t.save(),t.beginPath(),t.rect(0,0,i.width*s,i.height),t.clip());const a=Re(t,e.style.fill,"#4e79a7"),c=e._decayOpacities;if(c&&c.length===e.topPath.length){const n=null!==(o=e.style.fillOpacity)&&void 0!==o?o:.7;t.fillStyle=a;for(let i=0;e.topPath.length-1>i;i++)t.globalAlpha=.5*(c[i]+c[i+1])*n,t.beginPath(),t.moveTo(e.topPath[i][0],e.topPath[i][1]),t.lineTo(e.topPath[i+1][0],e.topPath[i+1][1]),t.lineTo(e.bottomPath[i+1][0],e.bottomPath[i+1][1]),t.lineTo(e.bottomPath[i][0],e.bottomPath[i][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let n=0;e.topPath.length-1>n;n++)t.globalAlpha=.5*(c[n]+c[n+1]),t.beginPath(),t.moveTo(e.topPath[n][0],e.topPath[n][1]),t.lineTo(e.topPath[n+1][0],e.topPath[n+1][1]),t.stroke()}t.globalAlpha=1;continue}const u=null!==(r=e.style.opacity)&&void 0!==r?r:1;if(Ji(t,e),e.fillGradient&&("colorStops"in e.fillGradient&&e.fillGradient.colorStops.length>=2||"topOpacity"in e.fillGradient)&&e.fillGradient){let n=1/0;for(const t of e.topPath)n>t[1]&&(n=t[1]);let i=-1/0;for(const t of e.bottomPath)t[1]>i&&(i=t[1]);const o=Fe(t,e.fillGradient,"string"==typeof a?a:"#4e79a7",0,n,0,i);t.fillStyle=o||a,t.globalAlpha=u}else{const n=null!==(l=e.style.fillOpacity)&&void 0!==l?l:.7;t.globalAlpha=n*u,t.fillStyle=a}if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(Ji(t,e),Qi(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=u;const n=e.strokeGradient&&e.topPath.length>=2?Ye(t,e.strokeGradient,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0):null;t.strokeStyle=n||We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);const i=ze(e.curve);if(t.beginPath(),i)L().x(t=>t[0]).y(t=>t[1]).curve(i).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1])}t.stroke()}void 0!==s&&1>s&&t.restore(),n&&t.restore(),t.globalAlpha=1}},eo=(t,e,n,i)=>{var o;const r=e.filter(t=>"point"===t.type);if(0!==r.length){t.save();try{for(const e of r){t.beginPath(),t.arc(e.x,e.y,e.r,0,2*Math.PI);const n=null!==(o=e.style.opacity)&&void 0!==o?o:e.style.fillOpacity;null!=n&&(t.globalAlpha=n),t.fillStyle=Re(t,e.style.fill,"#4e79a7"),t.fill(),e.style.stroke&&(t.strokeStyle=Re(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth||1,t.stroke()),Zi(t,e),t.globalAlpha=1}}finally{t.restore()}}};function no(t,e){const{x:n,y:i,w:o,h:r}=e,{tl:l,tr:s,br:a,bl:c}=function(t){const e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(t.w,t.h)/2,i=t=>Math.max(0,Math.min(null!=t?t:0,n));return{tl:i(e.tl),tr:i(e.tr),br:i(e.br),bl:i(e.bl)}}(e);t.beginPath(),t.moveTo(n+l,i),t.lineTo(n+o-s,i),s>0&&t.arcTo(n+o,i,n+o,i+s,s),t.lineTo(n+o,i+r-a),a>0&&t.arcTo(n+o,i+r,n+o-a,i+r,a),t.lineTo(n+c,i+r),c>0&&t.arcTo(n,i+r,n,i+r-c,c),t.lineTo(n,i+l),l>0&&t.arcTo(n,i,n+l,i,l),t.closePath()}function io(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}const oo=(t,e,n,i)=>{const o=e.filter(t=>"rect"===t.type);for(const e of o){if(null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.icon)ro(t,e);else if(e.cornerRadii&&Qn(e.cornerRadii)){const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=io(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n,no(t,e),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else if(e.roundedTop&&e.roundedTop>0){const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=io(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n;const r=Math.min(e.roundedTop,e.w/2,e.h/2);t.beginPath();const{x:l,y:s,w:a,h:c}=e;switch(e.roundedEdge){case"right":t.moveTo(l,s),t.lineTo(l+a-r,s),t.arcTo(l+a,s,l+a,s+r,r),t.lineTo(l+a,s+c-r),t.arcTo(l+a,s+c,l+a-r,s+c,r),t.lineTo(l,s+c);break;case"left":t.moveTo(l+a,s),t.lineTo(l+r,s),t.arcTo(l,s,l,s+r,r),t.lineTo(l,s+c-r),t.arcTo(l,s+c,l+r,s+c,r),t.lineTo(l+a,s+c);break;case"bottom":t.moveTo(l,s),t.lineTo(l+a,s),t.lineTo(l+a,s+c-r),t.arcTo(l+a,s+c,l+a-r,s+c,r),t.lineTo(l+r,s+c),t.arcTo(l,s+c,l,s+c-r,r);break;default:t.moveTo(l,s+c),t.lineTo(l,s+r),t.arcTo(l,s,l+r,s,r),t.lineTo(l+a-r,s),t.arcTo(l+a,s,l+a,s+r,r),t.lineTo(l+a,s+c)}t.closePath(),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else{const n=Re(t,e.style.fill,We(t,"var(--semiotic-primary, #007bff)")),i=io(e),o=e.fillGradient&&"string"==typeof n?Fe(t,e.fillGradient,n,i.x0,i.y0,i.x1,i.y1):null;t.fillStyle=o||n,t.fillRect(e.x,e.y,e.w,e.h),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.strokeRect(e.x,e.y,e.w,e.h))}Ki(t,e),t.globalAlpha=1}};function ro(t,e){const n=e.style.icon,i=e.style.iconPadding||2,o=Math.min(e.w,e.h)-i;if(0>=o)return;const r=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),r){const r=o+i,l=e.x+(e.w-o)/2;for(let i=e.y+e.h-o;i>=e.y-o;i-=r)t.drawImage(n,l,i,o,o)}else{const r=o+i,l=e.y+(e.h-o)/2;for(let i=e.x;e.x+e.w>i;i+=r)t.drawImage(n,i,l,o,o)}t.restore()}function lo(t){const[e,n,i]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*i>128?"#000":"#fff"}function so(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}const ao=(t,e,n,i)=>{const o=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of o){const n=e.style;if(null!=(null==n?void 0:n.opacity)&&(t.globalAlpha=n.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h),t.strokeStyle=We(t,"var(--semiotic-surface, #fff)"),t.lineWidth=1,t.strokeRect(e.x,e.y,e.w,e.h),Ki(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const n=e.valueFormat?e.valueFormat(e.value):so(e.value),i=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),o=e.x+e.w/2,r=e.y+e.h/2;t.fillStyle=lo(e.fill),t.font=i+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(n,o,r)}}}finally{t.restore()}},co=(t,e,n,i)=>{var o,r,l;for(const n of e){if("candlestick"!==n.type)continue;const e=n;t.save();const s=(null!==(o=e._decayOpacity)&&void 0!==o?o:1)*(null!==(l=null===(r=e.style)||void 0===r?void 0:r.opacity)&&void 0!==l?l:1);1!==s&&(t.globalAlpha=s);const a=We(t,e.wickColor)||e.wickColor,c=60>i.height,u=c?Math.max(e.wickWidth,2):e.wickWidth,d=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=a,t.lineWidth=u,t.stroke()};if(c||d(),e.isRange){const n=Math.max(2,Math.min(e.bodyWidth/2,.12*i.height));t.fillStyle=a,t.beginPath(),t.arc(e.x,e.highY,n,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,n,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const n=Math.min(e.openY,e.closeY),i=Math.abs(e.openY-e.closeY),o=e.isUp?e.upColor:e.downColor,r=We(t,o)||o;t.fillStyle=r,t.fillRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(i,1)),t.strokeStyle=r,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(i,1))}c&&d(),t.restore()}};function uo(t,e,n,i){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:i,fn:e}:{key:void 0,fn:null}}const ho=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fo(t){const e=t[1]-t[0],n=3156e7;return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:n>e?t=>{const e=new Date(t);return`${ho[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*n>e?t=>{const e=new Date(t);return`${ho[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}const go={line:[to,qi,eo],area:[to,eo],stackedarea:[to,eo],scatter:[eo],bubble:[eo],heatmap:[ao],bar:[oo],swarm:[eo],waterfall:[(t,e,n,i)=>{var o;oo(t,e);const r=e.filter(t=>"rect"===t.type);if(2>r.length)return;const l=r[0].datum,s=null==l?void 0:l._connectorStroke;if(s){t.save(),t.strokeStyle=We(t,s)||s,t.lineWidth=null!==(o=null==l?void 0:l._connectorWidth)&&void 0!==o?o:1,t.setLineDash([]);for(let e=0;r.length-1>e;e++){const i=r[e],o=r[e+1],l=i.datum,s=o.datum;if(null==(null==l?void 0:l.cumEnd)||null==(null==s?void 0:s.baseline))continue;const a=n.y(l.cumEnd),c=i.x+i.w,u=o.x;t.beginPath(),t.moveTo(c,a),t.lineTo(u,a),t.stroke()}t.restore()}}],candlestick:[co],mixed:[to,qi,eo],custom:[to,oo,ao,qi,eo,co]},yo={top:20,right:20,bottom:30,left:40},po={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function vo(t,e){const n=t.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const t=n[1],i=n[2],o=n[3];return`#${t}${t}${i}${i}${o}${o}${e}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${e}`;const i=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return i?`rgba(${i[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:n}const mo={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 xo({hover:n}){var i,o,r;const l=t=>null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+"",s=null!==(i=n.data)&&void 0!==i?i:{},a=null!==(o=s.y)&&void 0!==o?o:s.value,c=null!==(r=s.x)&&void 0!==r?r:s.time;return e("div",{className:"semiotic-tooltip",style:mo,children:[t("div",{style:{fontWeight:600,marginBottom:2},children:l(a)}),t("div",{style:{opacity:.7,fontSize:11},children:l(c)})]})}xo.ownsChrome=!0;const bo=f(function(n,s){var c,u,h,f,p,v,m,x,b,k,w,A,S;const{chartType:M,runtimeMode:_,data:P,chunkThreshold:C,chunkSize:T,xAccessor:E,yAccessor:O,colorAccessor:D,sizeAccessor:L,groupAccessor:N,lineDataAccessor:$,curve:I,normalize:W,baseline:z,stackOrder:R,binSize:F,valueAccessor:Y,arrowOfTime:j="right",windowMode:B="sliding",windowSize:H=200,timeAccessor:X,xExtent:G,yExtent:V,extentPadding:q=.1,scalePadding:U,sizeRange:K,size:Z=[500,300],responsiveWidth:Q,responsiveHeight:J,margin:tt,className:et,background:nt,lineStyle:it,pointStyle:ot,areaStyle:rt,barStyle:lt,waterfallStyle:st,swarmStyle:at,barColors:ct,colorScheme:ut,boundsAccessor:ht,boundsStyle:yt,y0Accessor:pt,band:mt,gradientFill:xt,lineGradient:bt,areaGroups:kt,openAccessor:wt,highAccessor:At,lowAccessor:St,closeAccessor:Mt,candlestickStyle:_t,showAxes:Pt=!0,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:Dt,yFormat:Lt,axisExtent:Nt,tickFormatTime:$t,tickFormatValue:It,hoverAnnotation:Wt,tooltipContent:zt,customHoverBehavior:Rt,customClickBehavior:Ft,enableHover:Yt,hoverRadius:jt=30,tooltipMode:Bt,annotations:Ht,svgAnnotationRules:Xt,showGrid:Gt,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,legendLayout:Jt,legendCategoryAccessor:te,onCategoriesChange:ee,backgroundGraphics:ne,foregroundGraphics:ie,canvasPreRenderers:oe,svgPreRenderers:re,title:le,categoryAccessor:se,brush:ae,onBrush:ce,decay:ue,pulse:de,transition:he,animate:fe,staleness:ge,heatmapAggregation:pe,heatmapXBins:ve,heatmapYBins:me,showValues:xe,heatmapValueFormat:be,marginalGraphics:ke,pointIdAccessor:we,xScaleType:Me,yScaleType:_e,accessibleTable:Pe=!0,description:Ce,summary:Te,linkedCrosshairName:Ee,linkedCrosshairSourceId:Oe,customLayout:De,layoutConfig:Le}=n,Ne=g().replace(/:/g,""),$e=o(!1),Ie=Bi({sizeProp:Z,responsiveWidth:Q,responsiveHeight:J,userMargin:tt,marginDefault:yo,animate:fe,transitionProp:he,themeDirtyRef:$e}),ze=ii(),Re=si(),{reducedMotionRef:Fe,responsiveRef:Ye,size:je,currentTheme:Ge,transition:Ve,introEnabled:qe,tableId:Ue,rafRef:Ke,renderFnRef:Ze,scheduleRender:Qe}=Ie;let on=Ie.margin;if(ke){const t=60,e=Object.assign({},Ie.margin);ke.top&&t>e.top&&(e.top=t),ke.bottom&&t>e.bottom&&(e.bottom=t),ke.left&&t>e.left&&(e.left=t),ke.right&&t>e.right&&(e.right=t),on=e}const rn="function"==typeof ie?ie({size:je,margin:on}):ie,an="function"==typeof ne?ne({size:je,margin:on}):ne,cn=je[0]-on.left-on.right,un=je[1]-on.top-on.bottom,dn=r(()=>ft(P),[P]),hn=null!=Wt?Wt:Yt,fn=o(null),gn=o(null),[yn,pn]=d(0),[vn,mn]=d(null),xn=o(null),bn=o(null),[kn,wn]=d(null),An=o(po.primary),Sn=o([]),Mn=o(te),_n=o(ee);Mn.current=te,_n.current=ee;const[Pn,Cn]=d(!1),[Tn,En]=d([]),[On,Dn]=d([]),Ln="streaming"===_||["bar","swarm","waterfall"].includes(M),Nn=r(()=>{var t,e,n;return{chartType:M,runtimeMode:Ln?"streaming":"bounded",windowSize:H,windowMode:B,arrowOfTime:Ln?j:"right",extentPadding:q,scalePadding:U,axisExtent:Nt,xAccessor:E,yAccessor:O,timeAccessor:Ln?X:void 0,valueAccessor:Y,colorAccessor:D,sizeAccessor:L,groupAccessor:N||($?"_lineGroup":void 0),categoryAccessor:se,lineDataAccessor:$,xScaleType:Me,yScaleType:_e,xExtent:G,yExtent:V,sizeRange:K,binSize:F,normalize:W,baseline:z,stackOrder:R,boundsAccessor:ht,boundsStyle:yt,y0Accessor:pt,band:mt,gradientFill:!0===xt?{topOpacity:.8,bottomOpacity:.05}:!1===xt?void 0:xt,areaGroups:kt?new Set(kt):void 0,lineGradient:bt,openAccessor:wt,highAccessor:At,lowAccessor:St,closeAccessor:Mt,candlestickStyle:_t,lineStyle:it,pointStyle:ot,areaStyle:rt,swarmStyle:at,waterfallStyle:st,colorScheme:ut,barColors:ct,barStyle:lt,annotations:Ht,decay:ue,pulse:de,transition:Ve,introAnimation:qe,staleness:ge,heatmapAggregation:pe,heatmapXBins:ve,heatmapYBins:me,showValues:xe,heatmapValueFormat:be,pointIdAccessor:we,curve:I,themeCategorical:null===(t=null==Ge?void 0:Ge.colors)||void 0===t?void 0:t.categorical,themeSemantic:vt(Ge),themeSequential:null===(e=null==Ge?void 0:Ge.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(n=null==Ge?void 0:Ge.colors)||void 0===n?void 0:n.diverging,customLayout:De,layoutConfig:Le,layoutMargin:on}},[M,H,B,j,q,U,Nt,E,O,X,Y,Me,_e,D,L,N,se,$,G,V,K,F,W,z,R,ht,yt,pt,mt,xt,bt,kt,wt,At,St,Mt,_t,it,ot,rt,at,st,lt,ut,ct,Ht,ue,de,null==Ve?void 0:Ve.duration,null==Ve?void 0:Ve.easing,qe,ge,pe,ve,me,xe,be,Ln,we,I,Ge,De,Le,on]),$n=ci(Nn),In=o(null);In.current||(In.current=new Ae($n));const Wn=a(()=>{var t,e;const n=Mn.current,i=_n.current;if(!i||!n)return;const o=function(t,e){if(!e)return[];const n=new Set,i=[];for(const o of t){if(!o||"object"!=typeof o)continue;const t="function"==typeof e?e(o):o[e];if(null==t)continue;const r=t+"";n.has(r)||(n.add(r),i.push(r))}return i}(null!==(e=null===(t=In.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[],n);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(o,Sn.current)||(Sn.current=o,i(o))},[]);l(()=>{var t;null===(t=In.current)||void 0===t||t.updateConfig($n),$e.current=!0,Qe()},[$n,Qe]);const zn=o(null);zn.current||(zn.current=new gt(t=>{const e=In.current;e&&e.ingest(t)&&($e.current=!0,Qe())},{chunkThreshold:C,chunkSize:T})),l(()=>{var t;null===(t=zn.current)||void 0===t||t.updateChunkOptions({chunkThreshold:C,chunkSize:T})},[C,T]);const Rn=a(t=>{var e;null===(e=zn.current)||void 0===e||e.push(t)},[]),Fn=a(t=>{var e;null===(e=zn.current)||void 0===e||e.pushMany(t)},[]),Yn=a(()=>{var t,e;null===(t=zn.current)||void 0===t||t.clear(),null===(e=In.current)||void 0===e||e.clear(),$e.current=!0,Qe()},[Qe]);y(s,()=>({push:Rn,pushMany:Fn,remove:t=>{var e,n,i;null===(e=zn.current)||void 0===e||e.flush();const o=null!==(i=null===(n=In.current)||void 0===n?void 0:n.remove(t))&&void 0!==i?i:[];return o.length>0&&(xn.current&&o.some(t=>{var e;return t===(null===(e=xn.current)||void 0===e?void 0:e.data)})&&(xn.current=null,wn(null)),$e.current=!0,Qe()),o},update:(t,e)=>{var n,i,o;null===(n=zn.current)||void 0===n||n.flush();const r=null!==(o=null===(i=In.current)||void 0===i?void 0:i.update(t,e))&&void 0!==o?o:[];return r.length>0&&($e.current=!0,Qe()),r},clear:Yn,getData:()=>{var t,e,n;return null===(t=zn.current)||void 0===t||t.flush(),null!==(n=null===(e=In.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var t,e;return null!==(e=null===(t=In.current)||void 0===t?void 0:t.scales)&&void 0!==e?e:null},getExtents:()=>{var t,e;return null!==(e=null===(t=In.current)||void 0===t?void 0:t.getExtents())&&void 0!==e?e:null}}),[Rn,Fn,Yn,Qe]),l(()=>{var t,e;if(P){if($&&dn.length>0&&"object"==typeof dn[0]&&null!==dn[0]){const e="string"==typeof $?$:"coordinates";if(Array.isArray(dn[0][e])){const n=[];for(const t of dn){const i=t[e];if(Array.isArray(i)){const e=t.label||t.id||t.key;if(null!=e)for(const t of i)n.push(Object.assign(Object.assign({},t),{_lineGroup:e}));else for(const t of i)n.push(t)}}return void(null===(t=zn.current)||void 0===t||t.setBoundedData(n))}}null===(e=zn.current)||void 0===e||e.setBoundedData(dn)}},[P,dn,$]);const{hoverHandlerRef:jn,hoverLeaveRef:Bn,onPointerMove:Hn,onPointerLeave:Xn}=Ie;jn.current=t=>{var e,n;if(!hn)return;const i=fn.current;if(!i)return;const o=i.getBoundingClientRect(),r=t.clientX-o.left-on.left,l=t.clientY-o.top-on.top;if(0>r||r>cn||0>l||l>un)return void(xn.current&&(xn.current=null,bn.current=null,wn(null),Rt&&(Rt(null),$e.current=!0),Qe()));const s=In.current;if(!s||0===s.scene.length)return;const a=He(s.scene,r,l,jt,s.quadtree,s.maxPointRadius),c="multi"===Bt,u=()=>{xn.current&&(xn.current=null,bn.current=null,wn(null),Rt&&Rt(null),Qe())};if(!a&&!c)return void u();const d=c||!a?r:a.x,h=c||!a?l:a.y;let f=zi((null==a?void 0:a.datum)?ye(a.datum,s.resolvedRibbons):{},d,h);if(c&&s.scene.length>0&&s.scales){const t=function(t,e,n=30){const i=[];for(const o of t)if("line"===o.type){const t=o;if(2>t.path.length)continue;const r=Xe(Be(t.path,t.curve),e,n);if(null===r)continue;const l=Je(t.path,e);i.push({node:o,datum:Array.isArray(t.datum)&&t.datum[l]?t.datum[l]:t.datum,x:t.path[l][0],y:r,group:t.group,color:t.style.stroke})}else if("area"===o.type){const t=o;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const r=Be(t.topPath,t.curve),l=Be(t.bottomPath,t.curve),s=Xe(r,e,n);if(null===s)continue;const a=Xe(l,e,n),c=Je(t.topPath,e);i.push({node:o,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:s,y0:null!=a?a:void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return i}(s.scene,d,Math.max(jt,cn));if(t.length>0){const e=s.scales.y.invert,n=s.scales.x.invert,i=An.current,o=n?n(d):d;if(a)f.xValue=o,f.xPx=d;else{const t={xValue:o};"string"==typeof E&&(t[E]=o),f=zi(t,d,h,{xValue:o,xPx:d})}f.allSeries=t.map(t=>{const n=e?e(t.y):t.y,o=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===M&&null!=o?n-o:n,valuePx:t.y,color:t.color||i,datum:ye(t.datum,s.resolvedRibbons)}})}}a||(null===(e=f.allSeries)||void 0===e?void 0:e.length)?(xn.current=f,bn.current=null!==(n=null==a?void 0:a.node)&&void 0!==n?n:null,wn(f),Rt&&(Rt(f),$e.current=!0),Qe()):u()},Bn.current=()=>{xn.current&&(xn.current=null,bn.current=null,wn(null),Rt&&(Rt(null),$e.current=!0),Qe())};const Gn=o(()=>{});Gn.current=t=>{if(!Ft)return;const e=fn.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-on.left,o=t.clientY-n.top-on.top;if(0>i||i>cn||0>o||o>un)return void Ft(null);const r=In.current;if(!r||0===r.scene.length)return void Ft(null);const l=He(r.scene,i,o,jt,r.quadtree,r.maxPointRadius);Ft(l?zi(l.datum||{},l.x,l.y):null)};const Vn=a(t=>Gn.current(t),[]),Un=o(-1),Kn=o(null),Qn=o(null),Jn=a(t=>{const e=In.current;if(!e||0===e.scene.length)return;const n=e.version;let i;if(Qn.current&&Qn.current.version===n)i=Qn.current.graph;else{const t=function(t){var e,n,i;const o=[];for(const r of t)switch(r.type){case"point":o.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const t=r,n=Array.isArray(t.datum)?t.datum:[],i=null!==(e=t.group)&&void 0!==e?e:"_default";for(let e=0;t.path.length>e&&n.length>e;e++)o.push({x:t.path[e][0],y:t.path[e][1],datum:n[e],shape:"circle",group:i});break}case"area":{const t=r,e=Array.isArray(t.datum)?t.datum:[],i=null!==(n=t.group)&&void 0!==n?n:"_default";for(let n=0;t.topPath.length>n&&e.length>n;n++)o.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:e[n],shape:"circle",group:i});break}case"rect":o.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(i=r.group)&&void 0!==i?i:"_default"});break;case"heatcell":o.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return o.sort((t,e)=>t.x-e.x||t.y-e.y),o}(e.scene);if(0===t.length)return;i=tn(t),Qn.current={version:n,graph:i}}const o=Un.current;if(0>o){if("Escape"===t.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key))return;t.preventDefault(),Un.current=0;const n=i.flat[0];Kn.current={shape:n.shape,w:n.w,h:n.h};const o=ln(Object.assign(Object.assign({},n),{datum:ye(n.datum,e.resolvedRibbons)}));return xn.current=o,wn(o),Rt&&Rt(o),void Qe()}const r=en(i,o),l=nn(t.key,r,i);if(null===l)return;if(t.preventDefault(),0>l)return Un.current=-1,Kn.current=null,xn.current=null,bn.current=null,wn(null),Rt&&Rt(null),void Qe();Un.current=l;const s=i.flat[l];Kn.current={shape:s.shape,w:s.w,h:s.h};const a=ln(Object.assign(Object.assign({},s),{datum:ye(s.datum,e.resolvedRibbons)}));xn.current=a,wn(a),Rt&&Rt(a),Qe()},[Rt,Qe]),ni=a(t=>{Un.current=-1,Kn.current=null,Hn(t)},[Hn]);Ze.current=()=>{var t,e;Ke.current=0;const n=fn.current,i=gn.current;if(!n||!i)return;const o=In.current;if(!o)return;const r="undefined"!=typeof performance?performance.now():Date.now(),l=o.advanceTransition(Fe.current?r+1e6:r),s=!Fe.current&&l,a=$e.current||l;a&&!s&&(o.computeScene({width:cn,height:un}),Wn());const c=Xi(),u=function(t){if(!t)return po;const e=getComputedStyle(t),n=e.getPropertyValue("--semiotic-border").trim(),i=e.getPropertyValue("--semiotic-text-secondary").trim(),o=e.getPropertyValue("--semiotic-bg").trim(),r=e.getPropertyValue("--semiotic-primary").trim(),l=i||e.getPropertyValue("--text-secondary").trim(),s=e.getPropertyValue("--text-primary").trim(),a=n||e.getPropertyValue("--surface-3").trim(),c=o||e.getPropertyValue("--surface-0").trim();return l||s||n||r?{axisStroke:a||po.axisStroke,tickText:l||po.tickText,crosshair:l?vo(l,"66"):po.crosshair,hoverFill:c?vo(c,"4D"):po.hoverFill,hoverStroke:l?vo(l,"99"):po.hoverStroke,pointRing:c||po.pointRing,primary:r||po.primary}:po}(n);An.current=u.primary;const d=null!==(t=null==ge?void 0:ge.threshold)&&void 0!==t?t:5e3,h=ge&&o.lastIngestTime>0&&r-o.lastIngestTime>d;if(a){const t=Hi(n,je,on,c);if(t){if(t.clearRect(-on.left,-on.top,je[0],je[1]),h&&(t.globalAlpha=null!==(e=null==ge?void 0:ge.dimOpacity)&&void 0!==e?e:.5),"transparent"!==nt&&!ne){const e=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=nt||(e&&"transparent"!==e?e:null),o=i?We(t,i):null;o&&(t.fillStyle=o,t.fillRect(-on.left,-on.top,je[0],je[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,cn,un),t.clip()),oe&&o.scales)for(const e of oe)t.save(),e(t,o.scene,o.scales,{width:cn,height:un}),t.restore();const i=De?go.custom:go[M];if(i&&o.scales)for(const e of i)e(t,o.scene,o.scales,{width:cn,height:un});t.restore(),h&&(t.globalAlpha=1)}}{const t=Hi(i,je,on,c);if(t&&(t.clearRect(-on.left,-on.top,je[0],je[1]),hn&&xn.current&&o.scales&&function(t,e,n,i,o,r,l){var s;if(!1===o.crosshair)return;const a=e.allSeries,c=a&&a.length>0,u=null!==(s=e.xPx)&&void 0!==s?s:e.x;t.save();const d="object"==typeof o.crosshair?o.crosshair:{};if(t.strokeStyle=d.stroke||l.crosshair,t.lineWidth=d.strokeWidth||1,t.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(c?u:e.x,0),t.lineTo(c?u:e.x,i),t.stroke(),c||(t.beginPath(),t.moveTo(0,e.y),t.lineTo(n,e.y),t.stroke()),t.restore(),c){t.lineWidth=2,t.strokeStyle=l.pointRing;for(const e of a)null!=e.valuePx&&(t.beginPath(),t.arc(u,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||l.primary,t.fill(),t.stroke())}else{const n=o.pointColor||function(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const n="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||n||null:n||e.stroke||null}(r)||l.primary;t.beginPath(),t.arc(e.x,e.y,4,0,2*Math.PI),t.fillStyle=n,t.fill(),t.strokeStyle=l.pointRing,t.lineWidth=2,t.stroke()}}(t,xn.current,cn,un,"object"==typeof hn?hn:{},bn.current,u),bn.current&&Array.isArray(Wt))){const e=Wt.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,n,i,o){var r;if(!n)return;const l="group"in n?n.group:void 0;if(void 0!==l)for(const n of e){if("line"!==n.type)continue;if(n.group!==l)continue;if(2>n.path.length)continue;const e="function"==typeof i.style?n.datum?i.style(n.datum):{}:i.style||{};t.save(),t.beginPath(),t.moveTo(n.path[0][0],n.path[0][1]);for(let e=1;n.path.length>e;e++)t.lineTo(n.path[e][0],n.path[e][1]);t.strokeStyle=e.stroke||n.style.stroke||o.primary,t.lineWidth=e.strokeWidth||(n.style.strokeWidth||2)+2,t.globalAlpha=null!==(r=e.opacity)&&void 0!==r?r:1,t.stroke(),t.restore()}}(t,o.scene,bn.current,e,u)}}a&&n&&n.setAttribute("aria-label",pi(o.scene,M+" chart"));const f=$e.current;if($e.current=!1,f&&o.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!vn||t(vn.x.domain()[0])!==t(o.scales.x.domain()[0])||t(vn.x.domain()[1])!==t(o.scales.x.domain()[1])||t(vn.y.domain()[0])!==t(o.scales.y.domain()[0])||t(vn.y.domain()[1])!==t(o.scales.y.domain()[1])||vn.x.range()[0]!==o.scales.x.range()[0]||vn.x.range()[1]!==o.scales.x.range()[1]||vn.y.range()[0]!==o.scales.y.range()[0]||vn.y.range()[1]!==o.scales.y.range()[1])&&mn(o.scales),ke){const t=o.getData(),e="function"==typeof E?E:t=>t[E||"x"],n="function"==typeof O?O:t=>t[O||"y"];En(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),Dn(t.map(t=>n(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}f&&Ht&&Ht.length>0&&pn(t=>t+1),(null==ge?void 0:ge.showBadge)&&Cn(!!h),(s||null!=o.activeTransition||o.hasActivePulses)&&(Ke.current=requestAnimationFrame(()=>Ze.current()))},ai({hydrated:ze,wasHydratingFromSSR:Re,storeRef:In,dirtyRef:$e,renderFnRef:Ze,cleanup:()=>{var t;return null===(t=zn.current)||void 0===t?void 0:t.clear()}}),l(()=>{$e.current=!0,Qe()},[M,cn,un,Pt,nt,it,oe,Qe]),sn(ge,In,$e,Qe,Pn,Cn);const oi=r(()=>{if(Dt||$t)return;const t=In.current;return(null==t?void 0:t.xIsDate)&&vn?fo(vn.x.domain()):void 0},[Dt,$t,vn]),ri=Dt||$t||oi,li=hn&&kn?zt?zt(kn):t(xo,{hover:kn}):null,ui=li?t(Fi,{x:kn.x,y:kn.y,containerWidth:cn,containerHeight:un,margin:on,className:"stream-frame-tooltip",children:li}):null,di=Kn.current,hi=t(Ii,{active:Un.current>=0,hoverPoint:kn,margin:on,size:je,shape:null==di?void 0:di.shape,width:null==di?void 0:di.w,height:null==di?void 0:di.h}),fi=uo(E,X,"__semiotic_resolvedX","__semiotic_resolvedTime"),gi=uo(O,Y,"__semiotic_resolvedY","__semiotic_resolvedValue"),yi=fi.key,vi=gi.key,mi=function(t,e,n){return i=>{if(!i||!n||!t.fn&&!e.fn)return i;let o=!1;const r=i.map(n=>{const i=t.fn&&t.key&&!(t.key in n),r=e.fn&&e.key&&!(e.key in n);if(!i&&!r)return n;o=!0;const l=Object.assign({},n);return i&&(l[t.key]=t.fn(n)),r&&(l[e.key]=e.fn(n)),l});return o?r:i}}(fi,gi,Ht&&Ht.length>0||!1);if(ei||!ze&&Re){const n=In.current;n&&P&&(n.ingest({inserts:dn,bounded:!0}),n.computeScene({width:cn,height:un}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,l=ri||(()=>{if((null==n?void 0:n.xIsDate)&&r)return fo(r.x.domain())})();return e("div",{ref:Ye,className:"stream-xy-frame"+(et?" "+et:""),role:"img","aria-label":Ce||("string"==typeof le?le:"XY chart"),style:{position:"relative",width:Q?"100%":je[0],height:J?"100%":je[1]},children:[t(Di,{summary:Te}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:je[0],height:je[1],style:{position:"absolute",left:0,top:0},children:[t("g",{transform:`translate(${on.left},${on.top})`,children:an}),e("g",{transform:`translate(${on.left},${on.top})`,children:[nt&&t("rect",{x:0,y:0,width:cn,height:un,fill:nt}),re&&r&&re.map((e,n)=>t(i.Fragment,{children:e(o,r,{width:cn,height:un})},"svgpre-"+n)),o.map((n,i)=>function(n,i,o){var r,l,s,a,c;switch(n.type){case"line":{const e=n;if(0===e.path.length)return null;const o="M"+e.path.map(([t,e])=>`${t},${e}`).join("L");return t("path",{d:o,fill:"none",stroke:e.style.stroke||"#4e79a7",strokeWidth:e.style.strokeWidth||2,strokeDasharray:e.style.strokeDasharray,opacity:e.style.opacity},"line-"+i)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([t,e])=>`${t},${e}`).join("L")}L${[...c.bottomPath].reverse().map(([t,e])=>`${t},${e}`).join("L")}Z`;if(c.clipRect){const n=`${o?o+"-":""}area-clip-${i}`;return e("g",{children:[t("defs",{children:t("clipPath",{id:n,children:t("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),t("path",{d:u,fill:ti(c.style.fill),fillOpacity:null!==(l=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+i)}return t("path",{d:u,fill:ti(c.style.fill),fillOpacity:null!==(a=null!==(s=c.style.fillOpacity)&&void 0!==s?s:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+i)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:ti(e.style.fill),opacity:null!==(c=e.style.opacity)&&void 0!==c?c:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"point-"+i)}case"rect":{const e=n;return t("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:ti(e.style.fill),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"rect-"+i)}case"heatcell":{const o=n;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const n=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,l,s]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(o.fill),a=.299*r+.587*l+.114*s>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e("g",{children:[t("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),t("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:c+"px",children:n})]},"heatcell-"+i)}return t("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+i)}case"candlestick":{const o=n,r=Math.min(o.openY,o.closeY),l=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e("g",{children:[t("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),t("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:l,fill:s,stroke:s,strokeWidth:1})]},"candle-"+i)}default:return null}}(n,i,Ne)).filter(Boolean)]})]}),t(Zn,{width:cn,height:un,totalWidth:je[0],totalHeight:je[1],margin:on,scales:r,showAxes:Pt,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:l,yFormat:Lt||It,axisExtent:Nt,showGrid:Gt,title:le,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,legendLayout:Jt,foregroundGraphics:Se(rn,null===(h=In.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:ke,xValues:[],yValues:[],annotations:Ht,svgAnnotationRules:Xt,annotationFrame:0,xAccessor:yi,yAccessor:vi,annotationData:mi(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(t=>"point"===t.type),curve:"string"==typeof I?I:void 0,linkedCrosshairName:Ee,linkedCrosshairSourceId:Oe})]})}return e("div",{ref:Ye,className:"stream-xy-frame"+(et?" "+et:""),role:"group","aria-label":Ce||("string"==typeof le?le:"XY chart"),tabIndex:0,style:{position:"relative",width:Q?"100%":je[0],height:J?"100%":je[1],overflow:"visible"},onKeyDown:Jn,children:[Pe&&t(Li,{tableId:Ue}),Pe&&t(Ei,{scene:null!==(p=null===(f=In.current)||void 0===f?void 0:f.scene)&&void 0!==p?p:[],chartType:M+" chart",tableId:Ue,chartTitle:"string"==typeof le?le:void 0}),t(Di,{summary:Te}),e("div",{role:"img","aria-label":Ce||("string"==typeof le?le:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:hn?ni:void 0,onMouseLeave:hn?Xn:void 0,onClick:Ft?Vn:void 0,children:[an&&t("svg",{style:{position:"absolute",left:0,top:0,width:je[0],height:je[1],pointerEvents:"none"},children:t("g",{transform:`translate(${on.left},${on.top})`,children:an})}),t(qn,{width:cn,height:un,totalWidth:je[0],totalHeight:je[1],margin:on,scales:vn,showAxes:Pt,axes:Ct,showGrid:Gt,xFormat:ri,yFormat:Lt||It,axisExtent:Nt}),t("canvas",{ref:fn,"aria-label":pi(null!==(m=null===(v=In.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],M+" chart"),style:{position:"absolute",left:0,top:0}}),t("canvas",{ref:gn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),t(Ni,{hoverPoint:kn}),t(Zn,{width:cn,height:un,totalWidth:je[0],totalHeight:je[1],margin:on,scales:vn,showAxes:Pt,axes:Ct,xLabel:Tt,yLabel:Et,yLabelRight:Ot,xFormat:ri,yFormat:Lt||It,axisExtent:Nt,showGrid:Gt,title:le,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Kt,legendIsolatedCategories:Zt,legendPosition:Qt,legendLayout:Jt,foregroundGraphics:Se(rn,null===(x=In.current)||void 0===x?void 0:x.customLayoutOverlays),marginalGraphics:ke,xValues:Tn,yValues:On,annotations:Ht,svgAnnotationRules:Xt,annotationFrame:yn,xAccessor:yi,yAccessor:vi,annotationData:mi(null===(b=In.current)||void 0===b?void 0:b.getData()),pointNodes:null===(k=In.current)||void 0===k?void 0:k.scene.filter(t=>"point"===t.type),curve:"string"==typeof I?I:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==nt&&!ne,linkedCrosshairName:Ee,linkedCrosshairSourceId:Oe}),(ae||ce)&&t(dt,{width:cn,height:un,totalWidth:je[0],totalHeight:je[1],margin:on,dimension:null!==(w=null==ae?void 0:ae.dimension)&&void 0!==w?w:"xy",scales:vn,onBrush:null!=ce?ce:()=>{},binSize:F,snap:null==ae?void 0:ae.snap,binBoundaries:null!==(A=null==ae?void 0:ae.binBoundaries)&&void 0!==A?A:"bar"===M?null===(S=In.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==ae?void 0:ae.snapDuring,streaming:"streaming"===_}),(null==ge?void 0:ge.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pn?"#dc3545":"#28a745",color:"white"}),children:Pn?"STALE":"LIVE"}),hi,ui]})]})});bo.displayName="StreamXYFrame";const ko={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},wo={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Ao{constructor(t){this.capacity=t,this.particles=Array(t),this._freeIndices=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[e]=t-1-e}spawn(t){const e=this._freeIndices.pop();if(void 0===e)return null;const n=this.particles[e];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=t,n.x=0,n.y=0,n}step(t,e,n,i){var o;for(let r=0;this.capacity>r;r++){const l=this.particles[r];if(!l.active)continue;const s=n[l.edgeIndex];if(!s||!s.bezier){l.active=!1,this._freeIndices.push(r);continue}const a=i&&null!==(o=i[l.edgeIndex])&&void 0!==o?o:1;l.t+=t*e*a*(s.bezier.circular?.3:1),1>l.t?So(s.bezier,l.t,l.offset,l):(l.active=!1,this._freeIndices.push(r))}}countForEdge(t){let e=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1;this._freeIndices.length=0;for(let t=this.capacity-1;t>=0;t--)this._freeIndices.push(t)}resize(t){if(this.capacity>=t)return;const e=this.particles;this.particles=Array(t);for(let n=0;t>n;n++)e.length>n?this.particles[n]=e[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=t}}function So(t,e,n,i){if(t.circular&&t.segments)return void function(t,e,n,i,o){const r=t.length,l=e*r,s=Math.min(Math.floor(l),r-1),a=l-s,[c,u,d,h]=t[s];Mo(c,u,d,h,a,o);const f=h.x-c.x,g=h.y-c.y,y=Math.sqrt(f*f+g*g);if(y>.001){const t=f/y;o.x+=-g/y*n*i*2,o.y+=t*n*i*2}}(t.segments,e,n,t.halfWidth,i);if(!t.points)return i.x=0,void(i.y=0);const[o,r,l,s]=t.points;Mo(o,r,l,s,e,i);const a=s.x-o.x,c=s.y-o.y,u=Math.sqrt(a*a+c*c);if(u>.001){const e=a/u;i.x+=-c/u*n*t.halfWidth*2,i.y+=e*n*t.halfWidth*2}}function Mo(t,e,n,i,o,r){const l=1-o,s=l*l,a=s*l,c=o*o,u=c*o;r.x=a*t.x+3*s*o*e.x+3*l*c*n.x+u*i.x,r.y=a*t.y+3*s*o*e.y+3*l*c*n.y+u*i.y}function _o(t,e){var n=t.get(e);if(!n)throw Error("missing: "+e);return n}function Po(t,e){var n,i=[],o=[],r=[],l={},s=[];function a(t){r[t]=!1,l.hasOwnProperty(t)&&Object.keys(l[t]).forEach(function(e){delete l[t][e],r[e]&&a(e)})}function c(t){var e,i,d=!1;for(o.push(t),r[t]=!0,e=0;s[t].length>e;e++)(i=s[t][e])===n?(u(n,o),d=!0):r[i]||(d=c(i));if(d)a(t);else for(e=0;s[t].length>e;e++){var h=l[i=s[t][e]];h||(l[i]=h={}),h[i]=!0}return o.pop(),d}function u(t,e){var n=[].concat(e).concat(t);i.push(n)}function d(e){!function(e){for(var n=0;t.length>n;n++)n>=e&&t[n]||(t[n]=[]),t[n]=t[n].filter(function(t){return t>=e})}(e);for(var n,i=function(t){for(var e=t.length,n=Array(e),i=Array(e),o=Array(e),r=Array(e),l=Array(e),s=Array(e),a=0;e>a;++a)n[a]=-1,i[a]=0,o[a]=!1,r[a]=0,l[a]=-1,s[a]=[];var c,u=0,d=[],h=[];function f(e){var a=[e],c=[e];for(n[e]=i[e]=u,o[e]=!0,u+=1;c.length>0;){var f=t[e=c[c.length-1]];if(f.length>r[e]){for(var g=r[e];f.length>g;++g){var y=f[g];if(0>n[y]){n[y]=i[y]=u,o[y]=!0,u+=1,a.push(y),c.push(y);break}o[y]&&(i[e]=0|Math.min(i[e],i[y])),0>l[y]||s[e].push(l[y])}r[e]=g}else{if(i[e]===n[e]){var p=[],v=[],m=0;for(g=a.length-1;g>=0;--g){var x=a[g];if(o[x]=!1,p.push(x),v.push(s[x]),m+=s[x].length,l[x]=d.length,x===e){a.length=g;break}}d.push(p);var b=Array(m);for(g=0;v.length>g;g++)for(var k=0;v[g].length>k;k++)b[--m]=v[g][k];h.push(b)}c.pop()}}}for(a=0;e>a;++a)0>n[a]&&f(a);for(a=0;h.length>a;a++){var g=h[a];if(0!==g.length){g.sort(function(t,e){return t-e}),c=[g[0]];for(var y=1;g.length>y;y++)g[y]!==g[y-1]&&c.push(g[y]);h[a]=c}}return{components:d,adjacencyList:h}}(t),o=i.components.filter(function(t){return t.length>1}),r=1/0,l=0;o.length>l;l++)for(var s=0;o[l].length>s;s++)r>o[l][s]&&(r=o[l][s],n=l);var a=o[n];if(!a)return!1;var c=t.map(function(t,e){return-1===a.indexOf(e)?[]:t.filter(function(t){return-1!==a.indexOf(t)})});return{leastVertex:r,adjList:c}}n=0;for(var h=t.length;h>n;){var f=d(n);if(n=f.leastVertex,s=f.adjList){for(var g=0;s.length>g;g++)for(var y=0;s[g].length>y;y++){var p=s[g][y];r[+p]=!1,l[p]={}}c(n),n+=1}else n=h}return i}function Co(t){return t.y0-t.y1>0?"up":"down"}function To(t,e){return e(t.source)==e(t.target)}function Eo(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var n=0;return t.target.targetLinks.forEach(function(t){n=t.circular?n+1:n}),1>=e&&1>=n}function Oo(t){return t.target.x0-t.source.x1}function Do(t,e){var n=No(t),i=Oo(e)/Math.tan(n);return"up"==Co(t)?t.y1-i:t.y1+i}function Lo(t,e){var n=No(t),i=Oo(e)/Math.tan(n);return"up"==Co(t)?t.y1+i:t.y1-i}function No(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function $o(t,e){return e(t)}function Io(t){return zo(t.source)}function Wo(t){return zo(t.target)}function zo(t){return(t.y0+t.y1)/2}function Ro(t){return t.virtual?0:t.value}function Fo(t,e){var n=0;t.sourceLinks.forEach(function(t){n=t.circular&&!To(t,e)?n+1:n});var i=0;return t.targetLinks.forEach(function(t){i=t.circular&&!To(t,e)?i+1:i}),n+i}function Yo(t){return t.target.depth}function jo(t,e){return t.sourceLinks.length?t.depth:e-1}function Bo(t,e){return t.y0-e.y0}function Ho(t,e){return e.y0-t.y0}function Xo(t,e){return t.y1-e.y1}function Go(t,e){return e.y1-t.y1}function Vo(t,e){return Uo(t.source,e.source)||t.index-e.index}function qo(t,e){return Uo(t.target,e.target)||t.index-e.index}function Uo(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function Ko(t,e){return Zo(t)==Zo(e)?"bottom"==t.circularLinkType?Ho(t,e):Bo(t,e):Zo(e)-Zo(t)}function Zo(t){return t.target.column-t.source.column}function Qo(t,e){return Jo(t)==Jo(e)}function Jo(t){return t.y0-t.y1>0?"up":"down"}function tr(t,e,n,i,o){let r=t;var l=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,l))});var s=R(r.links,function(t){return t.source.y0});r.links.forEach(function(t){t.circular&&(t.circularPathData={})});var a=r.links.filter(function(t){return t.circular});return a.sort(function(t,e){return e.value-t.value}),a.forEach(function(t,e){t._circularStub=e>=4}),er(r.links.filter(function(t){return"top"==t.circularLinkType}),e,n),er(r.links.filter(function(t){return"bottom"==t.circularLinkType}),e,n),r.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+i,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,To(t,e)&&Eo(t))t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var l=t.source.column,a=t.circularLinkType,c=r.links.filter(function(t){return t.source.column==l&&t.circularLinkType==a});c.sort("bottom"==t.circularLinkType?Ho:Bo);var u=0;c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),l=t.target.column,(c=r.links.filter(function(t){return t.target.column==l&&t.circularLinkType==a})).sort("bottom"==t.circularLinkType?Go:Xo),u=0,c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(r.y1,t.source.y1,t.target.y1)+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=s-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,n=t.y0,i=t.target.x0,o=t.y1,r=(e+i)/2;return"M"+e+","+n+"C"+r+","+n+" "+r+","+o+" "+i+","+o}(t)}),r}function er(t,e,n){t.sort(Ko);var i=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,o){var r=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(To(t,e)&&Eo(t))t.circularPathData.verticalBuffer=r+t._circularWidth/2;else{for(var l=0;i.length>l;l++){var s=i[l];if(s!==t&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&nr(t,s)){var a=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;r=a>r?a:r}}t.circularPathData.verticalBuffer=r+t._circularWidth/2}}),t}function nr(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}function ir(t){return function(){return t}}function or(t){return t.index}function rr(t){return t.nodes}function lr(t){return t.links}function sr(t,e,n){var i=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});i.forEach(function(o,r){var l=o.length;if(e)o.sort(e);else if(r>0){var s=new Map;o.forEach(function(t,e){var n,i,o,r=(i=0,o=0,(n=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=zo(t.source)*e,i+=e}}),n.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=zo(t.target)*e,i+=e}}),i>0?o/i:NaN);s.set(t,{bc:r,idx:e})}),o.sort(function(t,e){var n=s.get(t),i=s.get(e),o=n.bc,r=i.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(o)||isNaN(r)?isNaN(o)?isNaN(r)?n.idx-i.idx:1:-1:o-r})}else o.sort(function(t,e){return t.circularLinkType==e.circularLinkType?Fo(e,n)-Fo(t,n):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});o.forEach(function(e,o){e.depth==i.length-1&&1==l||0==e.depth&&1==l?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==Fo(e,n)?(e.y0=t.y1/2+o,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+o,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-o,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/l*o,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-l/2+o,e.y1=e.y0+e.value*t.ky)})})}function ar(t,e,n,i,o,r){var l=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var s=1,a=r;a>0;--a)c(s*=.99,n),u();function c(e,n){var i=l.length;l.forEach(function(o){var r=o.length,l=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&Fo(o,n)>0){var a=B(o.sourceLinks,Wo),c=B(o.targetLinks,Io),u=a&&c?(a+c)/2:a||c;if(u){var d=(u-zo(o))*e*.3;o.y0+=d,o.y1+=d}}else if(0==l&&1==r)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(l==i-1&&1==r)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=B(o.sourceLinks,Wo),f=B(o.targetLinks,Io),g=((h&&f?(h+f)/2:h||f)-zo(o))*e;o.y0+=g,o.y1+=g}})})}function u(){l.forEach(function(n){var r,l,s,a=t.y0,c=n.length;for(n.sort(e||Uo),s=0;c>s;++s)(l=a-(r=n[s]).y0)>0&&(r.y0+=l,r.y1+=l),a=r.y1+i;if((l=a-i-t.y1)>0)for(a=r.y0-=l,r.y1-=l,s=c-2;s>=0;--s)(l=(r=n[s]).y1+o-a)>0&&(r.y0-=l,r.y1-=l),a=r.y0})}}function cr(t){t.nodes.forEach(function(t){t.sourceLinks.sort(qo),t.targetLinks.sort(Vo)}),t.nodes.forEach(function(t){var e=t.y0,n=e,i=t.y1,o=i;t.sourceLinks.forEach(function(t){t.circular?(t.y0=i-t.width/2,i-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=o-t.width/2,o-=t.width):(t.y1=n+t.width/2,n+=t.width)})})}function ur(){var t=0,e=0,n=1,i=1,o=24,r=8,l=null,s=or,a=jo,c=void 0,u=32,d=2,h=rr,f=lr;function g(){var g={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=t,h.y0=e,h.x1=n,h.y1=i,h.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var n=function(t,e){var n=new Map;return H(t,e).forEach(function(t,e){n.set(e,t[0])}),n}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var i=t.source,o=t.target;"object"!=typeof i&&(i=t.source=_o(n,i)),"object"!=typeof o&&(o=t.target=_o(n,o)),i.sourceLinks.push(t),o.targetLinks.push(t)})}(h,s),function(t,e){var n=0;if(null==e){for(var i=[],o=0;t.links.length>o;o++){var r=t.links[o],l=r.source.index,s=r.target.index;i[l]||(i[l]=[]),i[s]||(i[s]=[]),-1===i[l].indexOf(s)&&i[l].push(s)}var a=Po(i);a.sort(function(t,e){return t.length-e.length});var c={};for(o=0;a.length>o;o++){var u=a[o].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,i=t.source.index;e===i||c[i]&&c[i][e]?(t.circular=!0,t.circularLinkID=n++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=n++)})}(h,c),function(t,e){var n=0,i=0;t.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:i>n?"top":"bottom","top"==o.circularLinkType?n++:i++,t.nodes.forEach(function(t){$o(t,e)!=$o(o.source,e)&&$o(t,e)!=$o(o.target,e)||(t.circularLinkType=o.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),To(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(h,s),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(j(t.sourceLinks,Ro),j(t.targetLinks,Ro)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(h),function(t,e,n){var i,o,r;if(null!=e){t.nodes.sort(function(t,n){return e(t)<e(n)?-1:1});var l=0,s=e(t.nodes[0]);t.nodes.forEach(function(t){l=e(t)==s?l:l+1,s=e(t)==s?s:e(t),t.column=l})}for(i=t.nodes,o=[],r=0;i.length;++r,i=o,o=[])i.forEach(function(t){t.depth=r,t.sourceLinks.forEach(function(t){0>o.indexOf(t.target)&&!t.circular&&o.push(t.target)})});for(i=t.nodes,o=[],r=0;i.length;++r,i=o,o=[])i.forEach(function(t){t.height=r,t.targetLinks.forEach(function(t){0>o.indexOf(t.source)&&!t.circular&&o.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?n(t,r):t.column})}(h,c,a);var f=r;if(null!==l){var g=F(h.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),y=Y(g,function(t){return t.length});y>1&&(f=Math.max(1,(i-e)*l/(y-1)))}(function(t,e,n){var i=F(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var o=R(i,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/j(e,function(t){return t.value})});t.ky=o,t.links.forEach(function(e){e.width=e.value*t.ky});var r=Y(t.nodes,function(t){return t.column});t.nodes.forEach(r>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-n)/r),e.x1=e.x0+n}:function(e){e.x0=t.x0,e.x1=e.x0+n})})(h,f,o),sr(h,c,s),ar(h,c,s,f,f,u),cr(h),tr(h,s,d,10,8),sr(h,c,s),ar(h,c,s,f,f,u),cr(h),tr(h,s,d,10,8),function(t,e){let n=t;n.nodes.forEach(function(t){t.y+(t.y1-t.y0)>n.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-n.y1));var i=n.links.filter(function(n){return $o(n.source,e)==$o(t,e)}),o=i.length;o>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!Qo(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var n=Do(e,t);return t.y1-n}if(e.target.column>t.target.column)return Do(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;i.forEach(function(t){t.y0=r+t.width/2,r+=t.width}),i.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var r=n+1,l=0;o>r;r++)l+=i[r].width;e.y0=t.y1-l-e.width/2}})})}(h,s),function(t,e){let n=t;n.nodes.forEach(function(t){var i=n.links.filter(function(n){return $o(n.target,e)==$o(t,e)}),o=i.length;o>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!Qo(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var n=Lo(e,t);return t.y0-n}if(e.source.column>t.source.column)return Lo(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;i.forEach(function(t){t.y1=r+t.width/2,r+=t.width}),i.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var r=n+1,l=0;o>r;r++)l+=i[r].width;e.y1=t.y1-l-e.width/2}})})}(h,s),function(t){var e=t.nodes,n=t.links,i=!1,o=!1;if(n.forEach(function(t){"top"==t.circularLinkType?i=!0:"bottom"==t.circularLinkType&&(o=!0)}),0==i||0==o){var r=R(e,function(t){return t.y0}),l=Y(e,function(t){return t.y1}),s=(t.y1-t.y0)/(l-r);function a(e){return(e-r)/(l-r)*(t.y1-t.y0)+t.y0}1>s?(e.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1)}),n.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1),t.width=t.width*s})):e.forEach(function(t){var e=t.y1-t.y0,n=a(t.y0)-t.y0;t.y0=a(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+n}),t.targetLinks.forEach(function(t){t.y1=t.y1+n})})}}(h),tr(h,s,d,10,8)}(g),g}return g.update=function(t){return cr(t),tr(t,s,d,10,8),t},g.nodeWidth=function(t){return arguments.length?(o=+t,g):o},g.nodePadding=function(t){return arguments.length?(r=+t,g):r},g.nodePaddingRatio=function(t){return arguments.length?(l=+t,g):l},g.nodes=function(t){return arguments.length?(h="function"==typeof t?t:ir(t),g):h},g.links=function(t){return arguments.length?(f="function"==typeof t?t:ir(t),g):f},g.nodeId=function(t){return arguments.length?(s="function"==typeof t?t:ir(t),g):s},g.nodeAlign=function(t){return arguments.length?(a="function"==typeof t?t:ir(t),g):a},g.nodeSort=function(t){return arguments.length?(c=t,g):c},g.iterations=function(t){return arguments.length?(u=+t,g):u},g.circularLinkGap=function(t){return arguments.length?(d=+t,g):d},g.extent=function(o){return arguments.length?(t=+o[0][0],e=+o[0][1],n=+o[1][0],i=+o[1][1],g):[[t,e],[n,i]]},g.size=function(o){return arguments.length?(t=e=0,n=+o[0],i=+o[1],g):[n-t,i-e]},g}const dr=t=>{let e,n,i,o,r,l,s,a,c;if("down"===t.direction)return e=t.y0-t.sankeyWidth/2,n=t.y1-t.sankeyWidth/2,i=t.y1+t.sankeyWidth/2,o=t.y0+t.sankeyWidth/2,r=t.source.x1,l=t.target.x0,s=tt(r,l),a=s(.5),c=s(.5),`M${e},${r}C${e},${a} ${n},${c} ${n},${l}L${i},${l}C${i},${c} ${o},${a} ${o},${r}Z`;const u=t.sankeyWidth/2,d=tt(t.source.x1,t.target.x0),{pathD:h}=function(t){const{sx:e,sTop:n,sBot:i,tx:o,tTop:r,tBot:l,cp1X:s,cp2X:a}=t,c=(n+i)/2,u=(r+l)/2;return{pathD:[`M${e},${n}`,`C${s},${n} ${a},${r} ${o},${r}`,`L${o},${l}`,`C${a},${l} ${s},${i} ${e},${i}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:c},{x:s,y:c},{x:a,y:u},{x:o,y:u}],halfWidth:(i-n)/2}}}({sx:t.source.x1,sTop:t.y0-u,sBot:t.y0+u,tx:t.target.x0,tTop:t.y1-u,tBot:t.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function hr(t){var e;const n=t.sankeyWidth/2,i=(null!==(e=t._circularWidth)&&void 0!==e?e:t.sankeyWidth)/2,o=t.circularPathData;if(!o)return null;if("down"===t.direction)return null;if(t._circularStub){const e=o.sourceX,i=o.sourceY,r=o.targetX,l=o.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const s=Math.max(15,Math.min(40,.33*(o.rightFullExtent-e))),a=Math.max(15,Math.min(40,.33*(r-o.leftFullExtent)));return`M${e},${i-n}L${e+s},${i-n}L${e+s},${i+n}L${e},${i+n}ZM${r},${l-n}L${r-a},${l-n}L${r-a},${l+n}L${r},${l+n}Z`}const r=o.sourceX,l=o.sourceY,s=o.targetX,a=o.targetY,c=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,f=Math.max(4,Math.min(i,15));return`M${r},${l-h*n}L${c},${l-h*n}L${c+i},${l-h*n+h*f}L${c+i},${d+h*i-h*f}L${c+i-f},${d+h*i}L${u-i+f},${d+h*i}L${u-i},${d+h*i-h*f}L${u-i},${a-h*n+h*f}L${u-i+f},${a-h*n}L${s},${a-h*n}L${s},${a+h*n}L${u+i},${a+h*n}L${u+i},${d-h*i}L${c-i},${d-h*i}L${c-i},${l+h*n}L${r},${l+h*n}Z`}const fr=new Set,gr=new WeakMap;function yr(t,e){if("production"===process.env.NODE_ENV)return t;if(!t||!t.data||"object"!=typeof t.data)return t;let n=gr.get(t);if(n){const t=n.get(e);if(t)return t}else n=new Map,gr.set(t,n);const i=new Proxy(t,{get(t,n,i){if("string"==typeof n&&!(n in t)&&t.data&&n in t.data){const t=`${e}:${n}`;fr.has(t)||(fr.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,n,i)}});return n.set(e,i),i}const pr={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(Yo))-1:0},justify:jo};function vr(t){return"string"==typeof t?t:t.id}const mr={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,i){var o,r,l,s,a,c,u;if(0===t.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",f=null!==(o=n.nodeWidth)&&void 0!==o?o:15,g=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,y=null!==(l=n.iterations)&&void 0!==l?l:100,p=t.map(t=>Object.assign({},t)),v=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id,value:Math.sqrt(Math.max(1,t.value||1))}));let m;m="down"===d?[[0,0],[i[1],i[0]]]:[[0,0],[i[0],i[1]]];const x=ur().extent(m).links(v).nodes(p).nodeAlign(pr[h]||jo).nodeId(t=>t.id).nodeWidth(f).iterations(y);x.nodePaddingRatio&&x.nodePaddingRatio(g),x();{let t=1/0,e=-1/0,n=1/0,o=-1/0;for(const i of p)t>i.x0&&(t=i.x0),i.x1>e&&(e=i.x1),n>i.y0&&(n=i.y0),i.y1>o&&(o=i.y1);for(const i of v){if(!i.circular||!i.circularPathData)continue;const r=i.circularPathData,l=(null!==(a=null!==(s=i._circularWidth)&&void 0!==s?s:i.width)&&void 0!==a?a:0)/2;t>r.leftFullExtent-l&&(t=r.leftFullExtent-l),r.rightFullExtent+l>e&&(e=r.rightFullExtent+l),n>r.verticalFullExtent-l&&(n=r.verticalFullExtent-l),r.verticalFullExtent+l>o&&(o=r.verticalFullExtent+l)}const r=e-t,l=o-n,u=i[0],d=i[1];if(r>0&&l>0&&(0>t||0>n||e>u||o>d)){const e=Math.min(u/r,d/l),i=-t*e+(u-r*e)/2,o=-n*e+(d-l*e)/2;for(const t of p)t.x0=t.x0*e+i,t.x1=t.x1*e+i,t.y0=t.y0*e+o,t.y1=t.y1*e+o;for(const t of v)if(t.y0=t.y0*e+o,t.y1=t.y1*e+o,t.width=(null!==(c=t.width)&&void 0!==c?c:0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const n=t.circularPathData;n.sourceX=n.sourceX*e+i,n.targetX=n.targetX*e+i,n.sourceY=n.sourceY*e+o,n.targetY=n.targetY*e+o,n.rightFullExtent=n.rightFullExtent*e+i,n.leftFullExtent=n.leftFullExtent*e+i,n.verticalFullExtent=n.verticalFullExtent*e+o,n.rightInnerExtent=n.rightInnerExtent*e+i,n.leftInnerExtent=n.leftInnerExtent*e+i,n.verticalRightInnerExtent=n.verticalRightInnerExtent*e+o,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*e+o,n.rightSmallArcRadius*=e,n.rightLargeArcRadius*=e,n.leftSmallArcRadius*=e,n.leftLargeArcRadius*=e,n.sourceWidth*=e,n.rightNodeBuffer*=e,n.leftNodeBuffer*=e,n.arcRadius*=e}}}const b=new Map;for(const e of t)b.set(e.id,e);for(const t of p){const e=b.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const k=new Map;for(const t of e)k.set(t._edgeKey?t._edgeKey:`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const t of v){const e=vr(t.source),n=vr(t.target),i=k.get(t._edgeKey?t._edgeKey:`${e}\0${n}`);if(i){i.y0=t.y0,i.y1=t.y1,i.sankeyWidth=null!==(u=t.width)&&void 0!==u?u:0,i.circular=!!t.circular,i.circularPathData=t.circularPathData,i._circularWidth=t._circularWidth,i._circularStub=t._circularStub,i.path=t.path,i.circularLinkType=t.circularLinkType,i.direction=d;const o=b.get(e),r=b.get(n);o&&(i.source=o),r&&(i.target=r)}}},buildScene(t,e,n,i){var o,r,l,s,a,c;const u="vertical"===n.orientation?"down":"right",d=n.nodeStyle,h=n.edgeStyle,f=null!==(o=n.edgeOpacity)&&void 0!==o?o:.5,g=n.edgeColorBy||"source",y=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:jt,p=new Map;t.forEach((t,e)=>{p.set(t.id,y[e%y.length])});const v=[],m=[],x=[],b=new Map;for(const e of t){const t=e.x1-e.x0,n=e.y1-e.y0;if(0>=t||0>=n)continue;const i=d?d(yr(e,"nodeStyle")):{},o={fill:i.fill||p.get(e.id)||"#4d430c",stroke:i.stroke,strokeWidth:i.strokeWidth,opacity:i.opacity};b.set(e.id,("string"==typeof o.fill?o.fill:null)||p.get(e.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:e.y0,y:e.x0,w:n,h:t,style:o,datum:e,id:e.id,label:e.id}:{type:"rect",x:e.x0,y:e.y0,w:t,h:n,style:o,datum:e,id:e.id,label:e.id})}const k=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of k){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,i="object"==typeof t.target?t.target:null;if(!e||!i)continue;let o=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999";o="function"==typeof g?g(t)||o:"target"===g?b.get(i.id)||p.get(i.id)||o:b.get(e.id)||p.get(e.id)||o;const u=h?h(yr(t,"edgeStyle")):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,n=t.sankeyWidth/2,i=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),r=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),l=u.fill||o;m.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-n}L${e.sourceX+i},${e.sourceY-n}L${e.sourceX+i},${e.sourceY+n}L${e.sourceX},${e.sourceY+n}Z`,style:{fill:l,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:f,stroke:"none",opacity:u.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+i}}),m.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-n}L${e.targetX-r},${e.targetY-n}L${e.targetX-r},${e.targetY+n}L${e.targetX},${e.targetY+n}Z`,style:{fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:f,stroke:"none",opacity:u.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-r,x1:e.targetX}});continue}let d;if(d=t.circular&&t.circularPathData?hr(t):dr(t),!d)continue;const y={fill:u.fill||o,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:f,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:t.bezier,style:y,datum:t})}if(!1!==n.showLabels){const e=(w=n.nodeLabel)?"function"==typeof w?w:t=>t[w]||t.id:null;for(const n of t){const t=n.x1-n.x0,o=n.y1-n.y0;if(0>=t||0>=o)continue;const r=e?e(n):n.id;if(!r)continue;let l,s,a;"down"===u?(l=n.y0+(n.y1-n.y0)/2,s=n.x1+14,a="start"):(i[0]/2>n.x0+t/2?(l=n.x0-6,a="end"):(l=n.x1+6,a="start"),s=n.y0+o/2),x.push({x:l,y:s,text:r+"",anchor:"down"===u?"middle":a,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:x}}},xr={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,i){var o,r;if(0===t.length)return;const l=null!==(o=n.forceStrength)&&void 0!==o?o:.1,s=i[0]/2,a=i[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const e of t){const t=null!=e.x&&null!=e.y&&(0!==e.x||0!==e.y),n=null==c?void 0:c.get(e.id);t?u++:n?(e.x=n.x,e.y=n.y,u++):d.push(e)}const h=u>0&&.3>=(t.length>0?d.length/t.length:1);if(h){const n=new Map;for(const e of t)n.set(e.id,e);for(const t of d){const i=br(t.id,e,n);if(i.length>0){let e=0,n=0;for(const t of i)e+=t.x,n+=t.y;const o=kr(t.id),r=o%360*(Math.PI/180),l=10+o%20;t.x=e/i.length+l*Math.cos(r),t.y=n/i.length+l*Math.sin(r)}else{const e=kr(t.id),n=e%360*(Math.PI/180),i=15+e%30;t.x=s+i*Math.cos(n),t.y=a+i*Math.sin(n)}}}else{const e=2.399963229728653;for(let n=0;t.length>n;n++){const i=t[n];if(null==i.x||null==i.y||0===i.x&&0===i.y){const t=10*Math.sqrt(n+.5),o=n*e;i.x=s+t*Math.cos(o),i.y=a+t*Math.sin(o)}}}const f=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(t.length-30)))),g=0===n.iterations?0:h?40:f,y=wr(n.nodeSize,n.nodeSizeRange,t),p=t=>y(t);if(g>0){const n=et().strength(t=>{const e=t.weight;return Math.min(2.5,e?e*l:l)}).id(t=>t.id),i=nt().force("charge",it().strength(t=>-25*p(t))).force("center",ot(s,a).strength(.8)).force("x",rt(s).strength(.15)).force("y",lt(a).strength(.15));if(i.nodes(t),e.length>0){const t=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));n.links(t),i.force("link",n)}h?i.alpha(.3):.1>i.alpha()&&i.alpha(1),i.stop();for(let t=0;g>t;++t)i.tick()}for(const e of t){if(null==e.x||null==e.y)continue;const t=p(e);e.x=Math.max(t,Math.min(i[0]-t,e.x)),e.y=Math.max(t,Math.min(i[1]-t,e.y)),e.x0=0,e.x1=0,e.y0=0,e.y1=0}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){if("string"==typeof t.source){const e=v.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=v.get(t.target);e&&(t.target=e)}}},buildScene(t,e,n,i){var o,r,l,s,a,c,u;const d=n.nodeStyle,h=n.edgeStyle,f=wr(n.nodeSize,n.nodeSizeRange,t),g=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:jt,y=new Map;t.forEach((t,e)=>{y.set(t.id,g[e%g.length])});const p=[],v=[],m=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=f(yr(e,"nodeSize")),i=d?d(yr(e,"nodeStyle")):{},s={fill:i.fill||y.get(e.id)||(null===(o=n.themeSemantic)||void 0===o?void 0:o.primary)||"#007bff",stroke:i.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=i.strokeWidth)&&void 0!==l?l:2,opacity:i.opacity};p.push({type:"circle",cx:e.x,cy:e.y,r:t,style:s,datum:e,id:e.id,label:e.id})}const x=new Map;for(const e of t)x.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:x.get(t.source),i="object"==typeof t.target?t.target:x.get(t.target);if(!e||!i)continue;if(null==e.x||null==e.y)continue;if(null==i.x||null==i.y)continue;const o=h?h(yr(t,"edgeStyle")):{},r={stroke:o.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",strokeWidth:null!==(c=o.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=o.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:e.x,y1:e.y,x2:i.x,y2:i.y,style:r,datum:t})}if(!1!==n.showLabels){const e=(b=n.nodeLabel)?"function"==typeof b?b:t=>t[b]||t.id:null;for(const n of t){if(null==n.x||null==n.y)continue;const t=e?e(n):n.id;if(!t)continue;const i=f(yr(n,"nodeSize"));m.push({x:n.x,y:n.y-i-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var b;return{sceneNodes:p,sceneEdges:v,labels:m}}};function br(t,e,n){const i=[];for(const o of e){const e="string"==typeof o.source?o.source:o.source.id,r="string"==typeof o.target?o.target:o.target.id;let l=null;if(e===t?l=r:r===t&&(l=e),l){const t=n.get(l);!t||0===t.x&&0===t.y||i.push({x:t.x,y:t.y})}}return i}function kr(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return Math.abs(e)}function wr(t,e,n){var i,o;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const r=e||[5,20],l=n.map(e=>{var n;return null===(n=e.data)||void 0===n?void 0:n[t]}).filter(t=>null!=t&&"number"==typeof t);if(0===l.length)return()=>r[0];const s=null!==(i=R(l))&&void 0!==i?i:0,a=null!==(o=Y(l))&&void 0!==o?o:1;if(s===a)return()=>(r[0]+r[1])/2;const c=b().domain([s,a]).range(r).clamp(!0);return e=>{var n;const i=null===(n=e.data)||void 0===n?void 0:n[t];return null==i||"number"!=typeof i?r[0]:c(i)}}const Ar=jt,Sr={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,i){if(0===t.length)return;const{padAngle:o=.01,groupWidth:r=20,sortGroups:l}=n,s=Math.min(i[0],i[1])/2,a=s-r,c=i[0]/2,u=i[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:t=>{var e;return null!==(e=t[h])&&void 0!==e?e:1}:t=>{var e;return null!==(e=t.value)&&void 0!==e?e:1};var h;const f=new Map;for(let e=0;t.length>e;e++)f.set(t[e].id,e);const g=t.length,y=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=f.get("string"==typeof t.source?t.source:t.source.id),i=f.get(e);if(void 0===n||void 0===i)continue;const o=d(t);y[n][i]=o}const p=at().padAngle(o);l&&p.sortGroups(l);const v=p(y),m=v.groups,x=I().innerRadius(a).outerRadius(s);for(const e of m){const n=t[e.index],i=x.centroid({innerRadius:a,outerRadius:s,startAngle:e.startAngle,endAngle:e.endAngle});n.x=i[0]+c,n.y=i[1]+u,n.__arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const b=new Map;for(const e of t)b.set(e.id,e);for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=b.get("string"==typeof t.source?t.source:t.source.id),i=b.get(e);n&&(t.source=n),i&&(t.target=i)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const e of v){const n=t[e.source.index].id,i=t[e.target.index].id,o=k.get(`${n}\0${i}`)||k.get(`${i}\0${n}`);o&&(o.__chordData=e)}},buildScene(t,e,n,i){var o,r,l,s;const{groupWidth:a=20,edgeOpacity:c=.5}=n,u=Math.min(i[0],i[1])/2,d=u-a,h=i[0]/2,f=i[1]/2,g=n.nodeStyle,y=n.edgeStyle,p=n.edgeColorBy||"source",v=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Ar,m=new Map;t.forEach((t,e)=>{m.set(t.id,v[e%v.length])});const x=st().radius(d),b=[],k=[],w=[];for(let e=0;t.length>e;e++){const n=t[e],i=n.__arcData;if(!i)continue;let r;r=g?g(yr(n,"nodeStyle")).fill||m.get(n.id)||v[e%v.length]:m.get(n.id)||v[e%v.length];const l=g?g(yr(n,"nodeStyle")):{},s={fill:r,stroke:l.stroke||"black",strokeWidth:null!==(o=l.strokeWidth)&&void 0!==o?o:1,opacity:l.opacity};b.push({type:"arc",cx:h,cy:f,innerR:d,outerR:u,startAngle:i.startAngle-Math.PI/2,endAngle:i.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const t of e){const e=t.__chordData;if(!e)continue;const i=x(e);if(!i)continue;const o=Mr(i,h,f);let a=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999";if(y)a=y(yr(t,"edgeStyle")).fill||a;else{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;"target"===p&&n?a=m.get(n.id)||a:e&&(a=m.get(e.id)||a)}const u=y?y(yr(t,"edgeStyle")):{},d={fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:o,style:d,datum:t})}if(!1!==n.showLabels){const e=(A=n.nodeLabel)?"function"==typeof A?A:t=>t[A]||t.id:null,i=u+12;for(const n of t){const t=n.__arcData;if(!t)continue;const o=e?e(n):n.id;if(!o)continue;const r=(t.startAngle+t.endAngle)/2,l=r-Math.PI/2;w.push({x:h+Math.cos(l)*i,y:f+Math.sin(l)*i,text:o+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:b,sceneEdges:k,labels:w}}};function Mr(t,e,n){const i=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!i)return t;const o=[];let r=0;for(;i.length>r;){const t=i[r];if("M"===t||"L"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("C"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)for(let t=0;3>t&&i.length>r&&!isNaN(Number(i[r]));t++)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("Q"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)for(let t=0;2>t&&i.length>r&&!isNaN(Number(i[r]));t++)o.push(Number(i[r])+e+""),r++,i.length>r&&!isNaN(Number(i[r]))&&(o.push(Number(i[r])+n+""),r++);else if("A"===t)for(o.push(t),r++;i.length>r&&!isNaN(Number(i[r]));)o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&o.push(i[r++]),i.length>r&&(o.push(Number(i[r])+e+""),r++),i.length>r&&(o.push(Number(i[r])+n+""),r++);else"Z"===t||"z"===t?(o.push(t),r++):(o.push(i[r]),r++)}return o.join(" ")}const _r=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Pr(t){const[e,n,i]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*i>150?"#222":"#fff"}function Cr(t,e,n){const i=e.nodeIDAccessor;return"function"==typeof i?i(t.data)+"":"string"==typeof i&&void 0!==t.data[i]?t.data[i]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+n}function Tr(t){return t?"function"==typeof t?t:e=>{var n;return(null===(n=e.data)||void 0===n?void 0:n[t])||e[t]||e.id}:null}function Er(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:_r}function Or(t){var e;return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:(null===(e=t.themeSemantic)||void 0===e?void 0:e.primary)?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}function Dr(t,e,n,i,o){if("horizontal"===o){const o=(t+n)/2;return`M ${t},${e} C ${o},${e} ${o},${i} ${n},${i}`}if("radial"===o){const o=(t+n)/2;return`M ${t},${e} Q ${o},${e} ${o},${(e+i)/2} T ${n},${i}`}{const o=(e+i)/2;return`M ${t},${e} C ${t},${o} ${n},${o} ${n},${i}`}}const Lr={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,n,i){var o;const r=n.__hierarchyRoot;if(!r)return;const l=n.chartType,s=function(t){if(t)return"function"==typeof t?t:e=>e[t]}(n.childrenAccessor),a=n.hierarchySum,c="function"==typeof a?a:"string"==typeof a?t=>Number(t[a])||0:t=>Number(t.value)||0,u=G(r,s);u.sum(c),u.sort((t,e)=>{var n,i;return(null!==(n=e.value)&&void 0!==n?n:0)-(null!==(i=t.value)&&void 0!==i?i:0)});const[d,h]=i;switch(l){case"tree":!function(t,e,n,i){const o=e.treeOrientation||"vertical",r=Q();r.size("horizontal"===o?[i,n]:"radial"===o?[2*Math.PI,Math.min(n,i)/2*.8]:[n,i]),r(t)}(u,n,d,h);break;case"cluster":!function(t,e,n,i){const o=e.treeOrientation||"vertical",r=Z();r.size("horizontal"===o?[i,n]:"radial"===o?[2*Math.PI,Math.min(n,i)/2*.8]:[n,i]),r(t)}(u,n,d,h);break;case"treemap":!function(t,e,n,i){var o,r;const l=null!==(o=e.padding)&&void 0!==o?o:4,s=null!==(r=e.paddingTop)&&void 0!==r?r:0,a=U().size([n,i]).tile(K).padding(l);s>0&&a.paddingTop(s),a(t)}(u,n,d,h);break;case"circlepack":!function(t,e,n,i){var o;const r=null!==(o=e.padding)&&void 0!==o?o:4;q().size([n,i]).padding(r)(t)}(u,n,d,h);break;case"partition":!function(t,e,n,i){var o;V().size([n,i]).padding(null!==(o=e.padding)&&void 0!==o?o:1)(t)}(u,n,d,h)}const f=u.descendants();t.length=0,e.length=0;const g=new Map;for(let e=0;f.length>e;e++){const i=f[e],r={id:Cr(i,n,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=i.value)&&void 0!==o?o:0,depth:i.depth,data:i.data,createdByFrame:!0};"tree"===l||"cluster"===l?Nr(r,i,n):"treemap"===l||"partition"===l?$r(r,i):"circlepack"===l&&Ir(r,i),r.__hierarchyNode=i,t.push(r),g.set(i,r)}if("tree"===l||"cluster"===l)for(const t of f)if(t.parent){const n=g.get(t.parent),i=g.get(t);n&&i&&e.push({source:n,target:i,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,n,i){const o=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(t,e,n,i,o,r){var l,s,a,c,u,d,h,f;const g=[],y=[],p=[],v=n.treeOrientation||"vertical",m="radial"===v,x=i[0]/2,b=i[1]/2,k="number"==typeof(w=n.nodeSize)?w:5;var w;for(const e of t){let t=e.x,i=e.y;m&&(t+=x,i+=b);const r=o(yr(e,"nodeStyle"));let a=r.fill||Or(n);if(n.colorByDepth&&void 0!==e.depth){const t=Er(n);a=t[e.depth%t.length]}const c={fill:a,stroke:r.stroke||(null===(l=n.themeSemantic)||void 0===l?void 0:l.surface)||"#fff",strokeWidth:null!==(s=r.strokeWidth)&&void 0!==s?s:1,opacity:r.opacity};g.push({type:"circle",cx:t,cy:i,r:k,style:c,datum:e,id:e.id,label:e.id,depth:e.depth})}const A=null!==(a=n.edgeOpacity)&&void 0!==a?a:.5;for(const t of e){const e="object"==typeof t.source?t.source:null,i="object"==typeof t.target?t.target:null;if(!e||!i)continue;let o=e.x,l=e.y,s=i.x,a=i.y;m&&(o+=x,l+=b,s+=x,a+=b);const f=Dr(o,l,s,a,v),g=r(yr(t,"edgeStyle")),p={fill:"none",stroke:g.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=n.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=g.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=g.opacity)&&void 0!==h?h:A};y.push({type:"curved",pathD:f,style:p,datum:t})}if(!1!==n.showLabels){const e=Tr(n.nodeLabel);for(const n of t){const t=e?e(n):n.id;if(!t)continue;let i,o,r,l=n.x,s=n.y;if(m&&(l+=x,s+=b),m){const t=l-x,e=s-b,n=Math.sqrt(t*t+e*e);n>0?(i=l+t/n*10,o=s+e/n*10,r=0>t?"end":"start"):(i=l,o=s-12,r="middle")}else"horizontal"===v?((null===(f=n.data)||void 0===f?void 0:f.children)&&0!==n.data.children.length?(i=l-k-6,r="end"):(i=l+k+6,r="start"),o=s):(i=l,o=s+k+14,r="middle");p.push({x:i,y:o,text:t+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:y,labels:p}}(t,e,n,i,o,r);case"treemap":case"partition":return function(t,e,n,i){var o,r,l,s,a;const c=[],u=[];for(const n of t){const t=n.x1-n.x0,l=n.y1-n.y0;if(0>=t||0>=l)continue;const s=i(yr(n,"nodeStyle"));let a=s.fill||Or(e);if(e.colorByDepth&&void 0!==n.depth){const t=Er(e);a=t[n.depth%t.length]}const u={fill:a,stroke:s.stroke||(null===(o=e.themeSemantic)||void 0===o?void 0:o.surface)||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:t,h:l,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=Tr(e.nodeLabel),o=e.labelMode||"leaf",r="partition"===e.chartType;for(const c of t){const t=c.x1-c.x0,d=c.y1-c.y0;if(0>=t||0>=d)continue;const h=!((null===(l=c.data)||void 0===l?void 0:l.children)&&c.data.children.length>0);if(!r){if("leaf"===o&&!h)continue;if("parent"===o&&h)continue}const f=n?n(c):c.id;if(!f)continue;if((h?30:40)>t||(h?16:14)>d)continue;let g=i(yr(c,"nodeStyle")).fill||Or(e);if(e.colorByDepth&&void 0!==c.depth){const t=Er(e);g=t[c.depth%t.length]}const y="string"==typeof g?Pr(g):null!==(a=null===(s=e.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==a?a:"#000";u.push(h?{x:c.x0+t/2,y:c.y0+d/2,text:f+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,d)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:f+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(t,n,0,o);case"circlepack":return function(t,e,n,i){var o,r,l,s,a,c,u,d,h,f;const g=[],y=[];for(const n of t){const t=null!==(o=n.__radius)&&void 0!==o?o:5;if(0>=t)continue;const a=i(yr(n,"nodeStyle"));let c=a.fill||Or(e);if(e.colorByDepth&&void 0!==n.depth){const t=Er(e);c=t[n.depth%t.length]}const u={fill:c,stroke:a.stroke||(null===(r=e.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=a.strokeWidth)&&void 0!==l?l:1,opacity:null!==(s=a.opacity)&&void 0!==s?s:.7};g.push({type:"circle",cx:n.x,cy:n.y,r:t,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=Tr(e.nodeLabel);for(const o of t){const t=null!==(a=o.__radius)&&void 0!==a?a:5,r=n?n(o):o.id;if(!r)continue;if(15>t)continue;const l=!((null===(c=o.data)||void 0===c?void 0:c.children)&&o.data.children.length>0);let s=i(yr(o,"nodeStyle")).fill||Or(e);if(e.colorByDepth&&void 0!==o.depth){const t=Er(e);s=t[o.depth%t.length]}if(l){const n="string"==typeof s?Pr(s):null!==(d=null===(u=e.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";y.push({x:o.x,y:o.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:n})}else y.push({x:o.x,y:o.y-t+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:(null===(h=e.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(f=e.themeSemantic)||void 0===f?void 0:f.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:g,sceneEdges:[],labels:y}}(t,n,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Nr(t,e,n){const i=n.treeOrientation||"vertical";if("radial"===i){const n=e.x,i=e.y;t.x=i*Math.cos(n-Math.PI/2),t.y=i*Math.sin(n-Math.PI/2)}else"horizontal"===i?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function $r(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function Ir(t,e){var n;const i=null!==(n=e.r)&&void 0!==n?n:0;t.x=e.x,t.y=e.y,t.x0=e.x-i,t.x1=e.x+i,t.y0=e.y-i,t.y1=e.y+i,t.width=2*i,t.height=2*i,t.__radius=i}function Wr(t){let e=t.__orbitState;return e||(e={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},t.__orbitState=e),e}const zr={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,n,i){const o=n.__hierarchyRoot;o&&function(t,e,n,i,o){var r,l;const s=function(t){if("function"==typeof t)return t;const e=t||"children";return t=>t[e]||null}(n.childrenAccessor),a=function(t){if("function"==typeof t)return t;const e=t||"name";return t=>{var n;return(null!==(n=t[e])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,d=null!==(l=n.orbitEccentricity)&&void 0!==l?l:1,h="number"==typeof u?()=>u:u,f="number"==typeof d?()=>d:d,g=Wr(n);g.metaMap.clear(),i.length=0,o.length=0;const y=new Map;function p(t){var e;const n=null!==(e=y.get(t))&&void 0!==e?e:0;return y.set(t,n+1),0===n?t:`${t}__${n}`}const v=e[0]/2,m=e[1]/2,x=Math.min(e[0],e[1])/2*.85,b=p(a(t));i.push({id:b,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:t}),g.metaMap.set(b,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,n,r,l,u,d,y){const v=s(e);if(!(null==v?void 0:v.length))return;const m=v.length;let x=0,b=0,k=0;for(;m>b;)b+=c[Math.min(k,c.length-1)],k++,x++;let w=0;for(let m=0;x>m;m++){const b=c[Math.min(m,c.length-1)],k=v.slice(w,w+b);if(!k.length)break;const A=(m+1)/x,S={id:n,depth:d,data:e,parentId:n},M=y?u/h(S)*A:u*A,_=W().value(t=>{var e;return(null===(e=s(t))||void 0===e?void 0:e.length)?4:1}).sort(null),P=_(k),C=f(S);for(let e=0;k.length>e;e++){const s=(P[e].startAngle+P[e].endAngle)/2,c=k[e],u=p(a(c)),h=r+M*Math.sin(s),f=l+M*Math.cos(s)*C;i.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:d,data:c}),g.metaMap.set(u,{ring:M,angle:s,depth:d,parentId:n,eccentricity:C}),o.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),t(c,u,h,f,M,d+1,!0)}w+=b}}(t,b,v,m,x,1,!1)}(o,i,n,t,e)},buildScene(t,e,n,i){var o,r,l,s,a,c,u;const d=n.nodeStyle,h=n.nodeSize,f="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,g=[],y=[],p=[];if(!1!==n.orbitShowRings){const e=Wr(n),i=new Map;for(const e of t)i.set(e.id,e);const o=new Map;for(const[,t]of e.metaMap){if(!t.parentId)continue;const e=i.get(t.parentId);if(!e)continue;const n=`${t.parentId}:${t.ring}`;o.has(n)||o.set(n,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}const r=48,l={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:t,parentY:e,ring:n,ecc:i}]of o)for(let o=0;r>o;o++){const s=o/r*Math.PI*2,a=(o+1)/r*Math.PI*2;y.push({type:"line",x1:t+n*Math.sin(s),y1:e+n*Math.cos(s)*i,x2:t+n*Math.sin(a),y2:e+n*Math.cos(a)*i,style:l,datum:null})}}for(const e of t){if(null==e.x||null==e.y)continue;const t=f(yr(e,"nodeSize")),i=d?d(yr(e,"nodeStyle")):{},c={fill:i.fill||(null===(o=n.themeSemantic)||void 0===o?void 0:o.primary)||"#6366f1",stroke:i.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(l=i.strokeWidth)&&void 0!==l?l:1,opacity:null!==(s=i.opacity)&&void 0!==s?s:0===(null!==(a=e.depth)&&void 0!==a?a:0)?1:.85};g.push({type:"circle",cx:e.x,cy:e.y,r:t,style:c,datum:e,id:e.id,label:e.id,depth:e.depth})}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:v.get(t.source),n="object"==typeof t.target?t.target:v.get(t.target);e&&n&&(null!=e.x&&null!=n.x&&y.push({type:"line",x1:e.x,y1:e.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:t}))}if(n.showLabels){const e=n.nodeLabel;for(const n of t){const t=f(yr(n,"nodeSize"));if(4>=t)continue;const i="function"==typeof e?e(n):e&&null!==(u=null===(c=n.data)||void 0===c?void 0:c[e])&&void 0!==u?u:n.id;p.push({x:n.x,y:n.y+t+12,text:i+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:g,sceneEdges:y,labels:p}},tick:(t,e,n,i,o)=>!1!==n.orbitAnimated&&(function(t,e){var n,i;const o=Wr(e),r=null!==(n=e.orbitSpeed)&&void 0!==n?n:.25,l=null!==(i=e.orbitRevolution)&&void 0!==i?i:function(t){switch(t){case"decay":return t=>{var e;return Math.pow(.6,null!==(e=t.depth)&&void 0!==e?e:0)};case"alternate":return t=>{var e;const n=null!==(e=t.depth)&&void 0!==e?e:0;return(n%2==0?1:-1)/(n+1)};default:return t=>{var e;return 1/((null!==(e=t.depth)&&void 0!==e?e:0)+1)}}}(e.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,a=r*(Math.PI/6),c=new Map;for(const e of t)c.set(e.id,e);for(const e of t){const t=o.metaMap.get(e.id);if(!t||!t.parentId)continue;const n=c.get(t.parentId);if(!n)continue;const i=t.angle+s*a*l({id:e.id,depth:t.depth,data:e.data,parentId:t.parentId});e.x=n.x+t.ring*Math.sin(i),e.y=n.y+t.ring*Math.cos(i)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,n),!0)},Rr={sankey:mr,force:xr,chord:Sr,tree:Lr,cluster:Lr,treemap:Lr,circlepack:Lr,partition:Lr,orbit:zr};function Fr(t){return Rr[t]}function Yr(t){return 0===t.length?()=>"#4e79a7":e=>{var n;let i=0;for(let t=0;e.length>t;t++)i=31*i+e.charCodeAt(t)|0;return null!==(n=t[Math.abs(i)%t.length])&&void 0!==n?n:"#4e79a7"}}class jr{constructor(t){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=t,this.tensionConfig=Object.assign(Object.assign({},ko),t.tensionConfig),t.showParticles&&("sankey"===t.chartType||t.customNetworkLayout)&&(this.particlePool=new Ao(2e3))}updateConfig(t){const e=this.config;e.__orbitState&&(t.__orbitState=e.__orbitState),e.__hierarchyRoot&&(t.__hierarchyRoot=e.__hierarchyRoot),this.config=t,this.tensionConfig=Object.assign(Object.assign({},ko),t.tensionConfig),!t.showParticles||"sankey"!==t.chartType&&!t.customNetworkLayout||this.particlePool||(this.particlePool=new Ao(2e3))}ingestHierarchy(t,e){this._boundedPrevSnapshot=new Map;for(const[t,e]of this.nodes)0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1||this._boundedPrevSnapshot.set(t,{x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=t,this.runLayout(e),this._boundedPrevSnapshot=null}ingestBounded(t,e,n){const{nodeIDAccessor:i="id",sourceAccessor:o="source",targetAccessor:r="target",valueAccessor:l="value"}=this.config,s="function"==typeof i?i:t=>t[i],a="function"==typeof o?o:t=>t[o],c="function"==typeof r?r:t=>t[r],u="function"==typeof l?l:t=>{var e;return null!==(e=t[l])&&void 0!==e?e:1};this._boundedPrevSnapshot=new Map;for(const[t,e]of this.nodes)0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1||this._boundedPrevSnapshot.set(t,{x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1});this._boundedEdgeSnapshot=new Map;for(const[,t]of this.edges)t.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,{y0:t.y0,y1:t.y1,sankeyWidth:t.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of t){const t=s(e)+"";this.nodes.set(t,Object.assign(Object.assign({},Br(t)),{data:e}))}for(let t=0;e.length>t;t++){const n=e[t],i=a(n)+"",o=c(n)+"",r=u(n),l=null==r?NaN:Number(r),s=Number.isFinite(l)?l:1;this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Br(i)),{data:n})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Br(o)),{data:n}));const d=`${i}\0${o}\0${t}`,h={source:i,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&Hr(n.bezier)&&(h.bezier=n.bezier),this.edges.set(d,h)}this.runLayout(n)}edgeKey(t,e){return`${t}\0${e}`}ingestEdge(t){const{source:e,target:n,value:i}=t,o=0===this.nodes.size;let r=!1;const l="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=l,this._decaySortedNodes=null,this.nodes.has(e)||(this.nodes.set(e,Br(e)),this.nodeTimestamps.set(e,l),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,Br(n)),this.nodeTimestamps.set(n,l),this.tension+=this.tensionConfig.newNode,r=!0);const s=this.edgeKey(e,n),a=this.edges.get(s);let c=!1;return a?(a.value+=i,this.edgeTimestamps.set(s,l),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:e,target:n,value:i,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,l),this.tension+=this.tensionConfig.newEdge,r=!0),o||r||c||this.tension>=this.tensionConfig.threshold}runLayout(t){var e,n,i,o,r,l,s,a;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Fr(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const t=new Map;for(const s of u)if(void 0!==s._prevX0){const a=(null!==(e=s._prevX1)&&void 0!==e?e:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(i=s._prevY1)&&void 0!==i?i:0)-(null!==(o=s._prevY0)&&void 0!==o?o:0);t.set(s.id,{x:(null!==(r=s._prevX0)&&void 0!==r?r:0)+a/2,y:(null!==(l=s._prevY0)&&void 0!==l?l:0)+c/2})}else 0===s.x&&0===s.y||t.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[e,n]of this._lastPositionSnapshot)t.has(e)||t.set(e,n);this.config.__previousPositions=t.size>0?t:void 0}if(c.computeLayout(u,d,this.config,t),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of u)this.nodes.set(t.id,t);for(let t=0;d.length>t;t++){const e=d[t],n=e._edgeKey||`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}\0${t}`;e._edgeKey=n,this.edges.set(n,e)}const t=this._boundedPrevSnapshot;if(t&&t.size>0)for(const e of this.nodes.values()){const n=t.get(e.id);n&&(e._prevX0=n.x0,e._prevX1=n.x1,e._prevY0=n.y0,e._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const t of this.nodes.values())0===t.x&&0===t.y||h.set(t.id,{x:t.x,y:t.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const f=u.some(t=>void 0!==t._prevX0&&(0!==t._prevX0||0!==t._prevX1||0!==t._prevY0||0!==t._prevY1)),g=null!==(a=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==a?a:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&g>0){const e=t[0]/2,n=t[1]/2;for(const t of this.nodes.values())t._prevX0=e,t._prevX1=e,t._prevY0=n,t._prevY1=n;for(const t of this.edges.values())t._prevY0=n,t._prevY1=n,t._prevSankeyWidth=0,t._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g}}else f&&g>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const t=new Set(this.nodes.keys()),e=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 t)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)t.has(e)||this.removedNodes.add(e);for(const t of e)this.previousEdgeKeys.has(t)||this.addedEdges.add(t);for(const t of this.previousEdgeKeys)e.has(t)||this.removedEdges.add(t);(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=t,this.previousEdgeKeys=e}buildScene(t){var e,n,i,o,r,l;const s=Array.from(this.nodes.values()),a=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=function(t,e,n){if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=ee[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}(this.config.colorScheme,this.config.themeCategorical,jt),u={nodes:s,edges:a,dimensions:{width:t[0],height:t[1],plot:{x:0,y:0,width:t[0],height:t[1]}},theme:{semantic:null!==(e=this.config.themeSemantic)&&void 0!==e?e:{},categorical:[...c]},resolveColor:Yr(c),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{}};let d;try{d=this.config.customNetworkLayout(u)}catch(t){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(i=d.sceneNodes)&&void 0!==i?i:[],this.sceneEdges=null!==(o=d.sceneEdges)&&void 0!==o?o:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(l=d.overlays)&&void 0!==l?l:null)}this.customLayoutOverlays=null;const c=Fr(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(s,a,this.config,t);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const t=Fr(this.config.chartType);return!!(null==t?void 0:t.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(t,e){const n=Fr(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const i=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return n.tick(i,o,this.config,t,e)}cancelIntroAnimation(){this.transition=null;for(const t of this.nodes.values())t._prevX0=void 0,t._prevX1=void 0,t._prevY0=void 0,t._prevY1=void 0;for(const t of this.edges.values())t._prevY0=void 0,t._prevY1=void 0,t._prevSankeyWidth=void 0,t._introFromZero=!1}advanceTransition(t){if(!this.transition)return!1;const e=se(t,this.transition),n=le(e);for(const t of this.nodes.values())void 0===t._targetX0||void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=ae(t._prevX0,t._targetX0,n),t.x1=ae(t._prevX1,t._targetX1,n),t.y0=ae(t._prevY0,t._targetY0,n),t.y1=ae(t._prevY1,t._targetY1,n));for(const t of this.edges.values())void 0!==t._targetY0&&void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&(t._prevSankeyWidth>0||t._introFromZero)&&(t.y0=ae(t._prevY0,t._targetY0,n),t.y1=ae(t._prevY1,t._targetY1,n),t.sankeyWidth=ae(t._prevSankeyWidth,t._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>e||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const t=this._boundedPrevSnapshot;for(const e of this.nodes.values()){const n=null==t?void 0:t.get(e.id);n&&0===e.x0&&0===e.x1&&0===e.y0&&0===e.y1?(e._prevX0=n.x0,e._prevX1=n.x1,e._prevY0=n.y0,e._prevY1=n.y1):(e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1)}const e=this._boundedEdgeSnapshot;for(const t of this.edges.values()){if(e&&0===t.sankeyWidth){const n=e.get(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`);if(n){t._prevY0=n.y0,t._prevY1=n.y1,t._prevSankeyWidth=n.sankeyWidth;continue}}t._prevY0=t.y0,t._prevY1=t.y1,t._prevSankeyWidth=t.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const t="vertical"===this.config.orientation?"down":"right";for(const t of this.nodes.values())if(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;else{const e=5;t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}for(const e of this.edges.values())e.direction=t,this.updateEdgeBezier(e);this.tension=0}saveTargetPositions(){for(const t of this.nodes.values())t._targetX0=t.x0,t._targetX1=t.x1,t._targetY0=t.y0,t._targetY1=t.y1;for(const t of this.edges.values())t._targetY0=t.y0,t._targetY1=t.y1,t._targetSankeyWidth=t.sankeyWidth}restorePreviousPositions(){for(const t of this.nodes.values())void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0,t.x1=t._prevX1,t.y0=t._prevY0,t.y1=t._prevY1);for(const t of this.edges.values())void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0,t.y1=t._prevY1,t.sankeyWidth=t._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const t of this.nodes.values())void 0!==t._targetX0&&(t.x0=t._targetX0,t.x1=t._targetX1,t.y0=t._targetY0,t.y1=t._targetY1);for(const t of this.edges.values())void 0!==t._targetY0&&(t.y0=t._targetY0,t.y1=t._targetY1,t.sankeyWidth=t._targetSankeyWidth),t._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(t){const e="string"==typeof t.source?this.nodes.get(t.source):t.source,n="string"==typeof t.target?this.nodes.get(t.target):t.target;e&&n&&(t.bezier=t.circular&&t.circularPathData?this.buildCircularBezier(t):this.buildStandardBezier(t,e,n))}buildStandardBezier(t,e,n){const i=(t.sankeyWidth||1)/2;if("down"===t.direction){const o=e.x1,r=n.x0,l=tt(o,r);return{circular:!1,points:[{x:t.y0,y:o},{x:t.y0,y:l(.5)},{x:t.y1,y:l(.5)},{x:t.y1,y:r}],halfWidth:i}}const o=e.x1,r=n.x0,l=tt(o,r);return{circular:!1,points:[{x:o,y:t.y0},{x:l(.5),y:t.y0},{x:l(.5),y:t.y1},{x:r,y:t.y1}],halfWidth:i}}buildCircularBezier(t){const e=(t._circularWidth||t.sankeyWidth||1)/2,n=t.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(t._circularStub){const t=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),i=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*t,y:n.sourceY},{x:n.sourceX+.66*t,y:n.sourceY},{x:n.sourceX+t,y:n.sourceY}],[{x:n.targetX-i,y:n.targetY},{x:n.targetX-.66*i,y:n.targetY},{x:n.targetX-.33*i,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:e}}let i;i="down"===t.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 o=[];for(let t=0;i.length-1>t;t++){const e=i[t],n=i[t+1],r=n.x-e.x,l=n.y-e.y;o.push([e,{x:e.x+r/3,y:e.y+l/3},{x:e.x+2*r/3,y:e.y+2*l/3},n])}return{circular:!0,segments:o,halfWidth:e}}rebuildAllBeziers(){for(const t of this.nodes.values())t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;for(const t of this.edges.values())this.updateEdgeBezier(t)}applyPulse(t){var e,n,i,o,r;const l=this.config.pulse;if(!l)return;const s=null!==(e=l.duration)&&void 0!==e?e:500,a=null!==(n=l.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(i=l.glowRadius)&&void 0!==i?i:4;for(const e of this.sceneNodes){const n=e.id;if(!n)continue;const i=this.nodeTimestamps.get(n);if(!i)continue;const o=t-i;s>o&&(e._pulseIntensity=1-o/s,e._pulseColor=a,e._pulseGlowRadius=c)}for(const e of this.sceneEdges){const n=e.datum;if(!n)continue;const i="object"==typeof n.source?null===(o=n.source)||void 0===o?void 0:o.id:n.source,l="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!i||!l)continue;const c=this.edgeTimestamps.get(`${i}\0${l}`);if(!c)continue;const u=t-c;s>u&&(e._pulseIntensity=1-u/s,e._pulseColor=a)}}applyDecay(){var t,e;const n=this.config.decay;if(!n)return;const i=this.nodeTimestamps.size;if(1>=i)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((t,e)=>t[1]-e[1]));const o=this._decaySortedNodes,r=new Map;for(let t=0;o.length>t;t++)r.set(o[t][0],t);for(const o of this.sceneNodes){const l=o.id;if(!l)continue;const s=r.get(l);if(void 0===s)continue;const a=oe(n,s,i),c=null!==(e=null===(t=o.style)||void 0===t?void 0:t.opacity)&&void 0!==e?e:1;o.style=Object.assign(Object.assign({},o.style),{opacity:c*a})}}applyTopologyDiff(t){var e;if(0===this.addedNodes.size)return;const n=t-this.lastTopologyChangeTime;if(n>=2e3)return;const i=1-n/2e3;for(const t of this.sceneNodes){const n=t.id;n&&this.addedNodes.has(n)&&(t._pulseIntensity=Math.max(null!==(e=t._pulseIntensity)&&void 0!==e?e:0,i),t._pulseColor="rgba(34, 197, 94, 0.7)",t._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(t){var e,n;const i=this.config.thresholds;if(!i)return;const o=null!==(e=i.warningColor)&&void 0!==e?e:"#f59e0b",r=null!==(n=i.criticalColor)&&void 0!==n?n:"#ef4444",l=!1!==i.pulse;for(const e of this.sceneNodes){const n=e.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const a=i.metric(s);let c=null;void 0===i.critical||i.critical>a?void 0===i.warning||i.warning>a||(c=o):c=r,c&&(e.style=Object.assign(Object.assign({},e.style),{fill:c}),l&&(e._pulseIntensity=.6+.4*Math.sin(t/300),e._pulseColor=c,e._pulseGlowRadius=6))}}get hasActiveThresholds(){const t=this.config.thresholds;if(!t)return!1;for(const e of this.nodes.values()){const n=t.metric(e);if(void 0!==t.warning&&n>=t.warning||void 0!==t.critical&&n>=t.critical)return!0}return!1}get hasActivePulses(){var t;const e=this.config.pulse;if(!e||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(t=e.duration)&&void 0!==t?t:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(t,e){var n;const i=this.nodes.get(t);if(!i)return null;const o=i.data?Object.assign({},i.data):{};return i.data=e(null!==(n=i.data)&&void 0!==n?n:{}),this.layoutVersion++,o}updateEdge(t,e,n){var i;const o=this.config.valueAccessor,r="function"==typeof o?o:o?t=>t[o]:t=>t.value,l=[];for(const[,o]of this.edges)if(("string"==typeof o.source?o.source:o.source.id)===t&&("string"==typeof o.target?o.target:o.target.id)===e){l.push(o.data?Object.assign({},o.data):{}),o.data=n(null!==(i=o.data)&&void 0!==i?i:{});const t=r(o.data);null!=t&&(o.value=Number(t))}return l.length>0&&this.layoutVersion++,l}removeNode(t){if(!this.nodes.has(t))return!1;this.nodes.delete(t),this.nodeTimestamps.delete(t);for(const[e,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==t&&("string"==typeof n.target?n.target:n.target.id)!==t||(this.edges.delete(e),this.edgeTimestamps.delete(e));return this.layoutVersion++,!0}removeEdge(t,e){const n=[];if(void 0===e){const e=this.config.edgeIdAccessor;if(!e)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const i="function"==typeof e?e:t=>null==t?void 0:t[e];for(const[e,o]of this.edges)o.data&&i(o.data)===t&&n.push(e)}else for(const[i,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===t&&("string"==typeof o.target?o.target:o.target.id)===e&&n.push(i);for(const t of n)this.edges.delete(t),this.edgeTimestamps.delete(t);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Br(t){return{id:t,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Hr(t){if(!t||"object"!=typeof t)return!1;const e=t;if("boolean"!=typeof e.circular)return!1;if("number"!=typeof e.halfWidth||!Number.isFinite(e.halfWidth))return!1;if(e.circular){if(!Array.isArray(e.segments)||0===e.segments.length)return!1;for(const t of e.segments)if(!Xr(t))return!1;return!0}return Xr(e.points)}function Xr(t){if(!Array.isArray(t)||4!==t.length)return!1;for(const e of t){if(!e||"object"!=typeof e)return!1;const t=e;if("number"!=typeof t.x||!Number.isFinite(t.x))return!1;if("number"!=typeof t.y||!Number.isFinite(t.y))return!1}return!0}function Gr(t,e,n,i,o=30){let r=null,l=o,s=1/0;for(const e of t){const t=Vr(e,n,i,o);if(t)if("rect"===e.type){const n=e.w*e.h;s>n&&(r=t,s=n)}else l>t.distance&&(r=t,l=t.distance)}if(r)return r;for(const t of e){if(!1===t.interactive)continue;const e=Qr(t,n,i);e&&l>e.distance&&(r=e,l=e.distance)}return r}function Vr(t,e,n,i=30){switch(t.type){case"circle":return function(t,e,n,i=30){const o=e-t.cx,r=n-t.cy,l=Math.sqrt(o*o+r*r);return l>_e(t.r,i)?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:l}}(t,e,n,i);case"rect":return function(t,e,n){const i=Me(e,n,t);return i.hit?{type:"node",datum:t.datum,x:i.cx,y:i.cy,distance:0}:null}(t,e,n);case"arc":return function(t,e,n){const i=e-t.cx,o=n-t.cy,r=Math.sqrt(i*i+o*o);if(t.innerR-2>r||r>t.outerR+2)return null;const l=Te(Math.atan2(o,i)),s=Te(t.startAngle),a=Te(t.endAngle);if(s>a?l>=s||a>=l:l>=s&&a>=l){const e=(t.startAngle+t.endAngle)/2,n=(t.innerR+t.outerR)/2;return{type:"node",datum:t.datum,x:t.cx+n*Math.cos(e),y:t.cy+n*Math.sin(e),distance:0}}return null}(t,e,n);default:return null}}let qr=null,Ur=null;function Kr(){return Ur||(qr=document.createElement("canvas"),qr.width=1,qr.height=1,Ur=qr.getContext("2d")),Ur}function Zr(t){if(t._cachedPath2D&&t._cachedPath2DSource===t.pathD)return t._cachedPath2D;try{return t._cachedPath2D=new Path2D(t.pathD),t._cachedPath2DSource=t.pathD,t._cachedPath2D}catch(t){return null}}function Qr(t,e,n){switch(t.type){case"bezier":return function(t,e,n){if(!t.pathD)return null;const i=Zr(t),o=Kr();if(!i||!o)return null;try{if(o.isPointInPath(i,e,n))return{type:"edge",datum:t.datum,x:e,y:n,distance:0};const r=o.lineWidth;o.lineWidth=10;const l=o.isPointInStroke(i,e,n);if(o.lineWidth=r,l)return{type:"edge",datum:t.datum,x:e,y:n,distance:4}}catch(t){}return null}(t,e,n);case"line":return function(t,e,n){const i=t.x2-t.x1,o=t.y2-t.y1,r=i*i+o*o;if(0===r)return null;let l=((e-t.x1)*i+(n-t.y1)*o)/r;l=Math.max(0,Math.min(1,l));const s=t.x1+l*i,a=t.y1+l*o,c=Math.sqrt(Math.pow(e-s,2)+Math.pow(n-a,2));return c>5?null:{type:"edge",datum:t.datum,x:s,y:a,distance:c}}(t,e,n);case"ribbon":case"curved":return function(t,e,n){if(!t.pathD)return null;const i=Zr(t),o=Kr();if(!i||!o)return null;try{if(o.isPointInPath(i,e,n))return{type:"edge",datum:t.datum,x:e,y:n,distance:0};const r=o.lineWidth;o.lineWidth=10;const l=o.isPointInStroke(i,e,n);if(o.lineWidth=r,l)return{type:"edge",datum:t.datum,x:e,y:n,distance:4}}catch(t){}return null}(t,e,n);default:return null}}function Jr(o){const{width:r,height:l,totalWidth:s,totalHeight:a,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p,legendPosition:v="right",legendLayout:m,foregroundGraphics:x,sceneNodes:b,annotations:k,svgAnnotationRules:w}=o;return e(n,{children:[e("svg",{role:"img",width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[t("title",{children:"string"==typeof d?d:"Network Chart"}),t("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),e("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((e,n)=>t("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"currentColor",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+n)),k&&k.filter(t=>"widget"!==t.type).map((e,n)=>{if(w){const o=w(e,n,{width:r,height:l,sceneNodes:b});if(o)return t(i.Fragment,{children:o},"annotation-"+n)}return null}),x]}),d&&"string"==typeof d?t("text",{x:s/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:d}):d?t("foreignObject",{x:0,y:0,width:s,height:c.top,children:d}):null,vn({legend:h,totalWidth:s,totalHeight:a,margin:c,legendPosition:v,title:d,legendLayout:m,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p})]}),null==k?void 0:k.filter(t=>"widget"===t.type&&t.nodeId&&b).map((e,n)=>{var i,o,r,l,s,a,u,d,h;const f=b.find(t=>{var n,i,o,r,l;return t.id===e.nodeId||(null===(n=t.datum)||void 0===n?void 0:n.id)===e.nodeId||(null===(o=null===(i=t.datum)||void 0===i?void 0:i.data)||void 0===o?void 0:o.id)===e.nodeId||(null===(l=null===(r=t.datum)||void 0===r?void 0:r.data)||void 0===l?void 0:l.name)===e.nodeId});if(!f)return null;const g=c.left+(null!==(i=f.cx)&&void 0!==i?i:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(o=f.x)&&void 0!==o?o:0),y=c.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(l=f.y)&&void 0!==l?l:0),p=null!==(s=e.dx)&&void 0!==s?s:0,v=null!==(a=e.dy)&&void 0!==a?a:-16,m=null!==(u=e.width)&&void 0!==u?u:32,x=null!==(d=e.height)&&void 0!==d?d:32,k=null!==(h=e.content)&&void 0!==h?h:t("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return t("div",{style:{position:"absolute",left:g+p-m/2,top:y+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+n)})]})}function tl(t){return t._cachedPath2D&&t._cachedPath2DSource===t.pathD||(t._cachedPath2D=new Path2D(t.pathD),t._cachedPath2DSource=t.pathD),t._cachedPath2D}function el(t,e){var n,i,o,r,l,s;if(!e.pathD)return;t.save();const a=tl(e);if(e.style.fill&&"none"!==e.style.fill){const l=e._gradient;if(l){const o=t.createLinearGradient(l.x0,0,l.x1,0),r=null!==(i=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==i?i:.5,s="string"==typeof e.style.fill?e.style.fill:"#999",a=We(t,s)||s;o.addColorStop(0,1===l.from?a:"transparent"),o.addColorStop(1,1===l.to?a:"transparent"),t.fillStyle=o,t.globalAlpha=r}else t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(r=null!==(o=e.style.fillOpacity)&&void 0!==o?o:e.style.opacity)&&void 0!==r?r:.5;t.fill(a)}e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(l=e.style.strokeWidth)&&void 0!==l?l:.5,t.globalAlpha=.5*(null!==(s=e.style.opacity)&&void 0!==s?s:1),t.stroke(a)),e._pulseIntensity&&e._pulseIntensity>0&&(t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.globalAlpha=.2*e._pulseIntensity,t.fill(a)),t.restore()}function nl(t,e){var n,i;t.save();const o=e.style.stroke||"#999";t.strokeStyle=We(t,o)||o,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.strokeDasharray&&t.setLineDash(e.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke(),e._pulseIntensity&&e._pulseIntensity>0&&(t.setLineDash([]),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=(null!==(i=e.style.strokeWidth)&&void 0!==i?i:1)+3*e._pulseIntensity,t.globalAlpha=.4*e._pulseIntensity,t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),t.restore()}function il(t,e){var n,i,o,r;if(!e.pathD)return;t.save();const l=tl(e);e.style.fill&&"none"!==e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(i=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==i?i:.5,t.fill(l)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:.5,t.globalAlpha=.3*(null!==(r=e.style.opacity)&&void 0!==r?r:1),t.stroke(l)),e._pulseIntensity&&e._pulseIntensity>0&&(t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.globalAlpha=.25*e._pulseIntensity,t.fill(l)),t.restore()}function ol(t,e){var n,i;if(!e.pathD)return;t.save();const o=tl(e),r=e.style.stroke||"#999";t.strokeStyle=We(t,r)||r,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.stroke(o),e.style.fill&&"none"!==e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,t.globalAlpha=null!==(i=e.style.fillOpacity)&&void 0!==i?i:.1,t.fill(o)),t.restore()}Jr.displayName="NetworkSVGOverlay";const rl={top:20,right:80,bottom:20,left:80},ll={top:40,right:40,bottom:40,left:40},sl=new Set(["chord","force","circlepack","orbit"]),al=[800,600],cl={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 ul({data:n}){var i,o,r,l,s,a;if("edge"===n.nodeOrEdge){const t=n.data;return t?e("div",{className:"semiotic-tooltip",style:cl,children:[e("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&e("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const c=n.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const n=[];let s=u;for(;s;){const t=null!==(l=null!==(o=null===(i=s.data)||void 0===i?void 0:i.name)&&void 0!==o?o:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==l?l:c.id;null!=t&&n.unshift(t+""),s=s.parent}n.length>1&&n.shift();const a=n.length-1;return e("div",{className:"semiotic-tooltip",style:cl,children:[t("div",{children:n.map((n,i)=>e("span",{children:[i>0&&t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),i===a?t("strong",{children:n}):t("span",{style:{opacity:.7},children:n})]},i))}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(s=c.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=c.targetLinks)||void 0===a?void 0:a.length)||0),h=(c.sourceLinks||[]).reduce((t,e)=>t+(e.value||0),0)+(c.targetLinks||[]).reduce((t,e)=>t+(e.value||0),0);return e("div",{className:"semiotic-tooltip",style:cl,children:[t("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&e("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}ul.ownsChrome=!0;const dl=f(function(n,i){var s,c,u,h,f,g,p,v,m,x,b,k,w,A,S,M,_,P;const{chartType:C,nodes:T,edges:E,data:O,initialEdges:D,nodeIDAccessor:L="id",sourceAccessor:N="source",targetAccessor:$="target",valueAccessor:W="value",edgeIdAccessor:z,childrenAccessor:R,hierarchySum:F,orientation:Y="horizontal",nodeAlign:j="justify",nodePaddingRatio:B=.05,nodeWidth:H=15,iterations:X=300,forceStrength:G=.1,padAngle:V=.01,groupWidth:q=20,sortGroups:U,edgeSort:K,treeOrientation:Z="vertical",edgeType:Q="curve",padding:J,paddingTop:tt,tensionConfig:et,showParticles:nt=!1,particleStyle:it,nodeStyle:ot,edgeStyle:rt,colorBy:lt,colorScheme:st="category10",edgeColorBy:at="source",edgeOpacity:ct=.5,colorByDepth:ut=!1,nodeSize:dt=8,nodeSizeRange:ht=[5,20],nodeLabel:gt,showLabels:yt=!0,labelMode:pt,size:mt=al,responsiveWidth:xt,responsiveHeight:bt,margin:kt,className:wt,background:At,enableHover:St=!0,tooltipContent:Mt,customHoverBehavior:_t,customClickBehavior:Pt,onObservation:Ct,chartId:Tt,onTopologyChange:Et,annotations:Ot,svgAnnotationRules:Dt,legend:Lt,legendPosition:Nt,legendLayout:$t,legendHoverBehavior:It,legendClickBehavior:Wt,legendHighlightedCategory:zt,legendIsolatedCategories:Rt,title:Ft,foregroundGraphics:Yt,backgroundGraphics:jt,decay:Bt,pulse:Ht,transition:Xt,animate:Gt,staleness:Vt,thresholds:qt,accessibleTable:Ut=!0,description:Kt,summary:Zt,orbitMode:Qt,orbitSize:Jt,orbitSpeed:te,orbitRevolution:ee,orbitRevolutionStyle:ie,orbitEccentricity:oe,orbitShowRings:re,orbitAnimated:le,customNetworkLayout:se,layoutConfig:ae}=n,ce=sl.has(C)?ll:rl,ue=o(!0),de=Bi({sizeProp:mt,responsiveWidth:xt,responsiveHeight:bt,userMargin:kt,marginDefault:ce,foregroundGraphics:Yt,backgroundGraphics:jt,animate:Gt,transitionProp:Xt,themeDirtyRef:ue}),{reducedMotionRef:he,responsiveRef:fe,size:ge,margin:ye,adjustedWidth:pe,adjustedHeight:ve,resolvedForeground:me,resolvedBackground:xe,transition:be,introEnabled:ke,tableId:we,rafRef:Ae,renderFnRef:Me,scheduleRender:_e,currentTheme:Pe}=de,Ce=ii(),Te=si(),Ee=r(()=>ft(T),[T]),Oe=r(()=>Array.isArray(E)?ft(E):E,[E]),De=r(()=>Object.assign(Object.assign({},ko),et),[et]),Le=r(()=>Object.assign(Object.assign({},wo),it),[it]),Ne=r(()=>{var t;return{chartType:C,nodeIDAccessor:L,sourceAccessor:N,targetAccessor:$,valueAccessor:W,edgeIdAccessor:z,childrenAccessor:R,hierarchySum:F,orientation:Y,nodeAlign:j,nodePaddingRatio:B,nodeWidth:H,iterations:X,forceStrength:G,padAngle:V,groupWidth:q,sortGroups:U,edgeSort:K,treeOrientation:Z,edgeType:Q,padding:J,paddingTop:tt,tensionConfig:De,showParticles:nt,particleStyle:Le,nodeStyle:ot,edgeStyle:rt,nodeLabel:gt,showLabels:yt,labelMode:pt,colorBy:lt,colorScheme:st,themeCategorical:null===(t=null==Pe?void 0:Pe.colors)||void 0===t?void 0:t.categorical,themeSemantic:vt(Pe),edgeColorBy:at,edgeOpacity:ct,colorByDepth:ut,nodeSize:dt,nodeSizeRange:ht,decay:Bt,pulse:Ht,transition:be,introAnimation:ke,staleness:Vt,thresholds:qt,orbitMode:Qt,orbitSize:Jt,orbitSpeed:te,orbitRevolution:ee,orbitRevolutionStyle:ie,orbitEccentricity:oe,orbitShowRings:re,orbitAnimated:le,customNetworkLayout:se,layoutConfig:ae}},[C,L,N,$,W,R,F,Y,j,B,H,X,G,V,q,U,K,Z,Q,J,tt,De,nt,Le,ot,rt,gt,yt,pt,lt,st,at,ct,ut,dt,ht,Bt,Ht,null==be?void 0:be.duration,null==be?void 0:be.easing,ke,Vt,qt,Qt,Jt,te,ee,ie,oe,re,le,Pe,se,ae]),$e=ci(Ne),Ie=o(null),ze=o(0),Re=o(0),Fe=o(!1),Ye=o(null);Ye.current||(Ye.current=new jr($e));const[je,Be]=d(null),[He,Xe]=d(0),[Ge,Ve]=d(0),[qe,Ue]=d(!1),[Ke,Ze]=d(null),Qe=o(null),Je=o(new Map),on=o(0),ln=a(t=>{if("function"==typeof lt)return lt(t)+"";if("string"==typeof lt&&t.data){const e=t.data[lt];if(void 0!==e){if(!Je.current.has(e+"")){const t=Array.isArray(st)?st:ne;Je.current.set(e+"",t[on.current++%t.length])}return Je.current.get(e+"")}}if(Je.current.has(t.id))return Je.current.get(t.id);const e=Array.isArray(st)?st:ne,n=lt?e[on.current++%e.length]:e[0];return Je.current.set(t.id,n),n},[lt,st]),an=(null===(s=null==Pe?void 0:Pe.colors)||void 0===s?void 0:s.border)||(null===(c=null==Pe?void 0:Pe.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==Pe?void 0:Pe.colors)||void 0===u?void 0:u.primary)||"#999",cn=a(t=>{var e,n;return t?"object"==typeof t?t:null!==(n=null===(e=Ye.current)||void 0===e?void 0:e.nodes.get(t))&&void 0!==n?n:null:null},[]),un=a(t=>{if("function"==typeof at)return at(t);const e=cn(t.source),n=cn(t.target);return"target"===at&&n?ln(n):e?ln(e):an},[at,ln,an,cn]),dn=a(t=>{if("function"==typeof Le.color){const e=cn(t.source);return e?Le.color(t,e):an}if(!(null==it?void 0:it.colorBy))return un(t);const e=Le.colorBy,n=cn(t.source),i=cn(t.target);return"target"===e&&i?ln(i):n?ln(n):an},[null==it?void 0:it.colorBy,Le.color,Le.colorBy,ln,un,an,cn]),hn=("sankey"===C||!!se)&&nt||!!Ht||null!==(f=null===(h=Ye.current)||void 0===h?void 0:h.isAnimating)&&void 0!==f&&f;l(()=>{var t;null===(t=Ye.current)||void 0===t||t.updateConfig($e),ue.current=!0,_e()},[$e,_e]);const fn=a(()=>{var t,e;Ze(null!==(e=null===(t=Ye.current)||void 0===t?void 0:t.customLayoutOverlays)&&void 0!==e?e:null)},[]);l(()=>{var t;const e=Ye.current;if(e){e.buildScene([pe,ve]),fn();for(const n of e.sceneNodes)n.id&&"string"==typeof(null===(t=n.style)||void 0===t?void 0:t.fill)&&Je.current.set(n.id,n.style.fill);ue.current=!0,_e()}},[Pe,pe,ve,_e,fn]);const gn=a(()=>{var t;const e=Ye.current;if(!e)return;e.runLayout([pe,ve]),e.buildScene([pe,ve]),fn(),ue.current=!0;for(const n of e.sceneNodes)n.id&&"string"==typeof(null===(t=n.style)||void 0===t?void 0:t.fill)&&Je.current.set(n.id,n.style.fill);const n=Array.isArray(st)?st:ne,i=Array.from(e.nodes.values());for(let t=0;i.length>t;t++){const e=i[t];Je.current.has(e.id)||Je.current.set(e.id,n[t%n.length])}if(on.current=i.length,Xe(e.layoutVersion),Et){const{nodes:t,edges:n}=e.getLayoutData();Et(t,n)}},[pe,ve,Et,st,fn]),yn=a(t=>{if(null==t||"object"!=typeof t)return;const e=Ye.current;e&&(e.ingestEdge(t)&&gn(),_e())},[gn,_e]),pn=a(t=>{const e=Ye.current;if(!e)return;let n=!1;for(const i of t)null!=i&&"object"==typeof i&&e.ingestEdge(i)&&(n=!0);n&&gn(),_e()},[gn,_e]),vn=a(()=>{var t;null===(t=Ye.current)||void 0===t||t.clear(),Je.current.clear(),on.current=0,Xe(0),Be(null),Qe.current=null,ue.current=!0,_e()},[_e]),mn=a(()=>{const t=Ye.current;t&&(t.tension+=999,gn(),_e())},[gn,_e]);y(i,()=>({push:yn,pushMany:pn,removeNode:t=>{var e,n,i;const o=null!==(n=null===(e=Ye.current)||void 0===e?void 0:e.removeNode(t))&&void 0!==n&&n;if(o){const e=(null===(i=Qe.current)||void 0===i?void 0:i.data)?"function"==typeof L?L(Qe.current.data):Qe.current.data[L]:void 0;Qe.current&&"node"===Qe.current.nodeOrEdge&&e===t&&(Qe.current=null,Be(null)),Je.current.delete(t),gn(),ue.current=!0,_e()}return o},removeEdge:(t,e)=>{var n,i;const o=null!==(i=null===(n=Ye.current)||void 0===n?void 0:n.removeEdge(t,e))&&void 0!==i&&i;if(o){if(Qe.current&&"edge"===Qe.current.nodeOrEdge){const n=Qe.current.data;let i;i=void 0!==e?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===t&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===e:!z||!n||("function"==typeof z?z:t=>null==t?void 0:t[z])(n)===t,i&&(Qe.current=null,Be(null))}gn(),ue.current=!0,_e()}return o},updateNode:(t,e)=>{var n,i;const o=null!==(i=null===(n=Ye.current)||void 0===n?void 0:n.updateNode(t,e))&&void 0!==i?i:null;return o&&(ue.current=!0,_e()),o},updateEdge:(t,e,n)=>{var i,o;const r=null!==(o=null===(i=Ye.current)||void 0===i?void 0:i.updateEdge(t,e,n))&&void 0!==o?o:[];return r.length>0&&(gn(),ue.current=!0,_e()),r},clear:vn,getTopology:()=>{var t,e;return null!==(e=null===(t=Ye.current)||void 0===t?void 0:t.getLayoutData())&&void 0!==e?e:{nodes:[],edges:[]}},getTopologyDiff:()=>{const t=Ye.current;return t?{addedNodes:Array.from(t.addedNodes),removedNodes:Array.from(t.removedNodes),addedEdges:Array.from(t.addedEdges),removedEdges:Array.from(t.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:mn,getTension:()=>{var t,e;return null!==(e=null===(t=Ye.current)||void 0===t?void 0:t.tension)&&void 0!==e?e:0}}),[yn,pn,vn,mn,gn,_e]);const xn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),bn=xn?O||(Array.isArray(E)?void 0:E):void 0;l(()=>{var t;const e=Ye.current;if(e)if(xn&&bn)e.ingestHierarchy(bn,[pe,ve]),e.buildScene([pe,ve]),fn(),ue.current=!0,_e();else{const n=Ee,i=Array.isArray(Oe)?Oe:[];if(0===n.length&&0===i.length)return;e.ingestBounded(n,i,[pe,ve]),e.buildScene([pe,ve]),fn();for(const n of e.sceneNodes)n.id&&(null===(t=n.style)||void 0===t?void 0:t.fill)&&Je.current.set(n.id,n.style.fill+"");const o=Array.isArray(st)?st:ne,r=Array.from(e.nodes.values());for(let t=0;r.length>t;t++){const e=r[t];Je.current.has(e.id)||Je.current.set(e.id,o[t%o.length])}on.current=r.length,ue.current=!0,_e()}},[Ee,Oe,O,bn,xn,pe,ve,$e,_e,st,fn]),l(()=>{D&&D.length>0&&pn(D)},[]);const kn=a(t=>{if(_t&&_t(t),Ct){const e=Date.now();Ct(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt}:{type:"hover-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt})}},[_t,Ct,Tt]),wn=a(t=>{if(Pt&&Pt(t),Ct){const e=Date.now();Ct(t?{type:"click",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt}:{type:"click-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:Tt})}},[Pt,Ct,Tt]),{hoverHandlerRef:An,hoverLeaveRef:Sn,onPointerMove:Mn,onPointerLeave:_n}=de;An.current=t=>{if(!St)return;const e=Ie.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-ye.left,o=t.clientY-n.top-ye.top;if(0>i||i>pe||0>o||o>ve)return void(Qe.current&&(Qe.current=null,Be(null),kn&&(kn(null),ue.current=!0),_e()));const r=Ye.current;if(!r)return;const l=Gr(r.sceneNodes,r.sceneEdges,i,o);if(!l)return void(Qe.current&&(Qe.current=null,Be(null),kn&&(kn(null),ue.current=!0),_e()));const s=zi(l.datum||{},l.x,l.y,{nodeOrEdge:l.type});Qe.current=s,Be(s),kn&&(kn(s),ue.current=!0),_e()},Sn.current=()=>{Qe.current&&(Qe.current=null,Be(null),kn&&(kn(null),ue.current=!0),_e())};const Pn=o(()=>{});Pn.current=t=>{if(!Pt&&!Ct)return;const e=Ie.current;if(!e)return;const n=e.getBoundingClientRect(),i=t.clientX-n.left-ye.left,o=t.clientY-n.top-ye.top;if(0>i||i>pe||0>o||o>ve)return;const r=Ye.current;if(!r)return;const l=Gr(r.sceneNodes,r.sceneEdges,i,o);wn(l?zi(l.datum||{},l.x,l.y,{nodeOrEdge:l.type}):null)};const Cn=a(t=>Pn.current(t),[]),Tn=o(-1),En=o(null),On=o(-1),Dn=a(t=>{var e;const n=Ye.current;if(!n)return;const i=function(t){var e,n,i,o,r,l;const s=[];for(const a of t)if("circle"===a.type&&null!=a.cx){if(0>=a.r)continue;s.push({x:a.cx,y:a.cy,datum:a.datum,shape:"circle",group:null!==(n=null===(e=a.datum)||void 0===e?void 0:e.id)&&void 0!==n?n:"_default"})}else if("rect"===a.type&&null!=a.x){if(0>=a.w||0>=a.h)continue;s.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=null===(i=a.datum)||void 0===i?void 0:i.id)&&void 0!==o?o:"_default"})}else"arc"===a.type&&null!=a.cx&&s.push({x:a.cx,y:a.cy,datum:a.datum,shape:"circle",group:null!==(l=null===(r=a.datum)||void 0===r?void 0:r.id)&&void 0!==l?l:"_default"});return s.sort((t,e)=>t.x-e.x||t.y-e.y),s}(n.sceneNodes);if(0===i.length)return;const o=tn(i),r=Tn.current;if(0>r){if("Escape"===t.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(t.key))return;t.preventDefault(),Tn.current=0,On.current=-1;const e=o.flat[0];En.current={shape:e.shape,w:e.w,h:e.h};const n=zi(e.datum||{},e.x,e.y,{nodeOrEdge:"node"});return Qe.current=n,Be(n),kn&&(kn(n),ue.current=!0),void _e()}const l=en(o,r),s=function(t,e,n,i,o){var r,l,s;const a=n.flat[e.flatIndex];if(!a)return nn(t,e,n);const c=null===(r=a.datum)||void 0===r?void 0:r.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const i=null!==(l=function(t,e,n){let i=null,o=1/0;for(let r=0;t.flat.length>r;r++){const l=t.flat[r];if(l===e)continue;const s=l.x-e.x,a=l.y-e.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(a);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(a);break;case"down":c=a>0&&Math.abs(a)>=Math.abs(s);break;case"up":c=0>a&&Math.abs(a)>=Math.abs(s)}if(!c)continue;const u=s*s+a*a;o>u&&(o=u,i=r)}return i}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up"))&&void 0!==l?l:e.flatIndex;return i!==e.flatIndex&&(o.current=-1),i}case"Enter":{if(null==c)return e.flatIndex;const t=function(t,e){var n;const i=t+"",o=[];for(const t of e){const e=null!==(n=t.datum)&&void 0!==n?n:t,r=rn(e.source),l=rn(e.target),s=null!=r,a=null!=l;s&&r+""===i&&a?o.push(l+""):a&&l+""===i&&s&&o.push(r+"")}return o}(c,i);if(0===t.length)return e.flatIndex;const r=null!==(s=n.idToIdx.get(t[(o.current+1)%t.length]))&&void 0!==s?s:-1;return 0>r?e.flatIndex:(o.current=-1,r)}default:{const i=nn(t,e,n);return null!==i&&i!==e.flatIndex&&(o.current=-1),i}}}(t.key,l,o,null!==(e=n.sceneEdges)&&void 0!==e?e:[],On);if(null===s)return;if(t.preventDefault(),0>s)return Tn.current=-1,En.current=null,On.current=-1,Qe.current=null,Be(null),kn&&(kn(null),ue.current=!0),void _e();Tn.current=s;const a=o.flat[s];En.current={shape:a.shape,w:a.w,h:a.h};const c={data:a.datum||{},x:a.x,y:a.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qe.current=c,Be(c),kn&&(kn(c),ue.current=!0),_e()},[kn,_e]),Ln=a(t=>{Tn.current=-1,En.current=null,Mn(t)},[Mn]);Me.current=()=>{var t,e,n,i,o,r,l;Ae.current=0;const s=Ie.current;if(!s)return;const a=s.getContext("2d");if(!a)return;const c=Ye.current;if(!c)return;const u=performance.now(),d=ze.current?Math.min((u-ze.current)/1e3,.1):.016;ze.current=u;const h=c.advanceTransition(he.current?u+1e6:u),f=!he.current&&h,g=!he.current&&c.tickAnimation([pe,ve],d);(h||ue.current||g)&&c.buildScene([pe,ve]);const y=Xi();if(!Hi(s,ge,ye,y))return;if(a.clearRect(-ye.left,-ye.top,ge[0],ge[1]),At){const t=We(a,At);t&&(a.fillStyle=t,a.fillRect(0,0,pe,ve))}Bt&&c.applyDecay(),Ht&&c.applyPulse(u),qt&&c.applyThresholds(u),c.applyTopologyDiff(u);const p=null!==(t=null==Vt?void 0:Vt.threshold)&&void 0!==t?t:5e3,v=Vt&&c.lastIngestTime>0&&u-c.lastIngestTime>p;if(v&&(a.globalAlpha=null!==(e=null==Vt?void 0:Vt.dimOpacity)&&void 0!==e?e:.5),function(t,e){for(const n of e)switch(n.type){case"bezier":el(t,n);break;case"line":nl(t,n);break;case"ribbon":il(t,n);break;case"curved":ol(t,n)}}(a,c.sceneEdges),function(t,e){var n,i,o;for(const r of e){if("rect"!==r.type)continue;const e=r;e.w>0&&e.h>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fillRect(e.x,e.y,e.w,e.h)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.strokeRect(e.x,e.y,e.w,e.h)),Ki(t,e),t.restore())}}(a,c.sceneNodes),function(t,e){var n,i,o;for(const r of e){if("circle"!==r.type)continue;const e=r;e.r>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.r,0,2*Math.PI),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),Zi(t,e),t.restore())}}(a,c.sceneNodes),function(t,e){var n,i,o;for(const r of e){if("arc"!==r.type)continue;const e=r;t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.outerR,e.startAngle,e.endAngle),t.arc(e.cx,e.cy,e.innerR,e.endAngle,e.startAngle,!0),t.closePath(),e.style.fill&&(t.fillStyle="string"==typeof e.style.fill&&We(t,e.style.fill)||e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=We(t,e.style.stroke)||e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),t.restore()}}(a,c.sceneNodes),nt&&c.particlePool&&!v){const t=Array.from(c.edges.values());if(t.length>0){!function(t,e,n,i){var o,r;const l=null!==(o=i.spawnRate)&&void 0!==o?o:wo.spawnRate,s=null!==(r=i.maxPerEdge)&&void 0!==r?r:wo.maxPerEdge;for(let i=0;e.length>i;i++){const o=e[i];if(!o.bezier)continue;if(t.countForEdge(i)>=s)continue;const r=o.value*l*n*(o.bezier.circular?.3:1),a=Math.floor(r),c=r-a;let u=a;Math.random()<c&&u++;for(let e=0;u>e&&t.countForEdge(i)<s;e++)t.spawn(i)}}(c.particlePool,t,d,Le);const e=.5*(null!==(n=Le.speedMultiplier)&&void 0!==n?n:1);let i;if(Le.proportionalSpeed){const e=t.reduce((t,e)=>Math.max(t,e.value||1),1);i=t.map(t=>.3+(t.value||1)/e*1.7)}c.particlePool.step(d,e,t,i),function(t,e,n,i,o){var r,l;const s=null!==(r=i.radius)&&void 0!==r?r:wo.radius,a=null!==(l=i.opacity)&&void 0!==l?l:wo.opacity;t.globalAlpha=a;for(let r=0;e.particles.length>r;r++){const l=e.particles[r];if(!l.active)continue;const a=n[l.edgeIndex];if(!a)continue;let c;c="string"==typeof i.color&&"inherit"!==i.color?i.color:o(a),t.fillStyle=We(t,c)||c,t.beginPath(),t.arc(l.x,l.y,s,0,2*Math.PI),t.fill()}t.globalAlpha=1}(a,c.particlePool,t,Le,dn)}}v&&(a.globalAlpha=1);const m=ue.current;if(ue.current=!1,m||f||g){const t=Ie.current;t&&t.setAttribute("aria-label",vi(null!==(o=null===(i=c.sceneNodes)||void 0===i?void 0:i.length)&&void 0!==o?o:0,null!==(l=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==l?l:0,"Network chart"))}const x=m||f||g||Fe.current;x&&u-Re.current>=33?(Ve(t=>t+1),Re.current=u,Fe.current=!1):Fe.current=!!x,(hn||f||null!=c.transition||g||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Fe.current)&&(Ae.current=requestAnimationFrame(()=>Me.current()))},ai({hydrated:Ce,wasHydratingFromSSR:Te,storeRef:Ye,dirtyRef:ue,renderFnRef:Me}),l(()=>{ue.current=!0,_e()},[C,pe,ve,At,_e]),sn(Vt,Ye,ue,_e,qe,Ue);const Nn=St&&je?t(Fi,{x:je.x,y:je.y,containerWidth:pe,containerHeight:ve,margin:ye,className:"stream-network-tooltip",zIndex:2,children:Mt?Mt(je):t(ul,{data:je})}):null;if(ei||!Ce&&Te){const n=Ye.current;if(n){const t=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),e=t?O||(Array.isArray(E)?void 0:E):void 0;if(t&&e)n.ingestHierarchy(e,[pe,ve]),n.buildScene([pe,ve]);else{const t=Ee,e=Array.isArray(Oe)?Oe:[];(t.length>0||e.length>0)&&(n.ingestBounded(t,e,[pe,ve]),n.buildScene([pe,ve]))}}const i=null!==(g=null==n?void 0:n.sceneNodes)&&void 0!==g?g:[],o=null!==(p=null==n?void 0:n.sceneEdges)&&void 0!==p?p:[],r=null!==(v=null==n?void 0:n.labels)&&void 0!==v?v:[];return e("div",{ref:fe,className:"stream-network-frame"+(wt?" "+wt:""),role:"img","aria-label":Kt||("string"==typeof Ft?Ft:"Network chart"),style:{position:"relative",width:xt?"100%":ge[0],height:bt?"100%":ge[1]},children:[t(Di,{summary:Zt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:ge[0],height:ge[1],style:{position:"absolute",left:0,top:0},children:[xe&&t("g",{transform:`translate(${ye.left},${ye.top})`,children:xe}),e("g",{transform:`translate(${ye.left},${ye.top})`,children:[At&&t("rect",{x:0,y:0,width:pe,height:ve,fill:At}),o.map((e,n)=>function(e,n){switch(e.type){case"line":return t("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+n);case"bezier":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"#999"),fillOpacity:i.style.fillOpacity,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-edge-"+n)}case"ribbon":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"#999"),fillOpacity:i.style.fillOpacity,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-edge-"+n)}case"curved":{const i=e;return t("path",{d:i.pathD,fill:ti(i.style.fill,"none"),stroke:i.style.stroke||"#999",strokeWidth:i.style.strokeWidth||1,opacity:i.style.opacity},"net-edge-"+n)}default:return null}}(e,n)).filter(Boolean),i.map((e,n)=>function(e,n){switch(e.type){case"circle":{const i=e;return t("circle",{cx:i.cx,cy:i.cy,r:i.r,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-circle-"+n)}case"rect":{const i=e;return t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-rect-"+n)}case"arc":{const i=e,o=I().innerRadius(i.innerR).outerRadius(i.outerR).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2)(Jn)||"";return t("path",{d:o,transform:`translate(${i.cx},${i.cy})`,fill:ti(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},"net-arc-"+n)}default:return null}}(e,n)).filter(Boolean),r.map((e,n)=>function(e,n){return t("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"#333",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+n)}(e,n)).filter(Boolean)]})]}),t(Jr,{width:pe,height:ve,totalWidth:ge[0],totalHeight:ge[1],margin:ye,labels:r,sceneNodes:i,title:Ft,legend:Lt,legendPosition:Nt,legendLayout:$t,legendHoverBehavior:It,legendClickBehavior:Wt,legendHighlightedCategory:zt,legendIsolatedCategories:Rt,foregroundGraphics:Se(me,null===(m=Ye.current)||void 0===m?void 0:m.customLayoutOverlays),annotations:Ot,svgAnnotationRules:Dt,annotationFrame:0})]})}const $n=Ye.current;return e("div",{ref:fe,className:"stream-network-frame"+(wt?" "+wt:""),role:"group","aria-label":Kt||("string"==typeof Ft?Ft:"Network chart"),tabIndex:0,style:{position:"relative",width:xt?"100%":ge[0],height:bt?"100%":ge[1],overflow:"visible"},onKeyDown:Dn,children:[Ut&&t(Li,{tableId:we}),Ut&&t(Oi,{nodes:null!==(x=null==$n?void 0:$n.sceneNodes)&&void 0!==x?x:[],edges:null!==(b=null==$n?void 0:$n.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart",tableId:we,chartTitle:"string"==typeof Ft?Ft:void 0}),t(Di,{summary:Zt}),e("div",{role:"img","aria-label":Kt||("string"==typeof Ft?Ft:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:St?Ln:void 0,onMouseLeave:St?_n:void 0,onClick:Pt||Ct?Cn:void 0,children:[xe&&t("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ge[0],height:ge[1],pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${ye.left},${ye.top})`,children:xe})}),t("canvas",{ref:Ie,"aria-label":vi(null!==(w=null===(k=null==$n?void 0:$n.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==$n?void 0:$n.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),t(Ni,{hoverPoint:je}),t(Jr,{width:pe,height:ve,totalWidth:ge[0],totalHeight:ge[1],margin:ye,labels:(null==$n?void 0:$n.labels)||[],sceneNodes:null==$n?void 0:$n.sceneNodes,title:Ft,legend:Lt,legendPosition:Nt,legendLayout:$t,legendHoverBehavior:It,legendClickBehavior:Wt,legendHighlightedCategory:zt,legendIsolatedCategories:Rt,foregroundGraphics:Se(me,Ke),annotations:Ot,svgAnnotationRules:Dt,annotationFrame:Ge}),t(Ii,{active:Tn.current>=0,hoverPoint:je,margin:ye,size:ge,shape:null===(M=En.current)||void 0===M?void 0:M.shape,width:null===(_=En.current)||void 0===_?void 0:_.w,height:null===(P=En.current)||void 0===P?void 0:P.h}),Nn,(null==Vt?void 0:Vt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Vt.badgePosition?{top:4,left:4}:"bottom-left"===Vt.badgePosition?{bottom:4,left:4}:"bottom-right"===Vt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:qe?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:qe?"STALE":"LIVE"})]})]})});function hl(t){const e=[];for(const[n,i]of Object.entries(t.fields))if("point"===i.type)e.push(t=>i.values.has(t[n]));else{const[t,o]=i.range;e.push(e=>{const i=e[n];return i>=t&&o>=i})}return t=>e.every(e=>e(t))}function fl(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}dl.displayName="StreamNetworkFrame";const[gl,yl]=yt(t=>({selections:new Map,setClause(e,n){t(t=>{const i=new Map(t.selections),o=fl(i,e),r=new Map(o.clauses);return r.set(n.clientId,n),i.set(e,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},clearClause(e,n){t(t=>{const i=t.selections.get(e);if(!i)return{};const o=new Map(t.selections),r=new Map(i.clauses);return r.delete(n),o.set(e,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},setResolution(e,n){t(t=>{const i=new Map(t.selections),o=fl(i,e);return i.set(e,Object.assign(Object.assign({},o),{resolution:n})),{selections:i}})},clearSelection(e){t(t=>{const n=new Map(t.selections),i=n.get(e);return i&&n.set(e,Object.assign(Object.assign({},i),{clauses:new Map})),{selections:n}})}})),[pl,vl]=yt(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const n=t.observations;return n.push(e),n.length>t.maxObservations&&n.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}}));function ml(t){const e=g(),n=t.clientId||e,{name:i}=t,o=yl(t=>t.selections.get(i)),l=yl(t=>t.setClause),s=yl(t=>t.clearClause),c=r(()=>!!o&&o.clauses.size>0,[o]);return{predicate:r(()=>o&&0!==o.clauses.size?function(t,e){const n=[];for(const[i,o]of t.clauses)"crossfilter"===t.resolution&&i===e||n.push(hl(o));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(o,n):()=>!0,[o,n]),isActive:c,selectPoints:a(t=>{const e={};for(const[n,i]of Object.entries(t))e[n]={type:"point",values:new Set(i)};l(i,{clientId:n,type:"point",fields:e})},[n,i,l]),selectInterval:a(t=>{const e={};for(const[n,i]of Object.entries(t))e[n]={type:"interval",range:i};l(i,{clientId:n,type:"interval",fields:e})},[n,i,l]),clear:a(()=>{s(i,n)},[s,i,n]),clientId:n}}function xl(t){return 2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function bl(t,e,n){var i;const o=null!==(i=t.xValue)&&void 0!==i?i:null==e?void 0:e[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function kl(t){let e=t.data||t.datum||t;return Array.isArray(e)&&(e=e[0]),null!=t.xValue&&e&&"object"==typeof e&&!Array.isArray(e)&&null==e.xValue?Object.assign(Object.assign({},e),{xValue:t.xValue}):e||{}}function wl({selection:t,linkedHover:e,fallbackFields:n=[],unwrapData:i=!1,onObservation:o,chartType:s,chartId:c,onClick:u,hoverHighlight:h,colorByField:f}){const y=g(),p=function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields||e||[],mode:t.mode,xField:t.xField}:null}(e,n),v=ml({name:(null==t?void 0:t.name)||"__unused__"}),m=function(t){const e=t.name||"hover",{fields:n}=t,{predicate:i,isActive:o,selectPoints:r,clear:l}=ml({name:e});return{onHover:a(t=>{if(!t)return void l();const e={};for(const i of n){const n=t[i];void 0!==n&&(e[i]=[n])}Object.keys(e).length>0&&r(e)},[n,r,l,e]),predicate:i,isActive:o}}({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||n||[]}),x=vl(t=>t.pushObservation),b=t?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=d(null),A=f||n[0],S=r(()=>{if(!h||null==k||!A)return null;const t=k,e=A;return{isActive:!0,predicate:n=>{var i;return("string"==typeof n[e]?n[e]:(null!==(i=n[e])&&void 0!==i?i:"")+"")===t}}},[h,k,A]),M=a(t=>{var n,i;if(e)if(t){let e=t.data||t.datum||t;if(Array.isArray(e)&&(e=e[0]),"x-position"===(null==p?void 0:p.mode)&&p.xField){const n=bl(t,e,p.xField);null!=n&&function(t,e,n){const i=Dn.positions.get(t);(null==i?void 0:i.locked)||i&&i.xValue===e&&i.sourceId===n||(Dn={positions:new Map(Dn.positions).set(t,{xValue:e,sourceId:n})},Nn())}(p.name||"hover",n,y)}"x-position"!==(null==p?void 0:p.mode)&&m.onHover(e)}else"x-position"===(null==p?void 0:p.mode)&&$n(p.name||"hover",y),"x-position"!==(null==p?void 0:p.mode)&&m.onHover(null);if(h&&A)if(t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=null==e?void 0:e[A];w(null!=n?n+"":null)}else w(null);if(o||x){const e={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(t){const r=kl(t),l=Object.assign(Object.assign({},e),{type:"hover",datum:r||{},x:null!==(n=t.x)&&void 0!==n?n:0,y:null!==(i=t.y)&&void 0!==i?i:0});o&&o(l),x&&x(l)}else{const t=Object.assign(Object.assign({},e),{type:"hover-end"});o&&o(t),x&&x(t)}}},[e,m,p,y,o,s,c,x,h,A]),_=a(t=>{var e,n,i,r;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=bl(t,e,p.xField);null!=n&&function(t,e,n){const i=Dn.positions.get(t);if(null==i?void 0:i.locked){const e=new Map(Dn.positions);return e.delete(t),Dn={positions:e},Nn(),!1}Dn={positions:new Map(Dn.positions).set(t,{xValue:e,sourceId:n,locked:!0})},Nn()}(p.name||"hover",n,y)}if(t&&u){let i=t.data||t.datum||t;Array.isArray(i)&&(i=i[0]),u(i,{x:null!==(e=t.x)&&void 0!==e?e:0,y:null!==(n=t.y)&&void 0!==n?n:0})}if(o||x){const e={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(t){const n=kl(t),l=Object.assign(Object.assign({},e),{type:"click",datum:n||{},x:null!==(i=t.x)&&void 0!==i?i:0,y:null!==(r=t.y)&&void 0!==r?r:0});o&&o(l),x&&x(l)}else{const t=Object.assign(Object.assign({},e),{type:"click-end"});o&&o(t),x&&x(t)}}},[u,o,x,s,c,p,y]);return l(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const t=p.name||"hover";return()=>{In(t,y),$n(t,y)}},[null==p?void 0:p.mode,null==p?void 0:p.name,y]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:M,customClickBehavior:_,crosshairSourceId:y}}const Al={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 Sl(t,e,n){var i,o,r,l,s,a,c;const u=Al[t||"primary"],d="context"===t||"sparkline"===t;return{width:null!==(i=e.width)&&void 0!==i?i:u.width,height:null!==(o=e.height)&&void 0!==o?o:u.height,showAxes:null!==(r=e.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=e.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=e.enableHover)&&void 0!==s?s:!!e.linkedHover||u.enableHover,showLegend:null!==(a=e.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=e.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:d?void 0:e.xLabel,yLabel:d?void 0:e.yLabel,categoryLabel:d?void 0:e.categoryLabel,valueLabel:d?void 0:e.valueLabel,marginDefaults:Ml(u.marginDefaults,e.showCategoryTicks,e.orientation),compactMode:d}}function Ml(t,e,n){if(!1!==e)return t;const i=Object.assign({},t);return"horizontal"===n?i.left=Math.min(i.left,15):i.bottom=Math.min(i.bottom,15),i}const _l={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Pl={opacity:.7,marginRight:4};function Cl(t,e,n){if(null!=t)return"function"==typeof e?e(t):t["string"==typeof e?e:n]}function Tl(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function El(t={}){const{timeAccessor:n,valueAccessor:i,xLabel:o="x",yLabel:r="y"}=t;return t=>{var l;const s=null!==(l=null==t?void 0:t.data)&&void 0!==l?l:null,a=Cl(s,n,"time"),c=Cl(s,i,"value");return e("div",{className:"semiotic-tooltip",style:_l,children:[e("div",{children:[e("span",{style:Pl,children:[o,":"]}),Tl(a)]}),e("div",{children:[e("span",{style:Pl,children:[r,":"]}),Tl(c)]})]})}}"undefined"!=typeof process&&process;const Ol={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"},Dl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ll(e,n,i,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},Ol),{width:n,height:i}),children:o||"No data available"}):null}function Nl(e,n,i,o){if(!e)return null;if(!1===o)return null;if(null!=o)return t("div",{style:{width:n,height:i,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(i/40)),l=Math.max(8,Math.floor(i/(3*r))),s=Math.max(6,Math.floor(i/(2.5*r))),a=Math.floor((i-(r*(l+s)-s))/2);return t("div",{style:{width:n,height:i,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,i)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Dl),{position:"absolute",top:a+i*(l+s),left:Math.floor(.1*n),width:30+(37*i+13)%50+"%",height:l,opacity:.5+i%2*.2})},i))})}function $l(t,e){var n;return null!=t?t:Math.max(null!==(n=null==e?void 0:e.length)&&void 0!==n?n:0,200)}const Il=f(function(e,n){var i,r,l,s,c;const u=Sl(e.mode,{width:null!==(r=null===(i=e.size)||void 0===i?void 0:i[0])&&void 0!==r?r:e.width,height:null!==(s=null===(l=e.size)||void 0===l?void 0:l[1])&&void 0!==s?s:e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0}),{size:d,margin:h,className:f,arrowOfTime:g="right",windowMode:p="sliding",windowSize:v,data:m,timeAccessor:x,valueAccessor:b,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:M=2,strokeDasharray:_,opacity:P,background:C,tooltipContent:T,tooltip:E,onHover:O,annotations:D,svgAnnotationRules:L,tickFormatTime:N,tickFormatValue:$,decay:I,pulse:W,staleness:z,transition:R,linkedHover:F,selection:Y,onObservation:j,chartId:B,loading:H,loadingContent:X,emptyContent:G,emphasis:V,legendPosition:q}=e,U=u.showAxes,K=u.enableHover,Z=null!=h?h:u.marginDefaults,Q=null!=d?d:[u.width,u.height],J=null!==(c=null!=T?T:E)&&void 0!==c?c:El({timeAccessor:x,valueAccessor:b}),tt=o(null),{customHoverBehavior:et}=wl({selection:Y,linkedHover:F,unwrapData:!0,onObservation:j,chartType:"RealtimeLineChart",chartId:B}),nt=a(t=>{O&&O(t),et(t)},[O,et]);y(n,()=>({push:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=tt.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=tt.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=tt.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const it=Nl(H,Q[0],Q[1],X),ot=it?null:Ll(m,Q[0],Q[1],G),rt={stroke:S,strokeWidth:M,strokeDasharray:_};null!=P&&(rt.opacity=P);const lt=$l(v,m);return it||ot||t(bo,{ref:tt,chartType:"line",runtimeMode:"streaming",size:Q,margin:Z,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:g,windowMode:p,windowSize:lt,data:m,timeAccessor:x,valueAccessor:b,xExtent:k,yExtent:w,extentPadding:A,lineStyle:rt,showAxes:U,background:C,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:nt,annotations:D,svgAnnotationRules:L,tickFormatTime:N,tickFormatValue:$,decay:I,pulse:W,staleness:z,transition:R,pointIdAccessor:e.pointIdAccessor,legendPosition:q})});function Wl(t,e,n){const i="function"==typeof e?e(t):t[null!=e?e:n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const o=Number(i);return Number.isFinite(o)?o:null}Il.displayName="RealtimeLineChart";const zl=f(function(n,i){var l,s,c,u,d;const h=Sl(n.mode,{width:null!==(s=null===(l=n.size)||void 0===l?void 0:l[0])&&void 0!==s?s:n.width,height:null!==(u=null===(c=n.size)||void 0===c?void 0:c[1])&&void 0!==u?u:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:f,size:g,margin:p,className:v,arrowOfTime:m="right",windowMode:x="sliding",windowSize:b,data:k,timeAccessor:w,valueAccessor:A,direction:S="up",timeExtent:M,valueExtent:_,extentPadding:P,categoryAccessor:C,colors:T,fill:E,stroke:O,strokeWidth:D,opacity:L,gap:N,background:$,tooltipContent:I,tooltip:W,onHover:z,annotations:R,svgAnnotationRules:F,tickFormatTime:Y,tickFormatValue:j,linkedHover:B,selection:H,decay:X,pulse:G,staleness:V,transition:q,onObservation:U,chartId:K,loading:Z,loadingContent:Q,emptyContent:J,emphasis:tt,legendPosition:et,brush:nt,onBrush:it,linkedBrush:ot}=n,rt=h.showAxes,lt=h.enableHover,st=null!=p?p:h.marginDefaults,at=null!=g?g:[h.width,h.height],ct=null!==(d=null!=I?I:W)&&void 0!==d?d:function(n={}){const{timeAccessor:i,valueAccessor:o}=n;return n=>{var r;const l=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==l?void 0:l.binStart)||null==(null==l?void 0:l.binEnd)){const n=Cl(l,i,"time"),r=Cl(l,o,"value");return e("div",{className:"semiotic-tooltip",style:_l,children:[e("div",{children:[t("span",{style:Pl,children:"x:"}),Tl(n)]}),e("div",{children:[t("span",{style:Pl,children:"y:"}),Tl(r)]})]})}return e("div",{className:"semiotic-tooltip",style:_l,children:[e("div",{children:[t("span",{style:Pl,children:"range:"}),Tl(l.binStart),"–",Tl(l.binEnd)]}),null!=l.total&&e("div",{children:[t("span",{style:Pl,children:"count:"}),Tl(l.total)]}),null!=l.category&&e("div",{children:[t("span",{style:Pl,children:"category:"}),Tl(l.category)]})]})}}({timeAccessor:w,valueAccessor:A}),ut=o(null),{customHoverBehavior:dt}=wl({selection:H,linkedHover:B,unwrapData:!0,onObservation:U,chartType:"RealtimeHistogram",chartId:K}),ht=a(t=>{z&&z(t),dt(t)},[z,dt]),ft=!0===nt?{dimension:"x",snap:"bin"}:"x"===nt?{dimension:"x"}:"object"==typeof nt?nt:void 0,gt=(yt=ot)?"string"==typeof yt?{name:yt}:yt:null;var yt;const pt=function(t){const{name:e,xField:n,yField:i}=t,{predicate:o,isActive:l,selectInterval:s,clear:c}=ml({name:e}),u=n&&i?"xyBrush":n?"xBrush":"yBrush",d=a(t=>{if(!t)return void c();const e={};"xyBrush"===u&&function(t){return 2===t.length&&Array.isArray(t[0])&&2===t[0].length&&Array.isArray(t[1])&&2===t[1].length}(t)?(n&&(e[n]=[Math.min(t[0][0],t[1][0]),Math.max(t[0][0],t[1][0])]),i&&(e[i]=[Math.min(t[0][1],t[1][1]),Math.max(t[0][1],t[1][1])])):"xBrush"===u&&xl(t)?n&&(e[n]=[Math.min(...t),Math.max(...t)]):"yBrush"===u&&xl(t)&&i&&(e[i]=[Math.min(...t),Math.max(...t)]),Object.keys(e).length>0&&s(e)},[u,n,i,s,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:o,isActive:l,clear:c}}(Object.assign({name:(null==gt?void 0:gt.name)||"__unused_hist_brush__",xField:(null==gt?void 0:gt.xField)||("string"==typeof w?w:"time")},(null==gt?void 0:gt.yField)?{yField:gt.yField}:{})),vt=o(pt.brushInteraction);vt.current=pt.brushInteraction;const mt=a(t=>{if(it&&it(t),U&&U(t?{type:"brush",extent:t,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}),gt){const e=vt.current;e.end(t?"xBrush"===e.brush?t.x:"yBrush"===e.brush?t.y:[[t.x[0],t.y[0]],[t.x[1],t.y[1]]]:null)}},[it,U,K,gt]);y(i,()=>({push:t=>{var e;return null===(e=ut.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=ut.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=ut.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=ut.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=ut.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=ut.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=ut.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const xt=Nl(Z,at[0],at[1],Q),bt=xt?null:Ll(k,at[0],at[1],J),kt={};null!=E&&(kt.fill=E),null!=O&&(kt.stroke=O),null!=D&&(kt.strokeWidth=D),null!=L&&(kt.opacity=L),null!=N&&(kt.gap=N);const wt=tt?`${v||""} semiotic-emphasis-${tt}`.trim():v,At=$l(b,k),St=r(()=>"down"!==S?_:function({data:t,valueAccessor:e,timeAccessor:n,binSize:i,valueExtent:o,extentPadding:r}){var l;if(o)return[o[1],o[0]];if(!t||0===t.length)return;const s=new Map;for(const o of t){const t=Wl(o,n,"time"),r=Wl(o,e,"value");if(null==t||null==r)continue;const a=Math.floor(t/i)*i;s.set(a,(null!==(l=s.get(a))&&void 0!==l?l:0)+r)}let a=0;for(const t of s.values())t>a&&(a=t);return[a>0?a+a*(null!=r?r:.1):1,0]}({data:k,valueAccessor:A,timeAccessor:w,binSize:f,valueExtent:_,extentPadding:P}),[S,k,A,w,f,_,P]);return xt||bt||t(bo,{ref:ut,chartType:"bar",runtimeMode:"streaming",size:at,margin:st,className:wt,arrowOfTime:m,windowMode:x,windowSize:At,data:k,timeAccessor:w,valueAccessor:A,xExtent:M,yExtent:St,extentPadding:P,binSize:f,categoryAccessor:C,barColors:T,barStyle:kt,showAxes:rt,background:$,hoverAnnotation:lt,tooltipContent:ct,customHoverBehavior:ht,annotations:R,svgAnnotationRules:F,tickFormatTime:Y,tickFormatValue:j,decay:X,pulse:G,staleness:V,transition:q,pointIdAccessor:n.pointIdAccessor,legendPosition:et,brush:ft||(ot?{dimension:"x"}:void 0),onBrush:ft||ot?mt:void 0})});function Rl(e){return t(zl,Object.assign({},e,{windowMode:"growing"}))}zl.displayName="RealtimeHistogram",Rl.displayName="TemporalHistogram";const Fl=f(function(e,n){var i,r,l,s,c;const u=Sl(e.mode,{width:null!==(r=null===(i=e.size)||void 0===i?void 0:i[0])&&void 0!==r?r:e.width,height:null!==(s=null===(l=e.size)||void 0===l?void 0:l[1])&&void 0!==s?s:e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0}),{size:d,margin:h,className:f,arrowOfTime:g="right",windowMode:p="sliding",windowSize:v,data:m,timeAccessor:x,valueAccessor:b,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:M,radius:_,fill:P,opacity:C,stroke:T,strokeWidth:E,background:O,tooltipContent:D,tooltip:L,onHover:N,annotations:$,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:z,linkedHover:R,selection:F,onObservation:Y,chartId:j,loading:B,loadingContent:H,emptyContent:X,emphasis:G,legendPosition:V}=e,q=u.showAxes,U=u.enableHover,K=null!=h?h:u.marginDefaults,Z=null!=d?d:[u.width,u.height],Q=null!==(c=null!=D?D:L)&&void 0!==c?c:El({timeAccessor:x,valueAccessor:b}),J=o(null),{customHoverBehavior:tt}=wl({selection:F,linkedHover:R,unwrapData:!0,onObservation:Y,chartType:"RealtimeSwarmChart",chartId:j}),et=a(t=>{N&&N(t),tt(t)},[N,tt]);y(n,()=>({push:t=>{var e;return null===(e=J.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=J.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=J.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=J.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=J.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=J.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=J.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const nt=Nl(B,Z[0],Z[1],H),it=nt?null:Ll(m,Z[0],Z[1],X),ot={};null!=_&&(ot.radius=_),null!=P&&(ot.fill=P),null!=C&&(ot.opacity=C),null!=T&&(ot.stroke=T),null!=E&&(ot.strokeWidth=E);const rt=G?`${f||""} semiotic-emphasis-${G}`.trim():f,lt=$l(v,m);return nt||it||t(bo,{ref:J,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:K,className:rt,arrowOfTime:g,windowMode:p,windowSize:lt,data:m,timeAccessor:x,valueAccessor:b,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:M,swarmStyle:ot,showAxes:q,background:O,hoverAnnotation:U,tooltipContent:Q,customHoverBehavior:et,annotations:$,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:z,legendPosition:V,pointIdAccessor:e.pointIdAccessor})});Fl.displayName="RealtimeSwarmChart";const Yl=f(function(n,i){var r,l,s,c,u;const d=Sl(n.mode,{width:null!==(l=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==l?l:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:f,className:g,arrowOfTime:p="right",windowMode:v="sliding",windowSize:m,data:x,timeAccessor:b,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:M,negativeColor:_,connectorStroke:P,connectorWidth:C,gap:T,stroke:E,strokeWidth:O,opacity:D,background:L,tooltipContent:N,tooltip:$,onHover:I,annotations:W,svgAnnotationRules:z,tickFormatTime:R,tickFormatValue:F,linkedHover:Y,selection:j,onObservation:B,chartId:H,loading:X,loadingContent:G,emptyContent:V,emphasis:q,legendPosition:U}=n,K=d.showAxes,Z=d.enableHover,Q=null!=f?f:d.marginDefaults,J=null!=h?h:[d.width,d.height],tt=null!==(u=null!=N?N:$)&&void 0!==u?u:function(n={}){const{timeAccessor:i,valueAccessor:o}=n;return n=>{var r,l;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,a=Cl(s,i,"time"),c=null!==(l=null==s?void 0:s.delta)&&void 0!==l?l:Cl(s,o,"value"),u=null==s?void 0:s.cumEnd,d="number"==typeof c?0>c?Tl(c):"+"+Tl(c):Tl(c);return e("div",{className:"semiotic-tooltip",style:_l,children:[e("div",{children:[t("span",{style:Pl,children:"x:"}),Tl(a)]}),e("div",{children:[t("span",{style:Pl,children:"Δ:"}),d]}),null!=u&&e("div",{children:[t("span",{style:Pl,children:"total:"}),Tl(u)]})]})}}({timeAccessor:b,valueAccessor:k}),et=o(null),{customHoverBehavior:nt}=wl({selection:j,linkedHover:Y,unwrapData:!0,onObservation:B,chartType:"RealtimeWaterfallChart",chartId:H}),it=a(t=>{I&&I(t),nt(t)},[I,nt]);y(i,()=>({push:t=>{var e;return null===(e=et.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=et.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=et.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=et.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=et.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=et.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=et.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const ot=Nl(X,J[0],J[1],G),rt=ot?null:Ll(x,J[0],J[1],V),lt={};null!=M&&(lt.positiveColor=M),null!=_&&(lt.negativeColor=_),null!=P&&(lt.connectorStroke=P),null!=C&&(lt.connectorWidth=C),null!=T&&(lt.gap=T),null!=E&&(lt.stroke=E),null!=O&&(lt.strokeWidth=O),null!=D&&(lt.opacity=D);const st=q?`${g||""} semiotic-emphasis-${q}`.trim():g,at=$l(m,x);return ot||rt||t(bo,{ref:et,chartType:"waterfall",runtimeMode:"streaming",size:J,margin:Q,className:st,arrowOfTime:p,windowMode:v,windowSize:at,data:x,timeAccessor:b,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:lt,showAxes:K,background:L,hoverAnnotation:Z,tooltipContent:tt,customHoverBehavior:it,annotations:W,svgAnnotationRules:z,tickFormatTime:R,tickFormatValue:F,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});Yl.displayName="RealtimeWaterfallChart";const jl=f(function(n,i){var r,l,s,c,u;const d=Sl(n.mode,{width:null!==(l=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==l?l:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:f,className:g,arrowOfTime:p="right",windowMode:v="sliding",windowSize:m,data:x,timeAccessor:b,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:M,heatmapXBins:_=20,heatmapYBins:P=20,aggregation:C="count",background:T,tooltipContent:E,tooltip:O,onHover:D,annotations:L,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:I,decay:W,pulse:z,staleness:R,linkedHover:F,selection:Y,onObservation:j,chartId:B,loading:H,loadingContent:X,emptyContent:G,emphasis:V,legendPosition:q}=n,U=d.showAxes,K=d.enableHover,Z=null!=f?f:d.marginDefaults,Q=null!=h?h:[d.width,d.height],J=null!==(u=null!=E?E:O)&&void 0!==u?u:function(n={}){const{timeAccessor:i,valueAccessor:o,xLabel:r="x",yLabel:l="y"}=n;return n=>{var s,a,c,u;const d=null!==(s=null==n?void 0:n.data)&&void 0!==s?s:null,h=null!==(a=null==d?void 0:d.xCenter)&&void 0!==a?a:Cl(d,i,"time"),f=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:Cl(d,o,"value"),g=null==d?void 0:d.count,y=null==d?void 0:d.sum,p=null==d?void 0:d.value,v=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return e("div",{className:"semiotic-tooltip",style:_l,children:[e("div",{children:[e("span",{style:Pl,children:[r,":"]}),Tl(h)]}),e("div",{children:[e("span",{style:Pl,children:[l,":"]}),Tl(f)]}),null!=g&&e("div",{children:[t("span",{style:Pl,children:"count:"}),Tl(g)]}),"sum"===v&&null!=y&&e("div",{children:[t("span",{style:Pl,children:"sum:"}),Tl(y)]}),"mean"===v&&null!=p&&e("div",{children:[t("span",{style:Pl,children:"mean:"}),Tl(p)]})]})}}({timeAccessor:b,valueAccessor:k}),tt=o(null),{customHoverBehavior:et}=wl({selection:Y,linkedHover:F,unwrapData:!0,onObservation:j,chartType:"RealtimeHeatmap",chartId:B}),nt=a(t=>{D&&D(t),et(t)},[D,et]);y(i,()=>({push:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.push(t)},pushMany:t=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.pushMany(t)},remove:t=>{var e,n;return null!==(n=null===(e=tt.current)||void 0===e?void 0:e.remove(t))&&void 0!==n?n:[]},update:(t,e)=>{var n,i;return null!==(i=null===(n=tt.current)||void 0===n?void 0:n.update(t,e))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=tt.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=tt.current)||void 0===t?void 0:t.getScales())&&void 0!==e?e:null}}),[]);const it=Nl(H,Q[0],Q[1],X),ot=it?null:Ll(x,Q[0],Q[1],G),rt=V?`${g||""} semiotic-emphasis-${V}`.trim():g,lt=$l(m,x);return it||ot||t(bo,{ref:tt,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:Z,className:rt,arrowOfTime:p,windowMode:v,windowSize:lt,data:x,timeAccessor:b,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:M,heatmapXBins:_,heatmapYBins:P,heatmapAggregation:C,showAxes:U,background:T,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:nt,annotations:L,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:I,decay:W,pulse:z,staleness:R,legendPosition:q,pointIdAccessor:n.pointIdAccessor})});jl.displayName="RealtimeHeatmap";const Bl=Symbol("semiotic.useStreamStatus.wrapped");function Hl(t={}){const{staleThresholdMs:e=5e3,pollIntervalMs:n=1e3}=t,i=o(null),[s,c]=d("idle"),[u,h]=d(null),f=r(()=>{const t={_frame:null,_origPush:null,_origPushMany:null};return{get current(){return t._frame},set current(e){const n=t._frame;if(n&&n!==e&&t._origPush&&t._origPushMany&&(n.push=t._origPush,n.pushMany=t._origPushMany,delete n[Bl]),t._frame=e,!e)return t._origPush=null,void(t._origPushMany=null);if(e[Bl])return;e[Bl]=!0;const i=e.push,o=e.pushMany,r=i.bind(e),l=o.bind(e);t._origPush=i,t._origPushMany=o,e.push=t=>(g(),r(t)),e.pushMany=t=>(t&&t.length>0&&g(),l(t))}}},[]),g=a(()=>{const t="undefined"!=typeof performance?performance.now():Date.now();i.current=t,h(t),c(t=>"active"===t?t:"active")},[]);return l(()=>{const t=setInterval(()=>{const t=i.current;if(null==t)return;const n=("undefined"!=typeof performance?performance.now():Date.now())-t>e;c(t=>{const e=n?"stale":"active";return t===e?t:e})},n);return()=>clearInterval(t)},[e,n]),{ref:f,status:s,lastPushTime:u}}export{Pt as IncrementalExtent,jl as RealtimeHeatmap,zl as RealtimeHistogram,Il as RealtimeLineChart,Fl as RealtimeSwarmChart,Yl as RealtimeWaterfallChart,_t as RingBuffer,dl as StreamNetworkFrame,bo as StreamXYFrame,Rl as TemporalHistogram,Hl as useStreamStatus};