semiotic 3.7.4 → 3.7.5

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 (135) hide show
  1. package/CLAUDE.md +10 -7
  2. package/README.md +36 -19
  3. package/ai/schema.json +221 -1
  4. package/ai/system-prompt.md +2 -1
  5. package/dist/components/Annotation.d.ts +4 -0
  6. package/dist/components/DataSummaryContext.d.ts +1 -0
  7. package/dist/components/ai/chartCapabilityTypes.d.ts +16 -0
  8. package/dist/components/ai/dataPitfallsBridge.d.ts +101 -0
  9. package/dist/components/ai/dataQualityBridge.d.ts +201 -0
  10. package/dist/components/ai/describeChart.d.ts +2 -0
  11. package/dist/components/ai/generativeChart.d.ts +145 -0
  12. package/dist/components/charts/custom/NetworkCustomChart.d.ts +14 -1
  13. package/dist/components/charts/ordinal/SwarmPlot.d.ts +7 -0
  14. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +21 -0
  15. package/dist/components/charts/realtime/aggregate.d.ts +51 -0
  16. package/dist/components/charts/realtime/eventTime.d.ts +26 -0
  17. package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
  18. package/dist/components/charts/shared/colorUtils.d.ts +1 -12
  19. package/dist/components/charts/shared/minMax.d.ts +3 -0
  20. package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
  21. package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
  22. package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
  23. package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
  24. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  25. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
  26. package/dist/components/charts/shared/validateChartData.d.ts +1 -1
  27. package/dist/components/charts/xy/Scatterplot.d.ts +9 -0
  28. package/dist/components/data/fromArrow.d.ts +54 -0
  29. package/dist/components/data/fromMermaid.d.ts +47 -0
  30. package/dist/components/data/fromObservablePlot.d.ts +69 -0
  31. package/dist/components/data/portability/index.d.ts +14 -0
  32. package/dist/components/data/portability/spec.d.ts +129 -0
  33. package/dist/components/data/portability/vegaLite.d.ts +62 -0
  34. package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
  35. package/dist/components/realtime/RunningStats.d.ts +66 -0
  36. package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
  37. package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
  38. package/dist/components/recipes/customTooltip.d.ts +31 -0
  39. package/dist/components/recipes/gofish.d.ts +207 -0
  40. package/dist/components/recipes/gofishBoba.d.ts +23 -0
  41. package/dist/components/recipes/gofishIR.d.ts +169 -0
  42. package/dist/components/recipes/gofishIRExamples.d.ts +89 -0
  43. package/dist/components/recipes/gofishInterpreter.d.ts +52 -0
  44. package/dist/components/recipes/gofishLambdas.d.ts +145 -0
  45. package/dist/components/recipes/mermaidDag.d.ts +44 -0
  46. package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
  47. package/dist/components/recipes/recipeChrome.d.ts +100 -0
  48. package/dist/components/recipes/recipeLegend.d.ts +57 -0
  49. package/dist/components/recipes/recipeUtils.d.ts +105 -0
  50. package/dist/components/semiotic-ai.d.ts +6 -0
  51. package/dist/components/semiotic-data.d.ts +2 -0
  52. package/dist/components/semiotic-experimental.d.ts +20 -0
  53. package/dist/components/semiotic-network.d.ts +3 -1
  54. package/dist/components/semiotic-ordinal.d.ts +2 -0
  55. package/dist/components/semiotic-realtime.d.ts +9 -1
  56. package/dist/components/semiotic-recipes.d.ts +18 -1
  57. package/dist/components/semiotic-themes.d.ts +2 -0
  58. package/dist/components/semiotic-xy.d.ts +2 -0
  59. package/dist/components/semiotic.d.ts +4 -0
  60. package/dist/components/store/ObservationStore.d.ts +21 -2
  61. package/dist/components/store/SelectionStore.d.ts +1 -1
  62. package/dist/components/store/ThemeStore.d.ts +1 -1
  63. package/dist/components/store/TooltipStore.d.ts +1 -1
  64. package/dist/components/store/createStore.d.ts +1 -1
  65. package/dist/components/store/designTokens.d.ts +15 -0
  66. package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
  67. package/dist/components/stream/NetworkPipelineStore.d.ts +32 -0
  68. package/dist/components/stream/NetworkSVGOverlay.d.ts +12 -0
  69. package/dist/components/stream/OrdinalPipelineStore.d.ts +18 -0
  70. package/dist/components/stream/PipelineStore.d.ts +27 -0
  71. package/dist/components/stream/SceneGraph.d.ts +5 -1
  72. package/dist/components/stream/customLayout.d.ts +20 -0
  73. package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
  74. package/dist/components/stream/customLayoutSelection.d.ts +52 -0
  75. package/dist/components/stream/networkCustomLayout.d.ts +66 -1
  76. package/dist/components/stream/networkTypes.d.ts +29 -1
  77. package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
  78. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
  79. package/dist/components/stream/ordinalTypes.d.ts +19 -3
  80. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
  81. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
  82. package/dist/components/stream/stalenessBands.d.ts +28 -0
  83. package/dist/components/stream/symbolPath.d.ts +24 -0
  84. package/dist/components/stream/types.d.ts +72 -3
  85. package/dist/components/stream/useStalenessCheck.d.ts +6 -1
  86. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
  87. package/dist/components/stream/xySceneBuilders/types.d.ts +5 -0
  88. package/dist/geo.min.js +1 -1
  89. package/dist/geo.module.min.js +1 -1
  90. package/dist/network.min.js +1 -1
  91. package/dist/network.module.min.js +1 -1
  92. package/dist/ordinal.min.js +1 -1
  93. package/dist/ordinal.module.min.js +1 -1
  94. package/dist/realtime.min.js +1 -1
  95. package/dist/realtime.module.min.js +1 -1
  96. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +2 -0
  97. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +1 -0
  98. package/dist/semiotic-ai.d.ts +6 -0
  99. package/dist/semiotic-ai.min.js +1 -1
  100. package/dist/semiotic-ai.module.min.js +1 -1
  101. package/dist/semiotic-data.d.ts +2 -0
  102. package/dist/semiotic-data.min.js +1 -1
  103. package/dist/semiotic-data.module.min.js +1 -1
  104. package/dist/semiotic-experimental.d.ts +20 -0
  105. package/dist/semiotic-experimental.min.js +1 -0
  106. package/dist/semiotic-experimental.module.min.js +1 -0
  107. package/dist/semiotic-network.d.ts +3 -1
  108. package/dist/semiotic-ordinal.d.ts +2 -0
  109. package/dist/semiotic-realtime.d.ts +9 -1
  110. package/dist/semiotic-recipes.d.ts +18 -1
  111. package/dist/semiotic-recipes.min.js +1 -1
  112. package/dist/semiotic-recipes.module.min.js +1 -1
  113. package/dist/semiotic-semiotic-BmrYbi99.js +2 -0
  114. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +1 -0
  115. package/dist/semiotic-themes.d.ts +2 -0
  116. package/dist/semiotic-themes.min.js +1 -1
  117. package/dist/semiotic-themes.module.min.js +1 -1
  118. package/dist/semiotic-utils.min.js +1 -1
  119. package/dist/semiotic-utils.module.min.js +1 -1
  120. package/dist/semiotic-value.min.js +1 -1
  121. package/dist/semiotic-value.module.min.js +1 -1
  122. package/dist/semiotic-xy.d.ts +2 -0
  123. package/dist/semiotic.d.ts +4 -0
  124. package/dist/semiotic.min.js +1 -1
  125. package/dist/semiotic.module.min.js +1 -1
  126. package/dist/server.min.js +1 -1
  127. package/dist/server.module.min.js +1 -1
  128. package/dist/xy-semiotic-xy-Dufu3D0-.js +2 -0
  129. package/dist/xy-statisticalOverlays-3Ni9bRph.js +1 -0
  130. package/dist/xy.min.js +1 -1
  131. package/dist/xy.module.min.js +1 -1
  132. package/package.json +11 -3
  133. package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
  134. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
  135. package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as a,useContext as s,useCallback as l,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as w,scaleLog as k,scaleTime as A,scaleSequential as S,scaleBand as C}from"d3-scale";import{quadtree as O}from"d3-quadtree";import{symbol as _,symbolCircle as j,symbolWye as P,symbolCross as M,symbolStar as L,symbolDiamond as T,symbolTriangle as $,symbolSquare as N,curveNatural as D,curveBasis as B,curveStepAfter as I,curveStepBefore as R,curveStep as F,curveCatmullRom as E,curveCardinal as H,curveMonotoneY as z,curveMonotoneX as W,line as G,area as Y,curveLinear as q,arc as V,pie as X}from"d3-shape";import{bin as U,quantile as K,min as Q,groups as Z,max as J,sum as ee,mean as te,group as ne}from"d3-array";import{packEnclose as oe,hierarchy as ie,partition as re,pack as ae,treemap as se,treemapBinary as le,cluster as ce,tree as ue}from"d3-hierarchy";import de from"regression";import{interpolateNumber as he}from"d3-interpolate";import{forceLink as ge,forceSimulation as fe,forceManyBody as pe,forceCenter as ye,forceX as me,forceY as ve}from"d3-force";import{ribbon as be,chord as xe}from"d3-chord";const we=Object.freeze([]);function ke(e){if(!e)return we;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}function Ae(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function Se(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function Ce({width:t,height:n,totalWidth:o,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const w=i(null),k=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const C=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),O=i(C);O.current=C;const _=i(!1),j=i(null);return a(()=>{if(!w.current)return;const e=y(w.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(_.current)return;const r=S.current;if(!r)return;if(!i.selection)return j.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=i.selection;a=[r.x.invert(e),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;a=[r.x.invert(0),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;a=[r.x.invert(e),r.x.invert(n)],s=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=O.current;t&&t.length>0?a=function(e,t){return 0===t.length?e:[Ae(e[0],t),Se(e[1],t)]}(a,t):h&&h>0&&(a=[Math.floor(a[0]/h)*h,Math.ceil(a[1]/h)*h]);const n=r.x(a[0]),s=r.x(a[1]);if(_.current=!0,"x"===c)e.call(o.move,[n,s]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[s,t[1][1]]])}_.current=!1}const l={x:a,y:s};j.current=l,A.current(l)}),e.call(o),k.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),k.current=null}},[t,n,c,g,h,p]),a(()=>{if(!(x&&u&&k.current&&j.current))return;if(!w.current)return;if("y"===c)return;const e=j.current,t=u.x.domain()[0],n=y(w.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(k.current.move,null),_.current=!1,j.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=O.current;e&&e.length>0?o=Se(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return _.current=!0,n.call(k.current.move,null),_.current=!1,j.current=null,void A.current(null);i=!0}const r=u.x(o),a=u.x(e.x[1]);if(_.current=!0,"x"===c)n.call(k.current.move,[r,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(k.current.move,[[r,t],[a,o]])}if(_.current=!1,i){const t={x:[o,e.x[1]],y:e.y};j.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:w,width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class Oe{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=ke(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=ke(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function _e(t){let n=null;const o=()=>(n||(n=u(null)),n),a=je(t);return[function({children:n,initialState:a}){const s=i(a),l=r(()=>je(t,s.current),[]),c=o();return e(c.Provider,{value:l,children:n})},(e,t)=>{var n;const r=o(),u=null!==(n=s(r))&&void 0!==n?n:a,d=i(e);d.current=e;const h=i({hasValue:!1,value:void 0}),g=l(()=>{const e=d.current(u.getState()),n=h.current;return n.hasValue&&t&&t(n.value,e)?n.value:(h.current={hasValue:!0,value:e},e)},[u,t]),f=l(()=>d.current(u.getState()),[u]);return c(u.subscribe,g,f)}]}function je(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function Pe(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function Me(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:Le})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const Le=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Te={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:12}},$e={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:12}},Ne={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Le,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 De(e,t){if("light"===t)return Te;if("dark"===t)return $e;if("high-contrast"===t)return Ne;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?$e:Te;return Me(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return Me(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[Be,Ie]=_e(e=>({theme:Te,setTheme(t){e(e=>({theme:De(e.theme,t)}))}}));class Re{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,a=this.buffer[r];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[r]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class Fe{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Ee(e,t,n,o,i){const r=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=s,i){const e=i(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return r}function He(e,t,n,o,i,r){const a=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&a.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:i,datum:c,group:r}}function ze(e,t,n,o,i,r,a,s){const l=[];for(const r of e){const e=n(r),a=o(r);if(!Number.isFinite(e)||!Number.isFinite(a))continue;const c=t.x(e),u=s?s(r):i;l.push({px:c,topY:t.y(a),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:a}}function We(e,t,n,o){var i,r,a;const s=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;s.set(o,-e/2)}else if("wiggle"===o){e.length>0&&s.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],a=e[o];let l=0,c=0,u=0;for(const e of t){const t=n(e,a)||0;l+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=s.get(r))&&void 0!==i?i:0;s.set(a,d-(c>0?l/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=s.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)s.set(t,(null!==(a=s.get(t))&&void 0!==a?a:0)-i)}}else for(const t of e)s.set(t,0);return s}function Ge(e,t,n,o,i,r,a){const s=n(e),l=o(e);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:i,style:r,datum:e};return void 0!==a&&(c.pointId=a),c}function Ye(e,t,n,o,i,r,a,s){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:i,symbolType:r,style:a,datum:e};return void 0!==s&&(u.pointId=s),u}function qe(e,t,n,o,i,r,a){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:a}}function Ve(e,t,n,o,i,r,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Xe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Ue(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ke(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Qe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function Ze(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Je(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function et(e){const t=e.map(Ze),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Je(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Je(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return Je(Math.round(a+(c-a)*r),Math.round(s+(u-s)*r),Math.round(l+(d-l)*r))}}const tt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],nt=et(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ot=et(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),it=et(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),rt=et(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),at=et(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),st=et(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),lt=et(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ct=et(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ut=et(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),dt=et(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ht=et(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),gt=et(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),ft={blues:nt,reds:ot,greens:it,viridis:lt,oranges:rt,purples:at,greys:st,plasma:ct,inferno:ut,magma:dt,cividis:ht,turbo:gt};function pt(e){return e&&ft[e]||nt}const yt=et(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),mt=et(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),vt=et(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),bt=et(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),xt=et(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),wt=et(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),kt=et(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),At=Object.assign({category10:tt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},ft),St=tt,Ct=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ot=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],_t=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function jt(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||_t.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):St[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%St.length]}function Pt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=At[n]||At.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:St;return x().domain(o).range(e).unknown("#999")}}function Mt(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,a]=o,[s,l]=n;if(a===r)return(s+l)/2;let c=(i-r)/(a-r);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function Lt(e,t,n){var o,i,r;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:a;default:return 1}}function Tt(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function $t(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Nt(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Dt(e,t,n){return e+(t-e)*n}function Bt(){return"undefined"!=typeof performance?performance.now():Date.now()}function It(e,t,n){var o,i,r,a;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(a=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==a?a:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Rt(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Ft(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const a=o.getTop(n),s=o.getBottom(n);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=e.scales.x(t),c=e.scales.y(a),u=e.scales.y(s);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Rt(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Et(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ht(e,t,n){const o=[];for(const i of n){const n=Ft(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function zt(e,t,n,o){const i=[];for(const r of o){const o=Ft(e,t,n,r);o&&i.push(o)}return i}function Wt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function Gt(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Ge(a,e.scales,e.getX,r,s,o,l);c&&n.push(c)}}}const Yt={topOpacity:.8,bottomOpacity:.05};function qt(e){var t,n;if(e)return!0===e?Yt:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Yt.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Yt.bottomOpacity}}const Vt={circle:j,square:N,triangle:$,diamond:T,star:L,cross:M,wye:P},Xt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Ut(e,t,n){var o,i;if(n)return n;const r=null!=e?e:"circle";if("chevron"===r)return function(e){const t=1.5*Kt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t);const a=null!==(o=Vt[r])&&void 0!==o?o:j;return null!==(i=_(a,Math.max(1,t))())&&void 0!==i?i:""}function Kt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const Qt=new Map;function Zt(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:i}=e;Jt(o)&&0===n.length&&en(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&en(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Jt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Jt))}function en(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function tn(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function nn(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=tn(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=Ue(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:tn(e.y1Accessor,"y1"),getBottom:tn(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class on{constructor(e){if(this.xExtent=new Fe,this.yExtent=new Fe,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._groupDataCache=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._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Re(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Ue(e.timeAccessor||e.xAccessor,"time"),this.getY=Ue(e.valueAccessor||e.yAccessor,"value")):(this.getX=Ue(e.xAccessor,"x"),this.getY=Ue(e.yAccessor,"y")),this.getGroup=Qe(e.groupAccessor),this.getCategory=Qe(e.categoryAccessor),this.getSize=e.sizeAccessor?Ue(e.sizeAccessor,"size"):void 0,this.getColor=Qe(e.colorAccessor),this.getSymbol=Qe(e.symbolAccessor),this.getY0=e.y0Accessor?Ue(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=nn(e),this.getPointId=Qe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?Ue(e.openAccessor,"open"):void 0,this.getHigh=Ue(e.highAccessor,"high"),this.getLow=Ue(e.lowAccessor,"low"),this.getClose=n?Ue(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Re(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Ue(this.config.timeAccessor||this.config.xAccessor,"time"):Ue(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,a,s,l,c,u,d,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&!p.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const C=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],O="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!C&&y.size>0)if(p.normalize)S=[0,O?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(a=p.baseline)&&void 0!==a?a:"zero"}:${null!==(s=p.stackOrder)&&void 0!==s?s:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,a=new Map;for(const e of t){const t=new Map;let s=0;for(const n of e.data){const e=this.getX(n),a=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(a))continue;t.set(e,(t.get(e)||0)+a),o.add(e),s+=a;const l=(r.get(e)||0)+a;r.set(e,l),l>i&&(i=l)}n.set(e.key,t),a.set(e.key,s)}const s=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===s){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=a.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=a.get(t))&&void 0!==u?u:0);f=[...o.reverse(),...n]}else f="asc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(e))&&void 0!==n?n:0)-(null!==(o=a.get(t))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):"desc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=We(e,f,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,a=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>a&&(a=e+o)}Number.isFinite(i)&&Number.isFinite(a)||(i=0,a=0);const s=a-i,l=O?0:s>0?s*p.extentPadding:1;S=[i-l,a+l]}else S=[0,i+(O?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!C&&y.size>0){const[,e]=function(e,t,n,o,i){const r=Ee(e,t,n,o,i);if(0===r.size)return[0,0];let a=0;for(const e of r.values())e.total>a&&(a=e.total);return[0,a]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,O?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!C&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=O?0:n>0?n*p.extentPadding:1;S=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!C&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n)),Number.isFinite(o)&&(S[0]>o&&(S[0]=o),o>S[1]&&(S[1]=o))}const e=S[1]-S[0],t=O?0:e>0?e*p.extentPadding:1,n=null===(g=p.yExtent)||void 0===g?void 0:g[0],o=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=n?S[0]:S[0]-t,null!=o?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||O||(S[0]=null!=n?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!C){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const _="streaming"===p.runtimeMode,j=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(_)if("x"==("up"===(P=p.arrowOfTime)||"down"===P?"y":"x")){const t="right"===p.arrowOfTime?[j,e.width-j]:[e.width-j,j];this.scales={x:w().domain(x).range(t),y:w().domain(S).range([e.height-j,j])}}else{const t="down"===p.arrowOfTime?[j,e.height-j]:[e.height-j,j];this.scales={x:w().domain(S).range([j,e.width-j]),y:w().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):w().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[j,e.width-j]),y:t(p.yScaleType,S,[e.height-j,j])}}var P;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,on.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=O().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):w().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,a,s,l,c,u;const{config:d,scales:h}=this;if(!h)return[];if(d.customLayout){const u=null!==(n=d.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},g={data:t,scales:h,dimensions:{width:e.width,height:e.height,margin:u,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=d.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=d.themeCategorical)&&void 0!==i?i:Ct},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=d.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=d.layoutConfig)&&void 0!==r?r:{},selection:null!==(a=d.layoutSelection)&&void 0!==a?a:null};let f;try{f=d.customLayout(g)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(s=f.overlays)&&void 0!==s?s:null;const p=null!==(l=f.nodes)&&void 0!==l?l:[];if(this._customRestyle=f.restyle,this.hasCustomRestyle=!!f.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of p)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(p,null!==(c=d.layoutSelection)&&void 0!==c?c:null)}return Zt({label:"customLayout",nodes:p,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),p}if(this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const g={scales:h,config:d,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,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:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(d.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=Et(e.ribbons);if(r.length>0&&i.push(...Ht(e,t,r)),n.length>0)for(const t of o)i.push(...zt(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=He(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Gt(e,o,i),i}(g,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Et(e.ribbons);if(r.length>0&&o.push(...Ht(e,t,r)),i.length>0)for(const t of n)o.push(...zt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=ze(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),s=qt(e.config.gradientFill);s&&(a.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Gt(e,n,o),o}(g,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Et(e.ribbons);if(r.length>0&&o.push(...Ht(e,t,r)),i.length>0)for(const t of n)o.push(...zt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],a=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=ze(t.data,e.scales,e.getX,e.getY,r,n,t.key,a),s=qt(e.config.gradientFill);s&&(i.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=He(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Gt(e,n,o),o}(g,t);case"stackedarea":return function(e,t){var n,o,i,r;const a=e.groupData(t),s=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",l=()=>a.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===s)l();else if("asc"===s||"desc"===s||"insideOut"===s){const t=new Map;for(const n of a){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else if("desc"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else{const e=[...a].sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)}),r=[],s=[];let l=0,c=0;for(const n of e)c>l?(r.push(n),l+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(s.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);a.length=0,a.push(...s.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,a,s="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(l=h.get(o.key))||void 0===l?void 0:l.get(t))||0;g.set(t,n||1)}}const f=We(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},s),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],s=[],l=new Map;for(const n of d){let i=e.get(n)||0;const a=m.get(n);r&&(i/=g.get(n));const c=a+i,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),m.set(n,c),l.set(n,c)}y.set(n.key,l);const c={type:"area",topPath:o,bottomPath:s,style:i(n.key,n.data[0]),datum:n.data,group:n.key};a&&(c.curve=a),p.push(c)}return{nodes:p,stackedTops:y}}(a,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of a){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Gt(e,a,g,n)}return g}(g,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let a=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);a=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,l=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",c=e.getSymbol,u=e.config.symbolMap,d=new Map;let h=0;const g=e=>{const t=null==u?void 0:u[e];if(t)return t;let n=d.get(e);return n||(n=Xt[h%Xt.length],h++,d.set(e,n)),n};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:l,opacity:.8},r=t.r||i;if(a&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=a(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(n);o&&s.has(o)&&(t=Object.assign(Object.assign({},t),{fill:s.get(o)}))}const u=e.getPointId?e.getPointId(n)+"":void 0;if(c){const i=g(c(n)+""),a=Ye(n,e.scales,e.getX,e.getY,Math.PI*r*r,i,t,u);a&&o.push(a)}else{const i=Ge(n,e.scales,e.getX,e.getY,r,t,u);i&&o.push(i)}}return o}(g,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=Ue(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/a,p=(g-h||1)/s,y=a*s;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),a-1),d=Math.min(Math.floor((r-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const w=x-b||1,k=n.width/a,A=n.height/s,S=e.config.showValues,C=e.config.heatmapValueFormat,O=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/w;O.push(Ve(n*k,(s-1-e)*A,k,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:C}:void 0))}}return O}(e,t,n);if(0===t.length)return[];const o=Ue(e.config.valueAccessor,"value"),i=Ke(e.config.xAccessor,"x"),r=Ke(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=a.get(l[e]),r=s.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=n}let w=1/0,k=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(w>t&&(w=t),t>k&&(k=t))}if(!isFinite(w)||!isFinite(k))return[];const A=function(e){const t=e in ft?e:"blues";let n=Qt.get(t);if(n)return n;n=Array(256);const o=pt(t);for(let e=0;256>e;e++)n[e]=o(e/255);return Qt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(k-w||1),C=n.width/u,O=n.height/d,_=e.config.showValues,j=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;P.push(Ve(o*C,(d-1-(n-o)/u)*O,C,O,A[Math.min((t-w)*S+.5|0,255)],v[e],_?{value:t,showValues:!0,valueFormat:j}:void 0))}return P}(g,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Ee(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),a=Array.from(t).filter(e=>!o.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const a=[],s=e.scales,[l,c]=s.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=s.x(n),p=s.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=s.y(n),c=s.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";a.push(qe(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=s.y(0),n=s.y(t.total);a.push(qe(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:a,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(g,t);return this._barCategoryCache=null!==(u=g.barCategoryCache)&&void 0!==u?u:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,a,s;const l=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(a=c.opacity)&&void 0!==a?a:.7,g=c.stroke,f=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let a=d;if(e.getCategory){const t=e.getCategory(n);a=(null===(s=e.config.barColors)||void 0===s?void 0:s[t])||a}const c={type:"point",x:i,y:r,r:u,style:{fill:a,opacity:h,stroke:g,strokeWidth:f},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(g,t);case"waterfall":return function(e,t,n){var o,i,r,a,s,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return u;const f=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(a=null==h?void 0:h.negativeColor)&&void 0!==a?a:null===(s=e.config.themeSemantic)||void 0===s?void 0:s.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),a=x+r;let s;s=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==s?d.x(i+s):l+n.width/10,w=Math.min(l,c)+y/2,k=Math.max(l,c)-y/2-w;if(0>=k){x=a;continue}const A=d.y(x),S=d.y(a),C=Math.min(A,S),O=Math.abs(A-S),_={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(_.opacity=b),u.push(qe(w,C,k,O,_,Object.assign(Object.assign({},o),{baseline:x,cumEnd:a,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=a}return u}(g,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=i?s:a.upColor||"#28a745",c=i?s:a.downColor||"#dc3545",u=i?s:a.wickColor||"#333",d=a.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=a.bodyWidth)&&void 0!==o?o:0;if(null==a.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=i?o:e.getOpen(n),h=i?a:e.getClose(n);if(!i&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(g,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Lt(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const a=new Map;for(let e=0;n.length>e;e++)a.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const s=a.get(t[n]);null!=s?(o[n]=Lt(e,s,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(i[n]=Lt(e,o,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=a.get(n);if(null!=t){const n=Lt(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=Lt(e,t,r);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const a="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const s=Tt(e,r,a);s>i&&(i=s)}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Tt(e,i,a);r>0&&(n._pulseIntensity=r,n._pulseColor=s,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,a,s;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=It(e,c,l);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=It(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,w,k,A,S,C,O,_,j,P,M,L,T,$,N,D,B,I,R,F,E,H,z,W,G,Y;if(0===o.size&&0===i.size)return n;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const X=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],M=It(e,r,t);if(!M)continue;if(r._transitionKey=M,"line"===r.type||"area"===r.type){const e=i.get(M);if(e){if(U.add(M),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}r._targetOpacity=null!==(a=r.style.opacity)&&void 0!==a?a:1,r._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const L=o.get(M);if("point"===r.type)if(L){X.add(M);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,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(L){X.add(M);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,V=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(L){X.add(M);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,V=!0)}else r._targetOpacity=null!==(k=null===(w=r.style)||void 0===w?void 0:w.opacity)&&void 0!==k?k:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){X.add(M);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(C=L.closeY)&&void 0!==C?C:r.closeY,r.highY=null!==(O=L.highY)&&void 0!==O?O:r.highY,r.lowY=null!==(_=L.lowY)&&void 0!==_?_:r.lowY,V=!0)}else r._targetOpacity=null!==(P=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==P?P:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(M=t.opacity)&&void 0!==M?M:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!X.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==($=t.opacity)&&void 0!==$?$:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(N=t.w)&&void 0!==N?N:0,h:null!==(D=t.h)&&void 0!==D?D:0,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(I=t.w)&&void 0!==I?I:0,h:null!==(R=t.h)&&void 0!==R?R:0,fill:"#999",datum:null,style:{opacity:null!==(F=t.opacity)&&void 0!==F?F:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(E=t.openY)&&void 0!==E?E:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(H=t.closeY)&&void 0!==H?H:o,highY:null!==(z=t.highY)&&void 0!==z?z:o,lowY:null!==(W=t.lowY)&&void 0!==W?W:o,bodyWidth:null!==(G=t.w)&&void 0!==G?G:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(Y=t.opacity)&&void 0!==Y?Y:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:Bt(),duration:q}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,a,s,l,c;if(!n.activeTransition)return!1;const u=Nt(e,n.activeTransition),d=$t(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Dt(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Dt(n.x,e._targetX,d),e.y=Dt(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Dt(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Dt(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Dt(n.x,e._targetX,d),e.y=Dt(n.y,e._targetY,d),void 0!==n.w&&(e.w=Dt(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Dt(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Dt(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Dt(n.x,e._targetX,d),e.y=Dt(n.y,e._targetY,d),void 0!==n.w&&(e.w=Dt(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Dt(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Dt(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Dt(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Dt(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Dt(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Dt(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Dt(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Dt(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Dt(t[o][0],n[o][0],d),e.path[o][1]=Dt(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Dt(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Dt(t[n][0],o[n][0],d),e.topPath[n][1]=Dt(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Dt(n[t][0],i[t][0],d),e.bottomPath[t][1]=Dt(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(this._groupDataCache&&this._groupDataCache.version===this._ingestVersion&&this._groupDataCache.group===this.getGroup&&this._groupDataCache.data===e)return this._groupDataCache.result;let t;if(this.getGroup){const n=new Map;for(const t of e){const e=this.getGroup(t);n.has(e)||n.set(e,[]),n.get(e).push(t)}t=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else t=[{key:"_default",data:e}];return this._groupDataCache={version:this._ingestVersion,group:this.getGroup,data:e,result:t},t}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Ct,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const a=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||Ct;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>on.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),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._groupDataCache=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}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},a=i(r,t);r.style=a?Object.assign(Object.assign({},e),a):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let a=!1,s=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!Xe(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=l||!Xe(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Ue(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Ue(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Ue(this.config.xAccessor,"x"),this.getY=Ue(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=nn(this.config)),a=!0,s=!0)}if("groupAccessor"in e&&!Xe(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Qe(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Xe(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Qe(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Xe(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Ue(this.config.sizeAccessor,"size"):void 0,a=!0),"symbolAccessor"in e&&!Xe(e.symbolAccessor,r.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Qe(this.config.symbolAccessor):void 0,a=!0),"colorAccessor"in e&&!Xe(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Qe(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Xe(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Ue(this.config.y0Accessor,"y0"):void 0,a=!0,s=!0),("boundsAccessor"in e&&!Xe(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=nn(this.config),a=!0,s=!0),"pointIdAccessor"in e&&!Xe(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Qe(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!Xe(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Xe(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Xe(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Xe(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Ue(this.config.openAccessor,"open"):void 0,this.getHigh=Ue(this.config.highAccessor,"high"),this.getLow=Ue(this.config.lowAccessor,"low"),this.getClose=t?Ue(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0,s=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){a=!0;break}}a&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function rn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}on.GROUP_COLOR_MAP_CAP=1e3,on.QUADTREE_THRESHOLD=500;const an=o.createContext(null);function sn({value:t,children:n}){return e(an.Provider,{value:t,children:n})}function ln(t,n){return null!=t?e(sn,{value:n,children:t}):t}function cn(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function un(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function dn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function hn(e,t){const n=dn(e);if(!n)return!1;const o=dn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function gn(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function fn(e,t,n,o,i,r=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(o,i+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let g=null,f=1/0;return e.visit((e,i,l,p,y)=>{if(i>u||c>p||l>h||d>y)return!0;if(!e.length){let i=e;do{const e=i.data,l=r(e)-t,c=a(e)-n,u=Math.sqrt(l*l+c*c);un(s(e),o)>=u&&f>u&&(g=e,f=u),i=i.next}while(i)}return!1}),g?{node:g,distance:f}:null}const pn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,yn=new WeakMap;let mn=0,vn=!1,bn=null,xn=null,wn=null;function kn(e,t){var n,o;if(!t)return t;const i=pn.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(vn)return;if("undefined"==typeof window||"undefined"==typeof document)return;vn=!0;const e=()=>{mn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(bn=new MutationObserver(e),bn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{xn=window.matchMedia("(prefers-color-scheme: dark)"),wn=e,"function"==typeof xn.addEventListener?xn.addEventListener("change",wn):"function"==typeof xn.addListener&&xn.addListener(wn)}catch(e){}}();let a=yn.get(r);a&&a.version===mn||(a={version:mn,map:new Map},yn.set(r,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function An(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Sn(e){switch(e){case"monotoneX":return W;case"monotoneY":return z;case"cardinal":return H;case"catmullRom":return E;case"step":return F;case"stepBefore":return R;case"stepAfter":return I;case"basis":return B;case"natural":return D;default:return null}}function Cn(e,t,n){return null==t?n:"string"!=typeof t?t:kn(e,t)||n}function On(e,t,n,o,i,r,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const s=e.createLinearGradient(o,i,r,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,i,r,a),[h,g,f]=An(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function _n(e,t,n,o,i,r){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of a)s.addColorStop(e.offset,e.color);return s}const jn=new WeakMap;function Pn(e,t){const n=Sn(t);if(!n)return e;const o=jn.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,a,s,l){if(!i)return i=[s,l],void o.push([s,l]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*s,h*h*h*u+3*h*h*d*t+3*h*d*d*a+d*d*d*l])}i=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return G().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return jn.set(e,i),i}function Mn(e,t,n,o=30,i,r=0){let a=null;if(i){const e=fn(i,t,n,o,r);e&&(a={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=Tn(r,t,n,o);break;case"symbol":e=$n(r,t,n,o);break;case"line":e=Nn(r,t,n,o);break;case"rect":if(null==r.datum)break;e=Bn(r,t,n);break;case"heatcell":e=In(r,t,n);break;case"area":if(!1===r.interactive)break;e=Fn(r,t,n);break;case"candlestick":e=Rn(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function Ln(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=En(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[a,s]=e[i],[l,c]=e[r];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function Tn(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>un(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function $n(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>un(Kt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function Nn(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const a=En(e.path,t);if(0>a)return null;const[s,l]=e.path[a];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,a-1),r=Math.min(e.path.length-2,a);for(let a=i;r>=a;a++){const[i,r]=e.path[a],[s,l]=e.path[a+1],c=Dn(t,n,i,r,s,l);o>c&&(o=c)}c=o}else{const e=t-s,o=n-l;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:s,y:l,distance:c}}function Dn(e,t,n,o,i,r){const a=i-n,s=r-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function Bn(e,t,n){const o=cn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function In(e,t,n){const o=cn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Rn(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+a*a)}}return null}function Fn(e,t,n){if(0===e.topPath.length)return null;const o=En(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],a=t-i,s=n-r,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function En(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Hn(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:a}}function zn(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}function Wn(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Gn(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Gn(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function Gn(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Yn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function qn(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Vn={fresh:1,aging:1.5,stale:3};function Xn(e,t,n={}){var o,i,r;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const a=null!==(o=n.fresh)&&void 0!==o?o:1,s=null!==(i=n.aging)&&void 0!==i?i:1.5,l=null!==(r=n.stale)&&void 0!==r?r:3;return t*a>e?"fresh":t*s>e?"aging":t*l>e?"stale":"expired"}const Un={fresh:1,aging:.7,stale:.45,expired:.25},Kn={alpha:1,band:"fresh",isStale:!1};function Qn(e,t){var n,o;if(!e||0>=t)return Kn;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=Xn(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},Un),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:Kn}function Zn(e,t,n,o,r,s){const l=i("fresh");a(()=>{if(!e)return;const i=setInterval(()=>{const i=t.current;if(!i||0===i.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=Qn(e,a-i.lastIngestTime);c.band===l.current&&c.isStale===r||(l.current=c.band,c.isStale!==r&&s(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}function Jn({isStale:t,position:n}){return e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const eo={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function to(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,eo[n])(o(e,t),i),r}function no({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function oo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const io=(n,o,i,r,a,s,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=a,{swatchSize:x,labelGap:w,rowHeight:k}=h;return p.forEach((n,d)=>{const h=to(n,d,g,f,x),A=oo(n,r,a),S=a&&a.size>0&&a.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?S||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+w+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&e(no,{swatchSize:x}),e("text",{y:x/2,x:x+w,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=k}),y};function ro({config:n,orientation:i="vertical",width:r=100}){const{colorFn:a,domain:s,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:a(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:a(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function ao(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const a=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(a,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:a,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:s,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),w="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:io(t,o,i,r,a,s,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,a,s,l,c,u,d,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:w,align:k}=h,A=!(!o&&!i),S="isolate"===d||void 0===d&&null!=a,C=y.map(e=>v+b+7*e.label.length),O=[];let _=0,j=0;C.forEach((e,t)=>{const n=0===j?e:j+x+e;g&&g>0&&j>0&&n>g?(O.push({start:_,end:t,width:j}),_=t,j=e):j=n}),y.length>0&&O.push({start:_,end:y.length,width:j}),O.forEach((n,d)=>{let h="center"===k?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===k?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],k=to(n,g,f,p,v),O=oo(n,r,a),_=a&&a.size>0&&a.has(n.label);m.push(t("g",{transform:`translate(${h},${d*w})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===s&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?_||!1:void 0,"aria-current":A&&!S&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,_&&e(no,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=C[g]+x}});const P=Math.max(0,...O.map(e=>e.width)),M=O.length;return{items:m,offset:P,totalRows:M,totalHeight:M*w}})(n,r,a,s,l,c,u,o,d,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),k=!(!r&&!a);return t("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),w]})}function so(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function lo(e){return"object"==typeof e&&null!==e&&"gradient"in e}function co(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:a,legendPosition:s="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===s||"bottom"===s,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-a.left-a.right):100);let v,b;return"left"===s?(v=Math.max(4,a.left-m-10),b=a.top):"top"===s?(v=a.left,b=y?32:8):"bottom"===s?(v=a.left,b=r-a.bottom+38):(v=i-a.right+10,b=a.top),e("g",{transform:`translate(${v}, ${b})`,children:lo(o)?e(ro,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):so(o)?e(ao,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o})}function uo(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function ho(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function go(e){return"string"==typeof e?{type:e}:e}function fo({orient:n,config:o,values:i,scale:a,size:s,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=a.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],a=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],r+1.5*a)}}(i);if(!o)return null;const{q1:s,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=o,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+f/2),x2:y,y2:v+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-f:v+p,width:Math.abs(i-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-f:v+p,x2:r,y2:"top"===n?v-p:v+p+f,stroke:c.fill,strokeWidth:2})]})}{const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+f/2),y1:u,x2:v+m*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-f:v+p,y:Math.min(o,i),width:f,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-f:v+p,y1:r,x2:"left"===n?v-p:v+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=U().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=ho(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=a((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),l=a((i.x0+i.x1)/2);o.push(u?`${l},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,a,c,s,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function po(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let a="";for(const e of i)a&&a.length+1+e.length>o?(r.push(a),a=e):a=a?`${a} ${e}`:e;return a&&r.push(a),r}function yo(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function mo(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:a,title:s,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!a&&!s)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=s?d?[s]:po(s,u):[],m=a?d?[a]:po(a,u):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";n.useHTML||n.html?(x.push(e("foreignObject",{className:"annotation-note-html",x:"end"===f?v-u:"middle"===f?v-u/2:v,y:-16,width:u,height:Math.max(p,(y.length+m.length)*p+(s&&a?2:0))+p,style:{overflow:"visible"},children:t("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:w,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===f?"right":"middle"===f?"center":"left",whiteSpace:d?"nowrap":"normal",wordBreak:"break-word"},children:[s&&e("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:s}),a&&e("div",{className:"annotation-note-label",children:a})]})},"annotation-note-html")),b=y.length*p):(y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label")));let k=null;if((s||a)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),k]})}function vo(t,n,o,i,r){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,a=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-a,x2:i,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-a;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:yo((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function bo(t,n,o,i,r,a){var s;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==a?void 0:a.radius)){if("callout-rect"===r&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const i=e/2,r=o/2,a=t-i,s=n-r;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+a*h,u=r+s*h}}}else if("bracket"===r&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",a="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(a){const i=(null!==(s=null==o?void 0:o.curve)&&void 0!==s?s:.25)*d,a=(c+t)/2+-(n-u)/d*i,g=(u+n)/2+(t-c)/d*i;l.push(e("path",{className:"connector-curve",d:`M${c},${u}Q${a},${g} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-u,a-c)}else l.push(e("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e("g",{className:"annotation-connector",children:l})}function xo(e){var n,o;const{x:i=0,y:r=0,dx:a,dy:s,nx:l,ny:c,note:u,connector:d,subject:h,type:g,color:f,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=e,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,A=new Set(Array.isArray(y)?y:[]);let S=a||0,C=s||0;null!=l&&(S=l-w),null!=c&&(C=c-k);const O="string"==typeof g?g:"label";if("bracket"===O&&h&&0===S&&0===C)if(void 0!==h.width){S=h.width/2;const e=h.depth||30;C=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;S=e+(0>e?-5:5),C=h.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&bo(S,C,d,f,O,h),!A.has("subject")&&vo(O,h,f,w,k),!A.has("note")&&mo(u,S,C,f)]}))}function wo(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,a="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e(xo,Object.assign({"data-testid":"semiotic-annotation"},r,{type:a}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(xo,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:a}),c)}function ko(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ao(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function So(e){return null==e?null:e+""}function Co(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Oo(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Co(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?Co(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return So(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const a=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>So(e.pointId)===r);if(a)return Co(t,n,{x:a.x,y:a.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return So(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!s)return null;const l=ko(s,n),c=Ao(s,n);return null==l||null==c?null:Co(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let a=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,s=t.y)}if(null!=a&&null!=s||(a=ko(e,n),s=Ao(e,n)),null!=a&&null!=s)return Co(t,n,{x:a,y:s});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function _o(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const jo={secondary:0,primary:3},Po=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Mo(e){return!0===(null==e?void 0:e._annotationDeferred)}function Lo(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function To(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function $o(e){return Math.max(.72,.95-.06*e)}function No(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:To(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Mo(e.annotation)),r=t.some(e=>null!=Lo(e.annotation)),a=t.some(e=>"layer"===Lo(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const s=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of n)e.emphasis&&(e.rank=jo[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,a=Mo(n.annotation);let s=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;s=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:$o(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=Lo(n.annotation);return l&&(s=e("g",{className:"annotation-cohesion--"+l,children:s},"annotation-cohesion-"+o)),a&&(s=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return i&&l.unshift(e("style",{children:Po},"annotation-disclosure-style")),a&&l.unshift(e("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}const Do={linear:q,monotoneX:W,monotoneY:z,step:F,stepAfter:I,stepBefore:R,basis:B,cardinal:H,catmullRom:E};function Bo(e,t,n,o){const i=[];return e.forEach((e,r)=>{let a;if(n){const i=n(e,r,o);a=null!=i?i:t(e,r,o)}else a=t(e,r,o);a&&i.push({node:a,annotation:e})}),No(i)}function Io(n){return function(n,i,r){var a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,w,k,A,S,C,O,_,j,P,M,L,T,$,N,D,B,I,R,F,E,H,z,W,G,V,X,U,K,Q,Z,J,ee,te,ne,ie,re;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Oo(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!_o(o,c,r))return null;const u="callout"===n.type?"callout-circle":n.type,d="callout-circle"===u?{radius:null!==(a=n.radius)&&void 0!==a?a:12,radiusPadding:n.radiusPadding}:"callout-rect"===u?{width:n.width,height:n.height}:void 0;return e(wo,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(s=n.dx)&&void 0!==s?s:30,dy:null!==(l=n.dy)&&void 0!==l?l:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:u},d?{subject:d}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=ko(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"top";let l;l="bottom"===s?(r.height||0)-4:"center"===s?(r.height||0)/2:12;const c=o>.6*(r.width||0),u=c?o-4:o+4,d=c?"end":"start";return t("g",{opacity:n.opacity,children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:u,y:l,textAnchor:d,fill:a,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=Ao(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"right";let l,c;return"left"===s?(l=4,c="start"):"center"===s?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{opacity:n.opacity,children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:o-4,textAnchor:c,fill:a,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:ko(Object.assign(Object.assign({},e),{type:"point"}),r),y:Ao(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=oe(o),s=n.padding||10;return t("g",{children:[e("circle",{cx:a.x,cy:a.y,r:a.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&&e("text",{x:a.x,y:a.y-a.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:ko(Object.assign(Object.assign({},e),{type:"point"}),r),y:Ao(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=n.padding||10,s=o.map(e=>e.x),l=o.map(e=>e.y),[c,u]=uo(s),[d,h]=uo(l),g=c-a,f=u+a,p=d-a;return t("g",{children:[e("rect",{x:g,y:p,width:f-g,height:h+a-p,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(g+f)/2,y:p-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],a={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=ko(t,r),s=Ao(t,r);if(null==i||null==s)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||a;return e("circle",Object.assign({cx:i,cy:s,r:l},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=ko(n,r),o=Ao(n,r);return e(wo,{noteData:{x:null!=t?t:0,y:null!=o?o: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 o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l="ordinal"===r.frameType,y="horizontal"===r.projection,m=l?a:null,v=l?s:null;let b;const x=[],w=new Map;if(l&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[a],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=r.scales)||void 0===d?void 0:d.time,A=null!==(g=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=r.scales)||void 0===f?void 0:f.value;if(!k||!A)return null;const S=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},C=k,O=A;let _;if(l)if(y){const e=S(O);_=(t,n)=>[C(n),e(t)]}else{const e=S(C);_=(t,n)=>[e(t),O(n)]}else _=(e,t)=>[C(e),O(t)];const j=n.method||"linear";let P;P="loess"===j?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(p=n.bandwidth)&&void 0!==p?p:.3):("polynomial"===j?de.polynomial(b,{order:n.order||2}):de.linear(b)).points;const M=P.map(([e,t])=>{const[n,o]=_(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=P[P.length-1],[$,N]=_(T[0],T[1]);return t("g",{children:[e("polyline",{points:M,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:$+4,y:N-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,a=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,s=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{opacity:n.opacity,children:[e("rect",{x:0,y:Math.min(a,s),width:r.width||0,height:Math.abs(s-a),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.max(Math.min(a,s),0)+13,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=null!==(k=null===(w=r.scales)||void 0===w?void 0:w.x)&&void 0!==k?k:null===(A=r.scales)||void 0===A?void 0:A.time,l=null!==(C=null===(S=r.scales)||void 0===S?void 0:S.y)&&void 0!==C?C:null===(O=r.scales)||void 0===O?void 0:O.value;if(!s||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[a]-t[a]);if(2>h.length)return null;const g=Do[r.curve||"linear"]||q,f=Y().x(e=>s(e[a])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(_=n.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][a])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const a=r.yAccessor||"y",s=null!==(P=null===(j=r.scales)||void 0===j?void 0:j.x)&&void 0!==P?P:null===(M=r.scales)||void 0===M?void 0:M.time,l=null!==(T=null===(L=r.scales)||void 0===L?void 0:L.y)&&void 0!==T?T:null===($=r.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const c=o.map(e=>e[a]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(N=n.threshold)&&void 0!==N?N:2,f=u-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(D=n.fillOpacity)&&void 0!==D?D:.1,v=n.anomalyColor||"#ef4444",b=null!==(B=n.anomalyRadius)&&void 0!==B?B:6,x=l(u+g*h),w=l(f),k=o.filter(e=>{const t=e[a];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,w),width:r.width||0,height:Math.abs(w-x),fill:y,fillOpacity:m}),k.map((t,n)=>{const o=ko(t,r),i=Ao(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l=null!==(R=null===(I=r.scales)||void 0===I?void 0:I.x)&&void 0!==R?R:null===(F=r.scales)||void 0===F?void 0:F.time,c=null!==(H=null===(E=r.scales)||void 0===E?void 0:E.y)&&void 0!==H?H:null===(z=r.scales)||void 0===z?void 0:z.value;if(!l||!c)return null;const u=o.map(e=>[e[a],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=de.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const a=(e*i-t*n)/r,s=(n-a*t)/e;d=e=>s+a*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(W=n.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(G=n.steps)&&void 0!==G?G:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=d(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,C=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),O=`${l(x)},${c(d(x))}`,_=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:n.fill||"#6366f1",fillOpacity:null!==(V=n.fillOpacity)&&void 0!==V?V:.15,stroke:"none"}),e("polyline",{points:`${O} ${C}`,fill:"none",stroke:_,strokeWidth:null!==(X=n.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=Oo(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!_o(t,o,r))return null;const a=null!==(K=n.dx)&&void 0!==K?K:0,s=null!==(Q=n.dy)&&void 0!==Q?Q:0,l=null!==(Z=n.width)&&void 0!==Z?Z:32,c=null!==(J=n.height)&&void 0!==J?J:32,u=null!==(ee=n.content)&&void 0!==ee?ee:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const a=Oo(n,i,r);if(!a)return null;const{x:s,y:l}=a,c=s+(n.dx||0),u=l+(n.dy||0),d=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:u,fill:d,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:s,y1:l,x2:c,y2:u,stroke:d,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const a=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=r.scales)||void 0===te?void 0:te.o,l=null===(ne=r.scales)||void 0===ne?void 0:ne.x,c=null===(ie=r.scales)||void 0===ie?void 0:ie.y,u=a(s)?s:a(l)?l:a(c)?c:null;if(!u)return null;const d=u(o+"");if(null==d)return null;const h=u.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(re=n.opacity)&&void 0!==re?re:.15,p=n.label;return t("g",(r.projection?"vertical"===r.projection:u===l)?{children:[e("rect",{x:d,y:0,width:h,height:r.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:r.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+i)}default:return null}}}const Ro=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),Fo=new Set(["label","callout","callout-circle","callout-rect"]);function Eo(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}function Ho(e){return!!e&&"object"==typeof e&&Ro.has(Eo(e))}function zo(e){return Fo.has(Eo(e))&&!function(e){return Array.isArray(null==e?void 0:e.disable)&&e.disable.includes("connector")}(e)}function Wo(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function Go(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Yo(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*function(e){return Math.max(0,Math.min(1,e))}(r)),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}const qo=32,Vo=6,Xo=4,Uo=8,Ko=72;const Qo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Zo(e){return Ho(e)}function Jo(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function ei(e,t,n,o,i){const r=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?a-i.height:a,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?a-i.height-4:a+4,width:i.width,height:i.height}}function ti(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ni(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function oi(e,t,n,o,i,r,a,s){const l=ti(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,s);for(const e of n)c+=12*ni(l,e);for(const e of o)c+=4*ni(l,e);return c}function ii(e){var t;const{annotations:n,context:o,defaultOffset:i=qo,notePadding:r=Vo,markPadding:a=Xo,edgePadding:s=Uo,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=Ko,density:d,progressiveDisclosure:h=!1,redundantCues:g=!1,responsive:f,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,a);let w=!1;const k=n.map((e,t)=>{if(!Zo(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const a=e.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(a)&&a.length>=2&&s){const e=a[0],t=a[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Oo(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const a=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Jo("string"==typeof e.title?e.title:void 0,t),...Jo("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(l&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(ti(ei(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,a),r)),e}var d;let h=null,g=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=oi(ei(n.x,n.y,e.dx,e.dy,a),e,b,x,m,v,r,s);g>t&&(h=e,g=t)}if(!h)return e;const f=ti(ei(n.x,n.y,h.dx,h.dy,a),r);b.push(f);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=w?k:n.slice();let S=A;if(g){let e=!1;const t=A.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});S=e?t:A}{let e=!1;const t=S.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=Qo[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),a="string"==typeof e.label?e.label:"";return a.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:a?`${a} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});S=e?t:S}const C=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:Go(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),a=Go(o,i,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Ho(n))};var n}),l=s.filter(e=>e.note);if(0===l.length||a>=l.length)return{visible:n.slice(),deferred:[],budget:a};const c=l.filter(e=>Wo(e.annotation)),u=l.filter(e=>!Wo(e.annotation)).sort((e,t)=>Yo(t.annotation)-Yo(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,a-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),g=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:a}}(Object.assign({annotations:S,width:m,height:v},o));for(const e of i)C.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of S)Zo(e)&&"secondary"===e.emphasis&&C.add(e);if(C.size>0)for(const e of S)!0===(null==e?void 0:e.defensive)&&C.delete(e);let O;return O=0===C.size?S:h?S.map(e=>C.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):S.filter(e=>!C.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>Zo(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(O,p):O}let ri={positions:new Map};const ai=new Set;function si(){for(const e of ai)e()}function li(e,t){const n=ri.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ri.positions);o.delete(e),ri={positions:o},si()}function ci(e,t){const n=ri.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ri.positions);o.delete(e),ri={positions:o},si()}function ui(){return ri}function di(e){return ai.add(e),()=>ai.delete(e)}const hi={positions:new Map};function gi(){return()=>{}}function fi(){return hi}function pi(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,a=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||a===s)return r?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function yi(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function mi(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function vi(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function bi(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function xi(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let a="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*i}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);a+=`L${o+4*i},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function wi(n){const{width:o,height:i,totalWidth:a,totalHeight:s,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||g||ki,r=Math.max(2,Math.floor(o/70)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pi(c.x,"exact"===p?Math.max(2,a):Math.min(a,r),p),l=s.map(e=>e.valueOf()),u=s.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=u.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Ai(u,Math.max(55,h+8))},[c,d,g,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||f||ki,r=Math.max(2,Math.floor(i/30)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return Ai((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pi(c.y,"exact"===p?Math.max(2,a):Math.min(a,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),w=null==d?void 0:d.find(e=>"left"===e.orient),k=b&&(!x||!1!==x.baseline),A=b&&(!w||!1!==w.baseline),S=(null==x?void 0:x.jaggedBase)||!1,C=(null==w?void 0:w.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e("svg",{width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var n,r;const a=bi(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),s=bi(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),k&&!S&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:O,strokeWidth:1}),S&&e("path",{d:xi("bottom",o,i),fill:"none",stroke:O,strokeWidth:1}),A&&!C&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:O,strokeWidth:1}),C&&e("path",{d:xi("left",o,i),fill:"none",stroke:O,strokeWidth:1})]})})}function ki(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ai(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Si(o){var s,l;const{width:u,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:w,yFormat:k,axisExtent:A,showGrid:S,title:C,legend:O,legendHoverBehavior:_,legendClickBehavior:j,legendHighlightedCategory:P,legendIsolatedCategories:M,legendPosition:L="right",legendLayout:T,foregroundGraphics:$,marginalGraphics:N,xValues:D,yValues:B,annotations:I,autoPlaceAnnotations:R,svgAnnotationRules:F,xAccessor:E,yAccessor:H,annotationData:z,pointNodes:W,curve:G,underlayRendered:Y,canvasObscuresUnderlay:q=!0,linkedCrosshairName:V,linkedCrosshairSourceId:X,children:U}=o,K=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||w||ki,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,a=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pi(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),s=a.map(e=>e.valueOf()),l=a.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,s)})),c=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=Ai(l,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,s);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,w,u,A]),Q=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||k||ki,i=Math.max(2,Math.floor(d/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let a=Ai((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pi(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==n?void 0:n.includeMax)&&a.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=a[a.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[y,p,m,k,d,A]),Z=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||k||ki,i=Math.max(2,Math.floor(d/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Ai((null!==(t=n.tickValues)&&void 0!==t?t:pi(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,k,d,A]),J=i(new Map),ee=i(null!==(s=null==I?void 0:I.length)&&void 0!==s?s:0),te=null!==(l=null==I?void 0:I.length)&&void 0!==l?l:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=r(()=>{if(!I||0===I.length)return null;const e=Io(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:E,yAccessor:H,width:u,height:d,data:z,frameType:"xy",pointNodes:W,curve:G,stickyPositionCache:J.current};return Bo(R?ii(Object.assign({annotations:I,context:t},"object"==typeof R?R:{})):I,e,F,t)},[I,R,F,u,d,E,H,z,p,W,G]),oe=function(e){var t;const n=c(e?di:gi,e?ui:fi,e?ui:fi);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(V);return a(()=>{if(!(null==oe?void 0:oe.locked)||!V)return;const e=e=>{"Escape"===e.key&&ci(V)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,V]),y||C||O||$||N||ne&&ne.length>0||S||U||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof C?C:"XY Chart"}),e("desc",{children:"string"==typeof C?C+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!Y||q)&&(()=>{var n,o;const i=bi(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=bi(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[K.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),Q.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,a=(null==n?void 0:n.jaggedBase)||!1,s=(null==o?void 0:o.jaggedBase)||!1,l=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&K.length>1&&(()=>{const e=u/Math.max(K.length-1,1),t=K.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})(),w={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==o?void 0:o.tickAnchor,C=null==n?void 0:n.tickAnchor,O=vi(K),_=vi(Q);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!Y||q)&&r&&!s&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!Y||q)&&s&&e("path",{d:xi("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),K.map((n,o)=>{const i=!!l&&("function"==typeof l?l(n.value,o):hn(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":yi(S,n.pixel===O.min,n.pixel===O.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:w),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},w),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!Y||q)&&i&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!Y||q)&&a&&e("path",{d:xi("left",u,d),fill:"none",stroke:h,strokeWidth:1}),Q.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):hn(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:mi(C,n.pixel===_.min,n.pixel===_.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:w),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},w),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-f.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===Z.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,a=n.tickAnchor,s=vi(Z);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),Z.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):hn(n.value,o>0?Z[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:mi(a,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?k:w),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},w),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+f.right-15,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+f.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),ne,N&&p&&D&&B&&t(n,{children:[N.top&&e("g",{transform:"translate(0, 0)",children:e(fo,{orient:"top",config:go(N.top),values:D,scale:p.x,size:f.top,length:u})}),N.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(fo,{orient:"bottom",config:go(N.bottom),values:D,scale:p.x,size:f.bottom,length:u})}),N.left&&e("g",{transform:"translate(0, 0)",children:e(fo,{orient:"left",config:go(N.left),values:B,scale:p.y,size:f.left,length:d})}),N.right&&e("g",{transform:`translate(${u}, 0)`,children:e(fo,{orient:"right",config:go(N.right),values:B,scale:p.y,size:f.right,length:d})})]}),$,oe&&oe.sourceId!==X&&(null==p?void 0:p.x)&&(()=>{const t=p.x(oe.xValue);if(null==t||0>t||t>u)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U]}),C&&e("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 C?C:null}),co({legend:O,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:C,legendLayout:T,legendHoverBehavior:_,legendClickBehavior:j,legendHighlightedCategory:P,legendIsolatedCategories:M})]}):null}function Ci(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Oi(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const _i=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ji(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:a}=e,s=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(s){const e=_i(i,r),t=_i(i,a);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${a-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=_i(i,r),t=_i(i,a),n=_i(o,a),l=_i(o,r),c=a-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return ji(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=s?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=a-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return ji(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=a-(f?c:0),m=r+(g?u:0),v=a-(f?u:0),b=_i(i,p),x=_i(i,y),w=(i-l)*Math.cos(c),k=_i(w,r),A=_i(w,a),S=s?null:_i(o,v),C=s?null:_i(o,m),O=s?0:(o+l)*Math.cos(u),_=s?null:_i(O,r),j=s?null:_i(O,a),P=y-p>Math.PI?1:0,M=s?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=_i(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${P} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=_i(i,a);L+=` A${i},${i} 0 ${P} 1 ${e.x},${e.y}`}if(s)L+=" L0,0";else{if(f)L+=` L${j.x},${j.y}`,L+=` A${l},${l} 0 0 1 ${S.x},${S.y}`;else{const e=_i(o,a);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${M} 0 ${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${_.x},${_.y}`;else{const e=_i(o,r);L+=` A${o},${o} 0 ${M} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Pi(e){const t=ji({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:ji({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const Mi={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Li(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Ti(t,n,o){const i=Ut(t.symbolType,t.size,t.path);return e("path",{d:i,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?Li(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${null!=o?o:""}symbol-${n}`)}function $i(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Ni="undefined"==typeof window||"undefined"==typeof document,Di="undefined"!=typeof window?h:a;function Bi(){const[e,t]=d(!1);return Di(()=>{t(!0)},[]),e}const Ii=()=>()=>{},Ri=()=>!1,Fi=()=>!0;function Ei(){const e=c(Ii,Ri,Fi);return i(e).current}function Hi(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:s,cleanup:l}=e;Di(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,s.current()},[t,n]);const c=i(l);c.current=l,a(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function zi(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Gi(e,t);if(!Yi(e)||!Yi(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Gi(n,i))return!1}else{if(!Yi(n)||!Yi(i))return!1;if(!Wi(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function Wi(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Gi(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Yi(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const qi=o.createContext(null);function Vi({children:t}){const[n,i]=o.useState(!1),r=o.useCallback(()=>i(e=>!e),[]),a=o.useMemo(()=>({visible:n,setVisible:i,toggle:r}),[n,r]);return e(qi.Provider,{value:a,children:t})}function Xi(){return o.useContext(qi)}const Ui={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ki(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}function Qi(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const Zi=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Ji(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const er="semiotic-accessible-data-table",tr=er+" semiotic-accessible-data-table-hidden",nr=er+" semiotic-accessible-data-table-visible",or=nr+" semiotic-accessible-data-table-network",ir={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"},rr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ar={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)"},sr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},lr={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))"},cr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ur={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},dr={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function hr({scene:n,chartType:i,tableId:r,chartTitle:a}){var s;const[l,c]=o.useState(!1),[u,d]=o.useState(5),h=Xi(),g=null!==(s=null==h?void 0:h.visible)&&void 0!==s&&s,f=l||g,p=o.useRef(null),y=a?"Data summary for "+a:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{f||d(5)},[f]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(l||g||c(!0))},[l,g]),v=o.useCallback(e=>{var t;g||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[g]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Ui}):null;if(!f)return e("div",{id:r,className:tr,tabIndex:-1,onFocus:m,style:Ui,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,a,s,l,c,u,d,h,g,f,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Ji(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:Ji(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",a=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=a?a:""}});break}case"heatcell":{const e=Ji(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==a?a:null===(s=x.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Ji(x.datum)});break;case"arc":v.push({label:"Arc",values:Ji(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Ji(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(g=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==g?g:null===(f=x.datum)||void 0===f?void 0:f.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(n),x=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(b),w=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Zi(e.min)} to ${Zi(e.max)}, mean ${Zi(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(b.length,x),k=Math.min(u,b.length),A=b.slice(0,k),S=b.length-k,C=new Set;for(const e of A)for(const t of Object.keys(e.values))C.add(t);const O=Array.from(C);return t("div",{ref:p,id:r,className:nr,tabIndex:-1,onBlur:v,style:ir,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{g&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:ar,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:rr,children:w}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:sr,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:ur,children:S>0?`First ${k} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:lr,children:"type"}),O.map(t=>e("th",{style:lr,children:t},t))]})}),e("tbody",{children:A.map((n,o)=>t("tr",{children:[e("td",{style:cr,children:n.label}),O.map(t=>{return e("td",{style:cr,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Zi(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),S>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>d(e=>e+25),style:dr,children:["Show ",Math.min(25,S)," more"," ",1===S?"row":"rows"," (",S," remaining)"]})]})}function gr({nodes:n,edges:i,chartType:r,tableId:a,chartTitle:s}){var l,c,u,d,h,g,f,p,y,m,v,b,x,w;const[k,A]=o.useState(!1),[S,C]=o.useState(5),O=Xi(),_=null!==(l=null==O?void 0:O.visible)&&void 0!==l&&l,j=k||_,P=s?"Data summary for "+s:a?`Data summary for ${r} ${a}`:"Data summary for "+r,M=o.useRef(null);o.useEffect(()=>{j||C(5)},[j]);const L=o.useCallback(e=>{e.target===e.currentTarget&&(k||_||A(!0))},[k,_]),T=o.useCallback(e=>{var t;_||(null===(t=M.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[_]);if(!n||0===n.length)return a?e("span",{id:a,tabIndex:-1,style:Ui}):null;if(!j)return e("div",{id:a,className:tr,tabIndex:-1,onFocus:L,style:Ui,role:"region","aria-label":P,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",i.length," edges)"]})});const $=Array.isArray(n)?n:[],N=Array.isArray(i)?i:[],D=new Map,B=new Map,I=new Map,R=new Map;for(const e of N){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,n="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,o="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(h=B.get(e))&&void 0!==h?h:0)+1),R.set(e,(null!==(g=R.get(e))&&void 0!==g?g:0)+i)}if(null!=o&&""!==o){const e=o+"";D.set(e,(null!==(f=D.get(e))&&void 0!==f?f:0)+1),I.set(e,(null!==(p=I.get(e))&&void 0!==p?p:0)+i)}}const F=[];for(let e=0;$.length>e;e++){const t=$[e];if(!t||"object"!=typeof t)continue;const n=null!==(m=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==m?m:t.id,o=null!=n?n+"":"node-"+e,i=null!==(v=D.get(o))&&void 0!==v?v:0,r=null!==(b=B.get(o))&&void 0!==b?b:0,a=null!==(x=I.get(o))&&void 0!==x?x:0,s=null!==(w=R.get(o))&&void 0!==w?w:0;F.push({id:o,degree:i+r,inDeg:i,outDeg:r,wDegree:a+s,wInDeg:a,wOutDeg:s})}F.sort((e,t)=>t.degree-e.degree);let E=0,H=0;if(F.length>0){let e=0;for(const t of F)e+=t.degree,t.degree>H&&(H=t.degree);E=e/F.length}const z=N.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),W=[`${F.length} nodes, ${N.length} edges.`];F.length>0&&W.push(`Mean degree: ${Zi(E)}, max degree: ${H}.`);const G=Math.min(S,F.length),Y=F.slice(0,G),q=F.length-G;return t("div",{ref:M,id:a,className:or,tabIndex:-1,onBlur:T,style:ir,role:"region","aria-label":P,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{_&&O&&O.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:ar,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:rr,children:W.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:sr,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:ur,children:q>0?`Top ${G} of ${F.length} nodes by degree`:`All ${F.length} nodes by degree`}),e("thead",{children:t("tr",{children:[e("th",{style:lr,children:"id"}),e("th",{style:lr,children:"degree"}),e("th",{style:lr,children:"in"}),e("th",{style:lr,children:"out"}),z&&e("th",{style:lr,children:"w. degree"}),z&&e("th",{style:lr,children:"w. in"}),z&&e("th",{style:lr,children:"w. out"})]})}),e("tbody",{children:Y.map((n,o)=>t("tr",{children:[e("td",{style:cr,children:n.id}),e("td",{style:cr,children:n.degree}),e("td",{style:cr,children:n.inDeg}),e("td",{style:cr,children:n.outDeg}),z&&e("td",{style:cr,children:Zi(n.wDegree)}),z&&e("td",{style:cr,children:Zi(n.wInDeg)}),z&&e("td",{style:cr,children:Zi(n.wOutDeg)})]},o))})]}),q>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>C(e=>e+25),style:dr,children:["Show ",Math.min(25,q)," more"," ",1===q?"node":"nodes"," (",q," remaining)"]})]})}function fr({summary:t}){return t?e("div",{role:"note",style:Ui,children:t}):null}function pr({tableId:t}){return e("a",{href:"#"+t,style:Ui,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ui)},children:"Skip to data table"})}function yr({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Ui,children:n})}const mr="var(--semiotic-focus, #005fcc)";function vr({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:mr,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:mr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:mr,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function br(e){return Array.isArray(e)?e[0]:e}function xr(e,t,n,o){return Object.assign({data:br(e),x:t,y:n,__semioticHoverData:!0},o)}const wr=["name","label","title"],kr=["type","kind","category","group","class","status","role","shape"],Ar=["value","amount","total","count","weight","score"],Sr=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Cr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Or(e,t={}){var n;if(!e||"object"!=typeof e)return{entries:[]};const o=null!==(n=t.maxEntries)&&void 0!==n?n:6,i=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(i&&Sr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let a=r.findIndex(e=>wr.includes(e.lower));const s=a>=0;0>a&&(a=r.findIndex(e=>"id"===e.lower)),0>a&&(a=r.findIndex(e=>"string"==typeof e.value));const l=0>a?void 0:r[a];let c=r.filter((e,t)=>t!==a);s&&(c=c.filter(e=>"id"!==e.lower));const u=Cr(c,kr),d=Cr(c,Ar),h=new Set(kr),g=new Set(Ar),f=[];u&&f.push({key:u.key,value:u.value}),d&&f.push({key:d.key,value:d.value});for(const e of c){if(f.length>=o)break;e!==u&&e!==d&&(h.has(e.lower)||g.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:null==l?void 0:l.key,title:null==l?void 0:l.value,entries:f}}const _r={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 jr(e,t){return"function"==typeof t?t(e):e[t]}function Pr(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Mr(n={}){const{fields:o,title:i,format:r,style:a={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=jr(n,i);l=Pr(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=jr(n,o);c.push({label:t,value:Pr(a,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Pr(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Pr(n[e[0]],r))}}const u=Object.assign(Object.assign({},_r),a);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function Lr(n={}){const{fields:o=[],title:i,format:r,style:a={},className:s="",showLabels:l=!0,separator:c=": "}=n;return n=>{if(!n||"object"!=typeof n)return null;const u=[];if(i){const e=jr(n,i);u.push({value:Pr(e,r)})}if(o&&Array.isArray(o)&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Pr(jr(n,o),i);u.push({label:l?t:void 0,value:a})});else{const e=Or(n,{skipPositional:!1});null!=e.title&&u.push({label:void 0,value:Pr(e.title,r),bold:!0}),e.entries.forEach(e=>{u.push({label:l?e.key:void 0,value:Pr(e.value,r)})})}const d=Object.assign(Object.assign({},_r),a);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:d,children:u.map((e,n)=>t("div",{style:{marginBottom:u.length-1>n?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},n))}):null}}function Tr(){return n=>{var o,i,r,a,s,l,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:_r,children:e("div",{children:Pr(t)})})}const d=null!==(l=null!==(a=n.xValue)&&void 0!==a?a:null===(s=n.data)||void 0===s?void 0:s.time)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:_r,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Pr(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Pr(n.value)})]},o))]})}}function $r(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let i=br(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t);("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:_r,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Mr(t):Mr())}}function Nr({x:t,y:n,containerWidth:i,containerHeight:r,margin:a,children:s,className:l="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(s),y=p?null:_r;return u?e("div",{ref:d,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:a.left+t,top:a.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}function Dr(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}function Br(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return a(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Dr(e,e=>t(e.matches))},[]),e}function Ir(e,t,n){const o=i(null),[r,s]=d(null);return a(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const Rr="undefined"==typeof window?a:h;function Fr(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Er(e){const t=Br(),n=i(t);n.current=t;const[s,c]=Ir(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),d=c[0]-u.left-u.right,h=c[1]-u.top-u.bottom,g=Fr(e.foregroundGraphics,c,u),f=Fr(e.backgroundGraphics,c,u),p=Ie(e=>e.theme),{transition:y,introEnabled:m}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),v="semiotic-table-"+o.useId(),b=i(0),x=i(()=>{}),w=l(()=>{b.current||(b.current=requestAnimationFrame(()=>x.current()))},[]);a(()=>()=>{b.current&&(cancelAnimationFrame(b.current),b.current=0)},[]);const k=i(()=>{}),A=i(()=>{}),S=i(null),C=i(0),O=l(()=>{C.current=0;const e=S.current;S.current=null,e&&k.current(e)},[]),_=l(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(O))},[O]),j=l(()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),A.current()},[]);a(()=>()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return Rr(()=>{P&&(mn++,P.current=!0,w())},[p,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:s,size:c,margin:u,adjustedWidth:d,adjustedHeight:h,resolvedForeground:g,resolvedBackground:f,currentTheme:p,transition:y,introEnabled:m,tableId:v,rafRef:b,renderFnRef:x,scheduleRender:w,hoverHandlerRef:k,hoverLeaveRef:A,onPointerMove:_,onPointerLeave:j}}function Hr(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===a||(e.width=r,e.height=a),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function zr(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Wr(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Gr(e,t,n,o,i,r){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let r=i;l>o&&(r*=o/l),l>s-o&&(r*=(s-o)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Yr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=s.style.stroke||"#007bff",u=kn(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,g=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const m=null!==(i=s.style.opacity)&&void 0!==i?i:1;Gr(e,s.path,u,d,m,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Sn(s.curve),p=h&&h.length>0&&g&&g.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!p){e.strokeStyle=u;const v=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(p){let x=null,w=null,k=null,A=null,S=!1;function C(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),S=!0}function O(){S&&(e.stroke(),S=!1)}for(let _=0;s.path.length>_;_++){const[j,P]=s.path[_],M=g[_],L=Wr(M,h,u);if(null!==x&&null!==A&&null!==k){if(L===A)e.lineTo(j,P);else{const T=[];for(const $ of h){const N=$.value;(k>N||N>M)&&(N>k||M>N)||k===N||M===N||T.push({t:(N-k)/(M-k)})}T.sort((e,t)=>e.t-t.t);for(const D of T){const B=x+(j-x)*D.t,I=w+(P-w)*D.t,R=Wr(k+(M-k)*Math.min(D.t+1e-4,1),h,u);e.lineTo(B,I),O(),C(R,B,I)}e.lineTo(j,P)}x=j,w=P,k=M,A=L}else C(L,j,P),x=j,w=P,k=M,A=L}O()}else{e.beginPath();const F=s.strokeGradient&&s.path.length>=2?_n(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=F||u,f)G().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[E,H]=s.path[0];e.moveTo(E,H);for(let z=1;s.path.length>z;z++)e.lineTo(s.path[z][0],s.path[z][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=Cn(e,s.style.fill,s.style.fill),f&&!p)G().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[Y,q]=s.path[0];e.moveTo(Y,q);for(let V=1;s.path.length>V;V++)e.lineTo(s.path[V][0],s.path[V][1])}const W=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(W,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function qr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Vr(e,t,n=.3){qr(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Xr(e,t,n=.6){var o,i,r,a,s;if(!qr(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ur(e,t,n,o=.35){qr(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Kr(e,t){const n=Sn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=Y().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Qr=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const s=t._introClipFraction;void 0!==s&&1>s&&(e.save(),e.beginPath(),e.rect(0,0,o.width*s,o.height),e.clip());const l=Cn(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Kr(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=On(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,n,0,o);e.fillStyle=i||l,e.globalAlpha=u}else{const n=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=n*u,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Kr(e,t),Ur(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?_n(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Sn(t.curve);if(e.beginPath(),o)G().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==s&&1>s&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Zr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"point"===e.type);if(0!==a.length){e.save();try{const t=e.globalAlpha;for(const n of a){e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI);const o=null!==(r=null!==(i=n.style.opacity)&&void 0!==i?i:n.style.fillOpacity)&&void 0!==r?r:1;e.globalAlpha=t*o,e.fillStyle=Cn(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Cn(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Xr(e,n)}}finally{e.restore()}}},Jr=new Map;function ea(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=Jr.get(n);return o||(o=new Path2D(Ut(e.symbolType,e.size)),Jr.size>256&&Jr.clear(),Jr.set(n,o)),o}catch(e){return null}}const ta=(e,t)=>{var n,o,i,r;const a=e.globalAlpha;for(const s of t){if("symbol"!==s.type)continue;const t=s;if(0>=t.size)continue;const l=ea(t);if(!l)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const c=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*(null!==(o=t._decayOpacity)&&void 0!==o?o:1);t.style.fill&&(e.globalAlpha=a*c*(null!==(i=t.style.fillOpacity)&&void 0!==i?i:1),e.fillStyle=Cn(e,t.style.fill,"#4e79a7"),e.fill(l)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=a*c,e.strokeStyle=Cn(e,t.style.stroke,t.style.stroke),e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,e.stroke(l)),e.restore()}e.globalAlpha=a};function na(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:a,tr:s,br:l,bl:c}=Oi(t);e.beginPath(),e.moveTo(n+a,o),e.lineTo(n+i-s,o),s>0&&e.arcTo(n+i,o,n+i,o+s,s),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+a),a>0&&e.arcTo(n,o,n+a,o,a),e.closePath()}function oa(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const ia=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)ra(e,t);else if(t.cornerRadii&&Ci(t.cornerRadii)){const n=Cn(e,t.style.fill,kn(e,"var(--semiotic-primary, #007bff)")),o=oa(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,na(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Cn(e,t.style.fill,kn(e,"var(--semiotic-primary, #007bff)")),o=oa(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+r,s),e.arcTo(a,s,a,s+r,r),e.lineTo(a,s+c-r),e.arcTo(a,s+c,a+r,s+c,r),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a+r,s+c),e.arcTo(a,s+c,a,s+c-r,r);break;default:e.moveTo(a,s+c),e.lineTo(a,s+r),e.arcTo(a,s,a+r,s,r),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Cn(e,t.style.fill,kn(e,"var(--semiotic-primary, #007bff)")),o=oa(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Vr(e,t),e.globalAlpha=1}};function ra(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,a=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,a,o,i,i)}else{const r=i+o,a=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,a,i,i)}e.restore()}function aa(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function sa(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const la=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=kn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Vr(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):sa(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=aa(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},ca=(e,t,n,o)=>{var i,r,a;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const s=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(a=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==a?a:1);1!==s&&(e.globalAlpha=s);const l=kn(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=kn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function ua(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}function da(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function ha(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}function ga(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const a=Object.assign({},n);return o&&(a[e.key]=e.fn(n)),r&&(a[t.key]=t.fn(n)),a});return i?r:o}}const fa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pa(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${fa[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${fa[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const ya={line:[Qr,Yr,Zr],area:[Qr,Zr],stackedarea:[Qr,Zr],scatter:[Zr,ta],bubble:[Zr,ta],heatmap:[la],bar:[ia],swarm:[Zr],waterfall:[(e,t,n,o)=>{var i;ia(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const a=r[0].datum,s=null==a?void 0:a._connectorStroke;if(s){e.save(),e.strokeStyle=kn(e,s)||s,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],a=o.datum,s=i.datum;if(null==(null==a?void 0:a.cumEnd)||null==(null==s?void 0:s.baseline))continue;const l=n.y(a.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[ca],mixed:[Qr,Yr,Zr],custom:[Qr,ia,la,Yr,Zr,ta,ca]},ma={top:20,right:20,bottom:30,left:40},va={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 ba(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const xa={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 wa({hover:n}){var o,i,r;const a=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=n.data)&&void 0!==o?o:{},l=null!==(i=s.y)&&void 0!==i?i:s.value,c=null!==(r=s.x)&&void 0!==r?r:s.time;return t("div",{className:"semiotic-tooltip",style:xa,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:a(l)}),e("div",{style:{opacity:.7,fontSize:11},children:a(c)})]})}wa.ownsChrome=!0;const ka=g(function(n,s){var c,u,h,g,y,m,v,b,x,w,k,A,S;const{chartType:C,runtimeMode:O,data:_,chunkThreshold:j,chunkSize:P,xAccessor:M,yAccessor:L,colorAccessor:T,sizeAccessor:$,symbolAccessor:N,symbolMap:D,groupAccessor:B,lineDataAccessor:I,curve:R,normalize:F,baseline:E,stackOrder:H,binSize:z,valueAccessor:W,arrowOfTime:G="right",windowMode:Y="sliding",windowSize:q=200,timeAccessor:V,xExtent:X,yExtent:U,extentPadding:K=.1,scalePadding:Q,sizeRange:Z,size:J=[500,300],responsiveWidth:ee,responsiveHeight:te,margin:ne,className:oe,background:ie,lineStyle:re,pointStyle:ae,areaStyle:se,barStyle:le,waterfallStyle:ce,swarmStyle:ue,barColors:de,colorScheme:he,boundsAccessor:ge,boundsStyle:fe,y0Accessor:pe,band:ye,gradientFill:me,lineGradient:ve,areaGroups:be,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:_e,showAxes:je=!0,axes:Me,xLabel:Le,yLabel:Te,yLabelRight:$e,xFormat:Ne,yFormat:De,axisExtent:Be,tickFormatTime:Ie,tickFormatValue:Re,hoverAnnotation:Fe,tooltipContent:Ee,customHoverBehavior:He,customClickBehavior:ze,enableHover:We,hoverRadius:Ge=30,tooltipMode:Ye,annotations:qe,autoPlaceAnnotations:Ve,svgAnnotationRules:Xe,showGrid:Ue,legend:Ke,legendHoverBehavior:Qe,legendClickBehavior:Ze,legendHighlightedCategory:Je,legendIsolatedCategories:et,legendPosition:tt,legendLayout:nt,legendCategoryAccessor:ot,onCategoriesChange:it,backgroundGraphics:rt,foregroundGraphics:at,canvasPreRenderers:st,svgPreRenderers:lt,title:ct,categoryAccessor:ut,brush:dt,onBrush:ht,decay:gt,pulse:ft,transition:pt,animate:yt,staleness:mt,heatmapAggregation:vt,heatmapXBins:bt,heatmapYBins:xt,showValues:wt,heatmapValueFormat:kt,marginalGraphics:At,pointIdAccessor:St,xScaleType:Ct,yScaleType:Ot,accessibleTable:_t=!0,description:jt,summary:Pt,linkedCrosshairName:Mt,linkedCrosshairSourceId:Lt,customLayout:Tt,layoutConfig:$t,layoutSelection:Nt}=n,Dt=f().replace(/:/g,""),Bt=i(!1),It=i({w:-1,h:-1}),Rt=Er({sizeProp:J,responsiveWidth:ee,responsiveHeight:te,userMargin:ne,marginDefault:ma,animate:yt,transitionProp:pt,themeDirtyRef:Bt}),Ft=Bi(),Et=Ei(),{reducedMotionRef:Ht,responsiveRef:zt,size:Gt,currentTheme:Yt,transition:qt,introEnabled:Vt,tableId:Xt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt}=Rt;let Zt=Rt.margin;if(At){const e=60,t=Object.assign({},Rt.margin);At.top&&e>t.top&&(t.top=e),At.bottom&&e>t.bottom&&(t.bottom=e),At.left&&e>t.left&&(t.left=e),At.right&&e>t.right&&(t.right=e),Zt=t}const Jt="function"==typeof at?at({size:Gt,margin:Zt}):at,en="function"==typeof rt?rt({size:Gt,margin:Zt}):rt,tn=Gt[0]-Zt.left-Zt.right,nn=Gt[1]-Zt.top-Zt.bottom,an=r(()=>ke(_),[_]),sn=null!=Fe?Fe:We,cn=i(null),un=i(null),[dn,hn]=d(0),gn=i(0),[fn,pn]=d(null),yn=i(null),mn=i(null),[vn,bn]=d(null),xn=i(va.primary),wn=i([]),An=i(ot),Sn=i(it);An.current=ot,Sn.current=it;const[Cn,On]=d(!1),[_n,jn]=d([]),[Tn,$n]=d([]),Nn="streaming"===O||["bar","swarm","waterfall"].includes(C),Dn=r(()=>{var e,t,n;return{chartType:C,runtimeMode:Nn?"streaming":"bounded",windowSize:q,windowMode:Y,arrowOfTime:Nn?G:"right",extentPadding:K,scalePadding:Q,axisExtent:Be,xAccessor:M,yAccessor:L,timeAccessor:Nn?V:void 0,valueAccessor:W,colorAccessor:T,sizeAccessor:$,symbolAccessor:N,symbolMap:D,groupAccessor:B||(I?"_lineGroup":void 0),categoryAccessor:ut,lineDataAccessor:I,xScaleType:Ct,yScaleType:Ot,xExtent:X,yExtent:U,sizeRange:Z,binSize:z,normalize:F,baseline:E,stackOrder:H,boundsAccessor:ge,boundsStyle:fe,y0Accessor:pe,band:ye,gradientFill:!0===me?{topOpacity:.8,bottomOpacity:.05}:!1===me?void 0:me,areaGroups:be?new Set(be):void 0,lineGradient:ve,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:_e,lineStyle:re,pointStyle:ae,areaStyle:se,swarmStyle:ue,waterfallStyle:ce,colorScheme:he,barColors:de,barStyle:le,annotations:qe,decay:gt,pulse:ft,transition:qt,introAnimation:Vt,staleness:mt,heatmapAggregation:vt,heatmapXBins:bt,heatmapYBins:xt,showValues:wt,heatmapValueFormat:kt,pointIdAccessor:St,curve:R,themeCategorical:null===(e=null==Yt?void 0:Yt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Pe(Yt),themeSequential:null===(t=null==Yt?void 0:Yt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Yt?void 0:Yt.colors)||void 0===n?void 0:n.diverging,customLayout:Tt,layoutConfig:$t,layoutMargin:Zt}},[C,q,Y,G,K,Q,Be,M,L,V,W,Ct,Ot,T,$,N,D,B,ut,I,X,U,Z,z,F,E,H,ge,fe,pe,ye,me,ve,be,xe,we,Ae,Se,_e,re,ae,se,ue,ce,le,he,de,qe,gt,ft,null==qt?void 0:qt.duration,null==qt?void 0:qt.easing,Vt,mt,vt,bt,xt,wt,kt,Nn,St,R,Yt,Tt,$t,Zt]),Bn=zi(Dn),In=i(null);In.current||(In.current=new on(Bn));const Rn=l(()=>{var e,t;const n=An.current,o=Sn.current;if(!o||!n)return;const i=ua(null!==(t=null===(e=In.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);da(i,wn.current)||(wn.current=i,o(i))},[]);a(()=>{var e;null===(e=In.current)||void 0===e||e.updateConfig(Bn),Bt.current=!0,Qt()},[Bn,Qt]);const Fn=i(null);a(()=>{const e=In.current;if(!e)return;const t=null!=Nt?Nt:null;Fn.current!==t&&(Fn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):Bt.current=!0,Qt())},[Nt,Qt]);const Gn=i(null);Gn.current||(Gn.current=new Oe(e=>{const t=In.current;t&&t.ingest(e)&&(Bt.current=!0,Qt())},{chunkThreshold:j,chunkSize:P})),a(()=>{var e;null===(e=Gn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:j,chunkSize:P})},[j,P]);const Yn=l(e=>{var t;null===(t=Gn.current)||void 0===t||t.push(e)},[]),Vn=l(e=>{var t;null===(t=Gn.current)||void 0===t||t.pushMany(e)},[]),Xn=l(()=>{var e,t;null===(e=Gn.current)||void 0===e||e.clear(),null===(t=In.current)||void 0===t||t.clear(),Bt.current=!0,Qt()},[Qt]);p(s,()=>({push:Yn,pushMany:Vn,remove:e=>{var t,n,o;null===(t=Gn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=In.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(yn.current&&i.some(e=>{var t;return e===(null===(t=yn.current)||void 0===t?void 0:t.data)})&&(yn.current=null,bn(null)),Bt.current=!0,Qt()),i},update:(e,t)=>{var n,o,i;null===(n=Gn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=In.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Bt.current=!0,Qt()),r},clear:Xn,getData:()=>{var e,t,n;return null===(e=Gn.current)||void 0===e||e.flush(),null!==(n=null===(t=In.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=In.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=In.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Yn,Vn,Xn,Qt]),a(()=>{var e,t;if(_){if(I&&an.length>0&&"object"==typeof an[0]&&null!==an[0]){const t="string"==typeof I?I:"coordinates";if(Array.isArray(an[0][t])){const n=[];for(const e of an){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Gn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Gn.current)||void 0===t||t.setBoundedData(an)}},[_,an,I]);const{hoverHandlerRef:Un,hoverLeaveRef:Kn,onPointerMove:eo,onPointerLeave:to}=Rt;Un.current=e=>{var t,n,o,i;if(!sn)return;const r=cn.current;if(!r)return;const a=r.getBoundingClientRect(),s=e.clientX-a.left-Zt.left,l=e.clientY-a.top-Zt.top;if(0>s||s>tn||0>l||l>nn)return void(yn.current&&(yn.current=null,mn.current=null,bn(null),He&&(He(null),Bt.current=!0),Qt()));const c=In.current;if(!c||0===c.scene.length)return;const u=Mn(c.scene,s,l,Ge,c.quadtree,c.maxPointRadius),d="multi"===Ye,h=()=>{yn.current&&(yn.current=null,mn.current=null,bn(null),He&&He(null),Qt())};if(!u&&!d)return void h();const g=d||!u?s:u.x,f=d||!u?l:u.y,p=(null==u?void 0:u.datum)?Wt(u.datum,c.resolvedRibbons):{},y=null===(n=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,m="function"==typeof y?y(g):void 0;let v=xr(p,g,f,null!=m?{xValue:m,xPx:g}:void 0);if(d&&c.scene.length>0&&c.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=Ln(Pn(e.path,e.curve),t,n);if(null===r)continue;const a=En(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=Pn(e.topPath,e.curve),a=Pn(e.bottomPath,e.curve),s=Ln(r,t,n);if(null===s)continue;const l=Ln(a,t,n),c=En(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:s,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(c.scene,g,Math.max(Ge,tn));if(e.length>0){const t=c.scales.y.invert,n=xn.current,o=y?y(g):g;if(u)v.xValue=o,v.xPx=g;else{const e={xValue:o};"string"==typeof M&&(e[M]=o),v=xr(e,g,f,{xValue:o,xPx:g})}v.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===C&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Wt(e.datum,c.resolvedRibbons)}})}}u||(null===(o=v.allSeries)||void 0===o?void 0:o.length)?(yn.current=v,mn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,bn(v),He&&(He(v),Bt.current=!0),Qt()):h()},Kn.current=()=>{yn.current&&(yn.current=null,mn.current=null,bn(null),He&&(He(null),Bt.current=!0),Qt())};const no=i(()=>{});no.current=e=>{var t,n;if(!ze)return;const o=cn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-Zt.left,a=e.clientY-i.top-Zt.top;if(0>r||r>tn||0>a||a>nn)return void ze(null);const s=In.current;if(!s||0===s.scene.length)return void ze(null);const l=Mn(s.scene,r,a,Ge,s.quadtree,s.maxPointRadius);if(!l)return void ze(null);const c=l.datum||{},u=null===(n=null===(t=s.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(l.x):void 0;ze(xr(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0))};const oo=l(e=>no.current(e),[]),io=i(-1),ro=i(null),ao=i(null),so=l(e=>{const t=In.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(ao.current&&ao.current.version===n)o=ao.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=r.size)break;i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=Hn(e),ao.current={version:n,graph:o}}const i=io.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),io.current=0;const n=o.flat[0];ro.current={shape:n.shape,w:n.w,h:n.h};const i=qn(Object.assign(Object.assign({},n),{datum:Wt(n.datum,t.resolvedRibbons)}));return yn.current=i,bn(i),He&&He(i),void Qt()}const r=zn(o,i),a=Wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return io.current=-1,ro.current=null,yn.current=null,mn.current=null,bn(null),He&&He(null),void Qt();io.current=a;const s=o.flat[a];ro.current={shape:s.shape,w:s.w,h:s.h};const l=qn(Object.assign(Object.assign({},s),{datum:Wt(s.datum,t.resolvedRibbons)}));yn.current=l,bn(l),He&&He(l),Qt()},[He,Qt]),lo=l(e=>{io.current=-1,ro.current=null,eo(e)},[eo]);Kt.current=()=>{Ut.current=0;const e=cn.current,t=un.current;if(!e||!t)return;const n=In.current;if(!n)return;const o="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(Ht.current?o+1e6:o),r=!Ht.current&&i,a=It.current.w!==tn||It.current.h!==nn,s=Bt.current||i||a;let l=!1;!s||r&&!a||(n.computeScene({width:tn,height:nn}),It.current={w:tn,h:nn},l=!0,Rn());const c=zr(),u=function(e){if(!e)return va;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),a=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return a||s||n||r?{axisStroke:l||va.axisStroke,tickText:a||va.tickText,crosshair:a?ba(a,"66"):va.crosshair,hoverFill:c?ba(c,"4D"):va.hoverFill,hoverStroke:a?ba(a,"99"):va.hoverStroke,pointRing:c||va.pointRing,primary:r||va.primary}:va}(e);xn.current=u.primary;const d=Qn(mt,n.lastIngestTime>0?o-n.lastIngestTime:0),h=mt&&d.isStale;if(s){const t=Hr(e,Gt,Zt,c);if(t){if(t.clearRect(-Zt.left,-Zt.top,Gt[0],Gt[1]),mt&&1>d.alpha&&(t.globalAlpha=d.alpha),"transparent"!==ie&&!rt){const n=getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),o=ie||(n&&"transparent"!==n?n:null),i=o?kn(t,o):null;i&&(t.fillStyle=i,t.fillRect(-Zt.left,-Zt.top,Gt[0],Gt[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,tn,nn),t.clip()),st&&n.scales)for(const e of st)t.save(),e(t,n.scene,n.scales,{width:tn,height:nn}),t.restore();const o=Tt?ya.custom:ya[C];if(o&&n.scales)for(const e of o)e(t,n.scene,n.scales,{width:tn,height:nn});t.restore(),mt&&1>d.alpha&&(t.globalAlpha=1)}}{const e=Hr(t,Gt,Zt,c);if(e&&(e.clearRect(-Zt.left,-Zt.top,Gt[0],Gt[1]),sn&&yn.current&&n.scales&&function(e,t,n,o,i,r,a){var s;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||a.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=a.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||a.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||a.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,yn.current,tn,nn,"object"==typeof sn?sn:{},mn.current,u),mn.current&&Array.isArray(Fe))){const t=Fe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const a="group"in n?n.group:void 0;if(void 0!==a)for(const n of t){if("line"!==n.type)continue;if(n.group!==a)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,n.scene,mn.current,t,u)}}s&&e&&e.setAttribute("aria-label",Ki(n.scene,C+" chart"));const g=Bt.current;if(Bt.current=g&&r&&!l,g&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!fn||e(fn.x.domain()[0])!==e(n.scales.x.domain()[0])||e(fn.x.domain()[1])!==e(n.scales.x.domain()[1])||e(fn.y.domain()[0])!==e(n.scales.y.domain()[0])||e(fn.y.domain()[1])!==e(n.scales.y.domain()[1])||fn.x.range()[0]!==n.scales.x.range()[0]||fn.x.range()[1]!==n.scales.x.range()[1]||fn.y.range()[0]!==n.scales.y.range()[0]||fn.y.range()[1]!==n.scales.y.range()[1])&&pn(n.scales),At){const e=n.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof L?L:e=>e[L||"y"];jn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),$n(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((qe&&qe.length>0||Tt)&&(l||r))||!l&&33>o-gn.current||(hn(e=>e+1),gn.current=o),(null==mt?void 0:mt.showBadge)&&On(!!h),(r||null!=n.activeTransition||n.hasActivePulses)&&(Ut.current=requestAnimationFrame(()=>Kt.current()))},Hi({hydrated:Ft,wasHydratingFromSSR:Et,storeRef:In,dirtyRef:Bt,renderFnRef:Kt,cleanup:()=>{var e;return null===(e=Gn.current)||void 0===e?void 0:e.clear()}}),a(()=>{Bt.current=!0,Qt()},[C,tn,nn,je,ie,re,st,Qt]),Zn(mt,In,Bt,Qt,Cn,On);const co=r(()=>{if(Ne||Ie)return;const e=In.current;return(null==e?void 0:e.xIsDate)&&fn?pa(fn.x.domain()):void 0},[Ne,Ie,fn]),uo=Ne||Ie||co,ho=sn&&vn?Ee?Ee(vn):e(wa,{hover:vn}):null,go=ho?e(Nr,{x:vn.x,y:vn.y,containerWidth:tn,containerHeight:nn,margin:Zt,className:"stream-frame-tooltip",children:ho}):null,fo=ro.current,po=e(vr,{active:io.current>=0,hoverPoint:vn,margin:Zt,size:Gt,shape:null==fo?void 0:fo.shape,width:null==fo?void 0:fo.w,height:null==fo?void 0:fo.h}),yo=ha(M,V,"__semiotic_resolvedX","__semiotic_resolvedTime"),mo=ha(L,W,"__semiotic_resolvedY","__semiotic_resolvedValue"),vo=yo.key,bo=mo.key,xo=ga(yo,mo,qe&&qe.length>0||!1);if(Ni||!Ft&&Et){const n=In.current;n&&_&&(n.ingest({inserts:an,bounded:!0}),n.computeScene({width:tn,height:nn}));const i=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,a=uo||(()=>{if((null==n?void 0:n.xIsDate)&&r)return pa(r.x.domain())})();return t("div",{ref:zt,className:"stream-xy-frame"+(oe?" "+oe:""),role:"img","aria-label":jt||("string"==typeof ct?ct:"XY chart"),style:{position:"relative",width:ee?"100%":Gt[0],height:te?"100%":Gt[1]},children:[e(fr,{summary:Pt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Gt[0],height:Gt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en}),t("g",{transform:`translate(${Zt.left},${Zt.top})`,children:[ie&&e("rect",{x:0,y:0,width:tn,height:nn,fill:ie}),lt&&r&&lt.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:tn,height:nn})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,a,s,l,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:Li(c.style.fill),fillOpacity:null!==(a=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:Li(c.style.fill),fillOpacity:null!==(l=null!==(s=c.style.fillOpacity)&&void 0!==s?s:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Li(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"symbol":return Ti(n,o);case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Li(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,a,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*a+.114*s>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),a=Math.max(Math.abs(i.openY-i.closeY),1),s=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:a,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,Dt)).filter(Boolean)]})]}),e(Si,{width:tn,height:nn,totalWidth:Gt[0],totalHeight:Gt[1],margin:Zt,scales:r,showAxes:je,axes:Me,xLabel:Le,yLabel:Te,yLabelRight:$e,xFormat:a,yFormat:De||Re,axisExtent:Be,showGrid:Ue,title:ct,legend:Ke,legendHoverBehavior:Qe,legendClickBehavior:Ze,legendHighlightedCategory:Je,legendIsolatedCategories:et,legendPosition:tt,legendLayout:nt,foregroundGraphics:rn(Jt,ln(null===(h=In.current)||void 0===h?void 0:h.customLayoutOverlays,null!=Nt?Nt:null)),marginalGraphics:At,xValues:[],yValues:[],annotations:qe,autoPlaceAnnotations:Ve,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:vo,yAccessor:bo,annotationData:xo(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:Lt})]})}return t("div",{ref:zt,className:"stream-xy-frame"+(oe?" "+oe:""),role:"group","aria-label":jt||("string"==typeof ct?ct:"XY chart"),tabIndex:0,style:{position:"relative",width:ee?"100%":Gt[0],height:te?"100%":Gt[1],overflow:"visible"},onKeyDown:so,children:[_t&&e(pr,{tableId:Xt}),_t&&e(hr,{scene:null!==(y=null===(g=In.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:C+" chart",tableId:Xt,chartTitle:"string"==typeof ct?ct:void 0}),e(fr,{summary:Pt}),e(yr,{hoverPoint:vn}),t("div",{role:"img","aria-label":jt||("string"==typeof ct?ct:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:sn?lo:void 0,onMouseLeave:sn?to:void 0,onClick:ze?oo:void 0,children:[en&&e("svg",{style:{position:"absolute",left:0,top:0,width:Gt[0],height:Gt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en})}),e(wi,{width:tn,height:nn,totalWidth:Gt[0],totalHeight:Gt[1],margin:Zt,scales:fn,showAxes:je,axes:Me,showGrid:Ue,xFormat:uo,yFormat:De||Re,axisExtent:Be}),e("canvas",{ref:cn,"aria-label":Ki(null!==(v=null===(m=In.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],C+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:un,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Si,{width:tn,height:nn,totalWidth:Gt[0],totalHeight:Gt[1],margin:Zt,scales:fn,showAxes:je,axes:Me,xLabel:Le,yLabel:Te,yLabelRight:$e,xFormat:uo,yFormat:De||Re,axisExtent:Be,showGrid:Ue,title:ct,legend:Ke,legendHoverBehavior:Qe,legendClickBehavior:Ze,legendHighlightedCategory:Je,legendIsolatedCategories:et,legendPosition:tt,legendLayout:nt,foregroundGraphics:rn(Jt,ln(null===(b=In.current)||void 0===b?void 0:b.customLayoutOverlays,null!=Nt?Nt:null)),marginalGraphics:At,xValues:_n,yValues:Tn,annotations:qe,autoPlaceAnnotations:Ve,svgAnnotationRules:Xe,annotationFrame:dn,xAccessor:vo,yAccessor:bo,annotationData:xo(null===(x=In.current)||void 0===x?void 0:x.getData()),pointNodes:null===(w=In.current)||void 0===w?void 0:w.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==ie&&!rt,linkedCrosshairName:Mt,linkedCrosshairSourceId:Lt}),(dt||ht)&&e(Ce,{width:tn,height:nn,totalWidth:Gt[0],totalHeight:Gt[1],margin:Zt,dimension:null!==(k=null==dt?void 0:dt.dimension)&&void 0!==k?k:"xy",scales:fn,onBrush:null!=ht?ht:()=>{},binSize:z,snap:null==dt?void 0:dt.snap,binBoundaries:null!==(A=null==dt?void 0:dt.binBoundaries)&&void 0!==A?A:"bar"===C?null===(S=In.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==dt?void 0:dt.snapDuring,streaming:"streaming"===O}),(null==mt?void 0:mt.showBadge)&&e(Jn,{isStale:Cn,position:mt.badgePosition}),po,go]})]})});ka.displayName="StreamXYFrame";const Aa=u(null);function Sa({colors:t,categories:n,colorScheme:o="category10",children:i}){const a=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:At[o]||St,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(Aa.Provider,{value:a,children:i})}function Ca(){return s(Aa)}function Oa(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function _a(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Oa(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function ja(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Pa(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}Sa.displayName="CategoryColorProvider";const[Ma,La]=_e(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Pa(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),a=ja(r,t),s=new Map(a.clauses);return s.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},a),{clauses:s})),{selections:r}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),r=ja(i,t);return i.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Ta,$a]=_e(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Na(e){const t=f(),n=e.clientId||t,{name:o}=e,i=La(e=>e.selections.get(o)),a=La(e=>e.setClause),s=La(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?_a(i,n):()=>!0,[i,n]),isActive:c,selectPoints:l(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},i=!0;i&&a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:l(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},i=!0;i&&a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:l(()=>{s(o,n)},[s,o,n]),clientId:n}}function Da(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:a}=Na({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Ra(t)&&r(t)},[n,r,a,t]),predicate:o,isActive:i}}function Ba(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ia(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=Na({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Ba(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===u&&Ba(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Ra(t)&&s(t)},[u,n,o,s,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Ra(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Fa(e,t,n){const o=La(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=_a(o,n);return e.filter(t)},[e,o,n])}function Ea(e={}){const{limit:t=50,types:n,chartId:o}=e,i=$a(e=>e.version),a=$a(e=>e.observations),s=$a(e=>e.clearObservations),l=r(()=>{let e=a;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[a,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const Ha=u(!1),za=u(null),Wa="undefined"==typeof window?a:h;function Ga(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Ya(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function qa(e){const t=s(za),n=f(),o=Ga(e),r=i([]);Ya(r.current,o)||(r.current=o);const a=r.current;Wa(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Wa(()=>{t&&t.registerCategories(n,a)},[t,n,a])}function Va({selections:e}){const t=La(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Xa({categoryColors:t,interaction:n,selectionName:o,field:s}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=Da({name:o,fields:[s]}),f=Na({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,a(()=>{"isolate"===n&&(p.size>0?b.current({[s]:Array.from(p)}):x.current())},[n,p,s]);const w=l(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[s]:e.label})):(v(null),g.onHover(null)))},[n,s,g]),k=l(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[S]]=Ir([0,0],!0,!1),C=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*C+8),style:{display:"block",overflow:"visible"},children:e(ao,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===n?w:void 0,customClickBehavior:"isolate"===n?k:void 0,highlightedCategory:m,isolatedCategories:p})})})}function Ua({children:n,selections:o,showLegend:a,legendPosition:s="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:u="category"}){const h=Ca(),[g,f]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=Ga(t);f(t=>{var o;return Ya(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(g))for(const n of t)e.push(n);return Ga(e)},[g]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=St[o%St.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===a||a,x=b&&Object.keys(v).length>0;return e(Ma,{children:t(Ta,{children:[o&&e(Va,{selections:o}),e(za.Provider,{value:y,children:e(Sa,{colors:v,children:t(Ha.Provider,{value:x,children:[b&&"top"===s&&e(Xa,{categoryColors:v,interaction:l,selectionName:c,field:u}),n,b&&"bottom"===s&&e(Xa,{categoryColors:v,interaction:l,selectionName:c,field:u})]})})})]})})}function Ka({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const a=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=a?o(a,t,n):n?n(i):Ct[r%Ct.length];return{label:i+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:s,label:""}]}}function Qa(e){return e?"string"==typeof e?{name:e}:e:null}function Za(e,t,n){return t?(o,...i)=>{var r;const a=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(a,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(a,n.unselectedStyle)}return a}:e}const Ja={light:Te,dark:$e,"high-contrast":Ne,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function es(e){return Ja[e]}const ts=o.createContext(void 0),ns="undefined"==typeof window?o.useEffect:o.useLayoutEffect;function os(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return es(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function is({theme:e}){const t=Ie(e=>e.setTheme),n=Ie(e=>e.theme),i=o.useRef(n);i.current=n;const r=o.useRef(null);o.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(r.current=i.current===Ne?Te:i.current,t("high-contrast")),Dr(n,e=>{var n,o;e.matches?(r.current=i.current===Ne?null!==(n=r.current)&&void 0!==n?n:Te:i.current,t("high-contrast")):(function(e,t){e(t===Te?"light":t===$e?"dark":t===Ne?"high-contrast":t)}(t,null!==(o=r.current)&&void 0!==o?o:Te),r.current=null)})},[e,t]);const a=o.useRef(!1);return ns(()=>{a.current?void 0!==e&&t(os(e)):a.current=!0},[e,t]),null}function rs({children:t}){var n,i,r,a,s;const l=Ie(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-cell-border":l.colors.cellBorder||l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(n=l.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),null!=l.typography.tickSize?{"--semiotic-tick-font-size":l.typography.tickSize+"px"}:{}),null!=l.typography.labelSize?{"--semiotic-axis-label-font-size":l.typography.labelSize+"px"}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=o.useContext(ts),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function as({theme:n,children:i}){const r="string"==typeof n&&es(n)?n:void 0,a=o.useMemo(()=>function(e){return void 0!==e?De(Te,os(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ne:Te}(n),[n]);return e(Be,{initialState:{theme:a},children:t(ts.Provider,{value:r,children:[e(is,{theme:n}),e(rs,{children:i})]})})}function ss(){return Ie(e=>e.theme)}const ls="#007bff";function cs(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function us(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function ds(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function hs(){var e;const t=ss(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function gs(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=At[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:ls}function fs(e,t,n){const o=Ca(),i=hs();return r(()=>{var r;if(!t)return;const a=null!=o?o:void 0,s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(a&&ds(a)){const e=Pt(n.map(e=>({_cat:e})),"_cat",s);return t=>a[t]||e(t)}return Pt(n.map(e=>({_cat:e})),"_cat",s)}if(a&&ds(a)){const n=Pt(e,t,s);return e=>a[e]||n(e)}return Pt(e,t,s)}if(a&&ds(a)){const e=Pt([{_:"a"}],"_",s);return t=>a[t]||e(t)}},[e,t,n,o,i])}function ps(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}function ys({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:s,chartId:c,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||g||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=Na({name:(null==e?void 0:e.name)||"__unused__"}),b=Da({name:(null==y?void 0:y.name)||"hover",fields:m}),x=$a(e=>e.pushObservation),w=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,A]=d(null),S=g||n[0],C=r(()=>{if(!h||null==k||!S)return null;const e=k,t=S;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,S]),O=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=cs(e,t,y.xField);null!=n&&function(e,t,n){const o=ri.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ri={positions:new Map(ri.positions).set(e,{xValue:t,sourceId:n})},si())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&li(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&S)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[S];A(null!=n?n+"":null)}else A(null);if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const r=us(e),a=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),x&&x(e)}}},[t,b,y,p,i,s,c,x,h,S]),_=l(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=cs(e,t,y.xField);null!=n&&function(e,t,n){const o=ri.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ri.positions);return t.delete(e),ri={positions:t},si(),!1}ri={positions:new Map(ri.positions).set(e,{xValue:t,sourceId:n,locked:!0})},si()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const n=us(e),a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),x&&x(e)}}},[u,i,x,s,c,y,p]);return a(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{ci(e,p),li(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:w,hoverSelectionHook:C,customHoverBehavior:O,customClickBehavior:_,crosshairSourceId:p}}function ms(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function vs({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(Ha),d=null!==s(za),h=void 0!==o?o:!u&&!!t,g=!!t&&(h||d),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[c,t,e,g]);qa(d&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=Ka({data:e,colorBy:t,colorScale:n,getColor:jt,categories:f}),i=o.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,a,p,i]);return{legend:p,margin:y,legendPosition:i}}function bs(e,t,n){const[o,i]=d(null),[a,s]=d(new Set),c=r(()=>new Set,[]),u=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),h=l(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),g=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,o,a]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?a:c,onLegendHover:u,onLegendClick:h,legendSelectionHook:g}}const xs={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 ws(e,t,n){var o,i,r,a,s,l,c;const u=xs[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:ks(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ks(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function As(e){return"string"==typeof e?e:"value"}function Ss(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Cs(e,t){if(!t)return Ss(e);try{const n=t(e);return null==n?Ss(e):n}catch(t){return Ss(e)}}function Os(e,t){return"function"==typeof t?t(e):e[t]}function _s(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function js(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const a=o?Cs(Os(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:_r,children:[null!=a&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:a}),i.map((n,o)=>{const i=Cs(Os(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function Ps({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:a=!1,valueFormat:s}){return l=>{var c;const u=a?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=Os(u,n),h=Os(u,o),g=i?Os(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:_r,children:[e("div",{style:{fontWeight:"bold"},children:Ss(d)}),e("div",{style:{marginTop:4},children:Cs(h,s)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||As(i),": ",Ss(g)]})]})}}function Ms({componentName:n,message:o,diagnosticHint:i,width:r,height:a}){return e("div",{role:"alert",style:{width:r,height:Math.max(a,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Ls extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Ms,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Ts;const $s="undefined"!=typeof process&&"production"!==(null===(Ts=process.env)||void 0===Ts?void 0:Ts.NODE_ENV);function Ns({componentName:t,width:n,height:o,children:i}){return e(Ls,{fallback:i=>e(Ms,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Ds={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Bs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Is(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Ds),{width:n,height:o}),children:i||"No data available"}):null}function Rs(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),a=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(a+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Bs),{position:"absolute",top:l+o*(a+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:a,opacity:.5+o%2*.2})},o))})}function Fs(e,t,n,o){if(!$s)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Es(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let a=1;o>=a;a++){const o=i[a];i[a]=e[r-1]===t[a-1]?n:1+Math.min(n,i[a],i[a-1]),n=o}}return i[o]}function Hs(e,t,n=3){let o,i=n+1;for(const n of t){const t=Es(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function zs(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ws(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Hs(e,t,3))&&void 0!==n?n:null)}function Gs({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=zs(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Ws(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Ys({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function qs({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=zs(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Ws(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Vs(e){const t=Ie(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Xs(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:a,legendPosition:s,selection:c,linkedHover:u,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:A,emptyContent:S,width:C,height:O}=e,_=void 0===n,j=r(()=>ke(t),[t]),[P,M]=d([]),L=l(e=>{M(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:$,hoverSelectionHook:N,customHoverBehavior:D,customClickBehavior:B,crosshairSourceId:I}=ys({selection:c,linkedHover:u,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:w,colorByField:T}),R=ms(u,I),F=fs(j,o,i),E=r(()=>{if(!o)return[];const e=new Set;for(const t of j){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[j,o]),H=r(()=>_&&P.length>0?P:E,[_,P,E]),z=bs(a,o,H),W=r(()=>N||(z.legendSelectionHook?z.legendSelectionHook:$),[N,z.legendSelectionHook,$]),G=Vs(c),Y=hs(),q=Ca(),V=r(()=>{if(F)return F;if(!o||0===H.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Y&&Y.length>0?Y:Ct,t="__streamCat",n=Pt(H.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[F,o,H,i,Y,q]),{legend:X,margin:U,legendPosition:K}=vs({data:j,colorBy:o,colorScale:V,showLegend:m,legendPosition:s,userMargin:v,defaults:b,categories:H}),Q=r(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),a&&"none"!==a&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),_&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[X,K,a,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,_,o,L]),Z=Array.isArray(n)?ke(n):n,J=Rs(k,C,O,A),ee=J?null:Is(Z,C,O,S);return{data:j,colorScale:F,allCategories:H,legendState:z,effectiveSelectionHook:W,activeSelectionHook:$,customHoverBehavior:D,customClickBehavior:B,legend:X,margin:U,legendPosition:K,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:R,resolvedSelection:G}}function Us(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Ks(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=r&&s.includes(r);let d;return a?d=a(e,r):n?o&&(d=jt(e,n,o)):d=i||ls,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[t,n,o,i,a,s,l]),p=r(()=>Us(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return r(()=>Za(p,null!=h?h:null,g),[p,h,g])}function Qs(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,a;const s=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(a=e.current)||void 0===a||a.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const a=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of a)null===(r=e.current)||void 0===r||r.push(n(t));return a},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const a=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of a)null===(r=n.current)||void 0===r||r.pushLine(t(e));return a},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Zs(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);o.length>i;i++)0>t.indexOf(o[i])&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function Js(e,t,n,o){return new(n||(n=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const el="__forecastSegment";let tl=null;function nl(){return Js(this,void 0,void 0,function*(){return tl||(tl=yield import("./semiotic-ai-statisticalOverlays-CU7jW05Q.js")),tl})}const ol="__semiotic_resolvedX",il="__semiotic_resolvedY";function rl(e){const{data:t,xAccessor:n,yAccessor:o,forecast:s,anomaly:l,groupBy:c}=e,u="string"==typeof n?n:ol,h="string"==typeof o?o:il,g=r(()=>{if(!s&&!l)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[ol]=n(t)),i&&(r[il]=o(t)),r}):t},[t,s,l,n,o]),[f,p]=d(null),[y,m]=d([]),v=i(s),b=i(l);return a(()=>{if(!s&&!l)return void((v.current||b.current)&&(p(null),m([]),v.current=s,b.current=l));let e=!1;const t=s!==v.current||l!==b.current;if(v.current=s,b.current=l,t&&(p(null),m([])),s){const t=c&&"string"==typeof c&&"object"==typeof s?Object.assign(Object.assign({},s),{_groupBy:c}):s;(function(...e){return Js(this,void 0,void 0,function*(){return(yield nl()).buildForecast(...e)})})(g,u,h,t,l).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else l&&function(...e){return Js(this,void 0,void 0,function*(){return(yield nl()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[g,s,l,u,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:u,yAccessorKey:h}}const al=g(function(t,n){var o,s;const c=i(null);Qs(n,{variant:"xy",frameRef:c});const u=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:w="coordinates",colorBy:k,colorScheme:A,curve:S="linear",showPoints:C=!1,pointRadius:O=3,fillArea:_=!1,areaOpacity:j=.3,lineWidth:P=2,lineGradient:M,tooltip:L,pointIdAccessor:T,annotations:$,directLabel:N,gapStrategy:D="break",anomaly:B,forecast:I,band:R,xExtent:F,yExtent:E,frameProps:H={},selection:z,linkedHover:W,onObservation:G,onClick:Y,hoverHighlight:q,hoverRadius:V,chartId:X,loading:U,loadingContent:K,emptyContent:Q,legendInteraction:Z,legendPosition:J,xScaleType:ee,yScaleType:te,color:ne,stroke:oe,strokeWidth:ie,opacity:re}=t,{width:ae,height:se,enableHover:le,showGrid:ce,showLegend:ue,title:de,description:he,summary:ge,accessibleTable:fe,xLabel:pe,yLabel:ye}=u,me=r(()=>ke(h),[h]);Fs("LineChart",me,"xAccessor",v),Fs("LineChart",me,"yAccessor",b);const{effectiveData:ve,statisticalAnnotations:be}=rl({data:me,xAccessor:v,yAccessor:b,forecast:I,anomaly:B,groupBy:x}),xe="__compoundGroup",we=!(!I||!x),Ae=we?xe:I?el:x,Se=r(()=>{if(!we)return ve;const e="function"==typeof x?x:e=>e[x];return ve.map(t=>{const n=Object.assign({},t);return n[xe]=`${e(t)}__${t[el]||"observed"}`,n})},[ve,we,x]),Ce=we?Se:ve,Oe=k||x,_e=r(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=ve;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[I,ve,b]),je=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Pe=void 0!==(null===(o=Ce[0])||void 0===o?void 0:o[w]),Me=r(()=>{if(Pe)return Ce;if(Ae){const e=Ce.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[w]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[el]=t[el],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][w].push(t),e},{});return Object.values(e)}return[{[w]:Ce}]},[Ce,Ae,w,Pe]),{gapProcessedLineData:Le,hasGaps:Te}=r(()=>{if("interpolate"===D){let e=!1;const t=[];for(const n of Me){const o=(n[w]||[]).filter(t=>!je(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===D){let e=!1;const t=[];for(const n of Me){const o=n[w]||[];let i=[],r=0;const a=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const s of o)if(je(s))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[w]:i})),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[w]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===D){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Me){const i=o[w]||[],r=[];for(const n of i)je(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[w]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,D,w,je,Ae,b]),$e="object"==typeof N?N:{},Ne=$e.position||"end",De=$e.fontSize||11,Be=r(()=>{var e;if(!N||!Oe)return[];const t="function"==typeof Oe?Oe:e=>e[Oe],n=new Set;for(const o of Le){const i=o[w]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Ne?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const a=r+"";""!==a&&n.add(a)}return Array.from(n)},[N,Oe,Le,w,Ne]),Ie=r(()=>{if(!N)return u.marginDefaults;const e=Be.reduce((e,t)=>Math.max(e,t.length*(.6*De)),0),t=e+10,n="end"===Ne?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[n]:Math.max(u.marginDefaults[n]||0,t)})},[N,Be,De,Ne,u.marginDefaults]),Re=Xs({data:ve,rawData:h,colorBy:Oe,colorScheme:A,legendInteraction:Z,legendPosition:J,selection:z,linkedHover:W,fallbackFields:Oe?["string"==typeof Oe?Oe:""]:[],unwrapData:!1,onObservation:G,onClick:Y,hoverHighlight:q,chartType:"LineChart",chartId:X,showLegend:(!N||void 0!==ue)&&ue,userMargin:g,marginDefaults:Ie,loading:U,loadingContent:K,emptyContent:Q,width:ae,height:se}),Fe=Re.colorScale,Ee=Re.customHoverBehavior,He=Re.customClickBehavior,ze=Re.crosshairProps,We=Ks({lineWidth:P,colorBy:Oe,colorScale:Fe,color:ne,fillArea:_,areaOpacity:j,stroke:oe,strokeWidth:ie,opacity:re,effectiveSelectionHook:Re.effectiveSelectionHook,resolvedSelection:Re.resolvedSelection}),[Ge,Ye]=d(null);a(()=>{if(!I)return void Ye(null);let e=!1;return function(...e){return Js(this,void 0,void 0,function*(){return(yield nl()).createSegmentLineStyle(...e)})}(We,I).then(t=>{e||Ye(()=>t)}).catch(()=>{e||Ye(null)}),()=>{e=!0}},[We,I]);const qe=Ge||We,Ve=r(()=>{if(C)return e=>{const t={r:O,fillOpacity:1};return Oe?Fe&&(t.fill=jt(e.parentLine||e,Oe,Fe)):t.fill=ne||ls,t}},[C,O,Oe,Fe,ne]),Xe=Array.isArray(_)?"mixed":_?"area":"line",Ue=r(()=>{var e;if(!N||!Oe)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Oe?Oe:e=>e[Oe],i=new Map;for(const t of Le){const n=t[w]||[];if(0===n.length)continue;const r="end"===Ne?n[n.length-1]:n[0],a=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==a)continue;const s=a+"";""===s||i.has(s)||i.set(s,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Ne?6:-6,dy:0,color:Fe?Fe(e):ls,fontSize:De}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];De+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=De+2)}return r},[N,Oe,Fe,Le,w,v,b,Ne,De]),Ke=Re.margin,Qe=x||k,Ze=r(()=>js([{label:pe||As(v),accessor:v,role:"x",format:p},{label:ye||As(b),accessor:b,role:"y",format:y},...Qe?[{label:As(Qe),accessor:Qe,role:"group"}]:[],..._s(R,y)]),[v,b,pe,ye,Qe,p,y,R]),Je=Gs({componentName:"LineChart",data:Pe?(null===(s=ve[0])||void 0===s?void 0:s[w])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),et=r(()=>Pe||Ae||Te?Le.flatMap(e=>{const t=e[w]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Ce,[Le,w,Pe,Ae,Ce,Te]),tt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Xe},Array.isArray(_)&&{areaGroups:_}),M&&{lineGradient:M}),null!=V&&{hoverRadius:V}),null!=h&&{data:et}),{xAccessor:v,yAccessor:b,xScaleType:ee,yScaleType:te}),F&&{xExtent:F}),!E||null==E[0]&&null==E[1]?_e?{yExtent:_e}:{}:{yExtent:E}),{groupAccessor:"break"===D&&Te?"_gapSegment":Ae||void 0}),R&&{band:R}),{curve:S,lineStyle:qe}),C&&{pointStyle:Ve}),{size:[ae,se],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Ke,showAxes:u.showAxes,xLabel:pe,yLabel:ye,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{enableHover:le,showGrid:ce}),Re.legendBehaviorProps),de&&{title:de}),he&&{description:he}),ge&&{summary:ge}),void 0!==fe&&{accessibleTable:fe}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?Tr():$r(L)||Ze}),"multi"===L&&{tooltipMode:"multi"}),(W||G||Y||q)&&{customHoverBehavior:Ee}),(G||Y||W)&&{customClickBehavior:He}),T&&{pointIdAccessor:T}),((null==$?void 0:$.length)||be.length||Ue.length)&&{annotations:[...$||[],...be,...Ue]}),ze),H);return Re.earlyReturn?Re.earlyReturn:Je?e(Ms,{componentName:"LineChart",message:Je,width:ae,height:se}):e(Ns,{componentName:"LineChart",width:ae,height:se,children:e(ka,Object.assign({ref:c},tt))})});function sl(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function ll(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:a,linkedHoverInClickPredicate:s=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(s?n||o||t:n||o)&&(l.customClickBehavior=a),l}function cl(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:$r(t)||n}}function ul(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:a,colorBy:s,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:w,xLabel:k,yLabel:A,xFormat:S,yFormat:C,groupField:O}=e,_=void 0!==(null===(t=n[0])||void 0===t?void 0:t[a]),j=r(()=>{if(null==o)return[];if(!_&&!i)return n;let e;if(_)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[a]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][a].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[a]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,a,_]),P=r(()=>e=>{const t={};if(s){if(l){const n=jt(e,s,l);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||ls;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[s,l,c,p,y,m]),M=r(()=>Us(P,{stroke:u,strokeWidth:d,opacity:h}),[P,u,d,h]);return{flattenedData:j,lineStyle:r(()=>Za(M,null!=g?g:null,f),[M,g,f]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return s?l&&(t.fill=jt(e.parentLine||e,s,l)):t.fill=c||ls,t}},[v,b,s,l,c]),defaultTooltipContent:r(()=>js([{label:k||As(x),accessor:x,role:"x",format:S},{label:A||As(w),accessor:w,role:"y",format:C},...O?[{label:As(O),accessor:O,role:"group"}]:[],..._s(e.band,C)]),[x,w,k,A,O,S,C,e.band])}}function dl(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}al.displayName="LineChart";const hl=g(function(t,n){const o=i(null);Qs(n,{variant:"xy",frameRef:o});const a=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:w="monotoneX",areaOpacity:k=.7,lineGradient:A,showLine:S=!0,lineWidth:C=2,showPoints:O=!1,pointRadius:_=3,tooltip:j,annotations:P,forecast:M,anomaly:L,band:T,xExtent:$,yExtent:N,frameProps:D={},selection:B,linkedHover:I,onObservation:R,onClick:F,hoverHighlight:E,chartId:H,loading:z,loadingContent:W,emptyContent:G,legendInteraction:Y,legendPosition:q,color:V,stroke:X,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:ae,yLabel:se}=a,le=r(()=>ke(s),[s]),ce=b||f,ue=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:dl(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Fs("AreaChart",le,"xAccessor",h),Fs("AreaChart",le,"yAccessor",g);const de=Xs({data:le,rawData:s,colorBy:ce,colorScheme:x,legendInteraction:Y,legendPosition:q,selection:B,linkedHover:I,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:R,onClick:F,hoverHighlight:E,chartType:"AreaChart",chartId:H,showLegend:te,userMargin:l,marginDefaults:a.marginDefaults,loading:z,loadingContent:W,emptyContent:G,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=rl({data:le,xAccessor:h,yAccessor:g,forecast:M,anomaly:L,groupBy:f}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=ul({safeData:he,data:s,areaBy:f,lineDataAccessor:v,colorBy:ce,colorScale:de.colorScale,color:V,stroke:X,strokeWidth:U,opacity:K,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:k,showLine:S,lineWidth:C,showPoints:O,pointRadius:_,xAccessor:h,yAccessor:g,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,groupField:f||b,band:T}),ve=Gs({componentName:"AreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),T&&{band:T}),ue&&{gradientFill:ue}),A&&{lineGradient:A}),{curve:w,lineStyle:pe}),O&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de.margin,showAxes:a.showAxes,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,enableHover:J}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),sl({title:ne,description:oe,summary:ie,accessibleTable:re,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===j?{tooltipContent:Tr(),tooltipMode:"multi"}:cl({tooltip:j,defaultTooltipContent:me})),ll({linkedHover:I,onObservation:R,onClick:F,hoverHighlight:E,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(P&&P.length>0||ge.length>0)&&{annotations:[...P||[],...ge]}),$&&{xExtent:$}),N&&{yExtent:N}),de.crosshairProps),D);return de.earlyReturn?de.earlyReturn:ve?e(Ms,{componentName:"AreaChart",message:ve,width:Q,height:Z}):e(Ns,{componentName:"AreaChart",width:Q,height:Z,children:e(ka,Object.assign({ref:o},be))})});function gl(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}hl.displayName="AreaChart";const fl=g(function(n,o){const a=i(null),s=ws(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:w="var(--semiotic-danger, #dc2626)",seriesBColor:k="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:C=!1,pointRadius:O=3,curve:_="linear",areaOpacity:j=.6,gradientFill:P,tooltip:M,annotations:L,xExtent:T,yExtent:$,frameProps:N={},selection:D,linkedHover:B,onObservation:I,onClick:R,hoverHighlight:F,chartId:E,loading:H,loadingContent:z,emptyContent:W,legendInteraction:G,legendPosition:Y,pointIdAccessor:q,windowSize:V}=n,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>"function"==typeof y?e=>gl(y(e)):e=>gl(e[y]),[y]),ae=r(()=>"function"==typeof m?e=>gl(m(e)):e=>gl(e[m]),[m]),se=r(()=>"function"==typeof v?e=>gl(v(e)):e=>gl(e[v]),[v]),[le,ce]=d([]),ue=i([]),de=null==c,he=r(()=>ke(de?le:c),[de,le,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let a=0,s=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=n(r),y=o(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=s){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-l.a-(y-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(f-l.x),t=l.a+o*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],s)}else for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{s=m;for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=s?s:"A");return r}(he,re,ae,se),[he,re,ae,se]),fe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),a=n(e),s=o(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(he,re,ae,se):[],[A,he,re,ae,se]),pe=r(()=>[...ge,...fe],[ge,fe]),ye=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=V&&e.length>V?e.slice(e.length-V):e;ue.current=t,ce(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...ue.current,t]),pushMany:t=>e([...ue.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of ue.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],a=ue.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>de?ue.current:he,getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[de,he,q,V]);const me=Xs({data:he,rawData:c,colorBy:"__diffWinner",colorScheme:[w,k],legendInteraction:G,legendPosition:Y,selection:D,linkedHover:B,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:I,onClick:R,hoverHighlight:F,chartType:"DifferenceChart",chartId:E,showLegend:Z,userMargin:u,marginDefaults:s.marginDefaults,loading:H,loadingContent:z,emptyContent:W,width:X,height:U}),ve=r(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:w},{label:x,color:k}]}]}},[Z,b,x,w,k]),be=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?w:k,stroke:"none",fillOpacity:j}},[w,k,j]),xe=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?w:k,strokeWidth:S,fill:"none"}),[w,k,S]),we=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?w:k,r:O}),[w,k,O]),Ae=l(n=>{var o;const i=n.data,r=n.allSeries,a=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let s=null==i?void 0:i.__valA,l=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(l=t.value)}if(null!=a&&(null==s||null==l)){const e=he.find(e=>re(e)===a);e&&(null==s&&(s=ae(e)),null==l&&(l=se(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=g&&null!=a?g(a):null!=a?a+"":"";return t("div",{className:"semiotic-tooltip",style:_r,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(s)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(l)]})]}),null!=s&&null!=l&&Number.isFinite(s)&&Number.isFinite(l)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(s-l)]})]})},[he,re,ae,se,g,w,k,b,x]),Se="multi"===M,Ce=r(()=>!1===M?()=>null:Se?Ae:$r(M)||Ae,[M,Se,Ae]);if(me.earlyReturn)return me.earlyReturn;const Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:pe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ye,curve:_,areaStyle:be,lineStyle:xe},C&&{pointStyle:we}),{size:[X,U],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:g,yFormat:f,enableHover:K,showGrid:Q}),P&&{gradientFill:!0===P?{topOpacity:.85,bottomOpacity:.15}:P}),ve&&{legend:ve,legendPosition:me.legendPosition}),sl({title:J,description:ee,summary:te,accessibleTable:ne,className:h,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:Ce}),Se&&{tooltipMode:"multi"}),ll({linkedHover:B,onObservation:I,onClick:R,hoverHighlight:F,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),$&&{yExtent:$}),me.crosshairProps),N);return e(Ns,{componentName:"DifferenceChart",width:X,height:U,children:e(ka,Object.assign({ref:a},Oe))})});"function"==typeof fl&&(fl.displayName="DifferenceChart");const pl=g(function(t,n){const o=i(null),a=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:w=2,showPoints:k=!1,pointRadius:A=3,normalize:S=!1,baseline:C="zero",stackOrder:O,tooltip:_,annotations:j,xExtent:P,yExtent:M,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:D,hoverHighlight:B,chartId:I,loading:R,loadingContent:F,emptyContent:E,legendInteraction:H,legendPosition:z,color:W,stroke:G,strokeWidth:Y,opacity:q}=t,{width:V,height:X,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=a,ie=r(()=>ke(s),[s]),re=y||f;Qs(n,{variant:"xy",frameRef:o});const ae=Xs({data:ie,rawData:s,colorBy:re,colorScheme:m,legendInteraction:H,legendPosition:z,selection:T,linkedHover:$,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:N,onClick:D,hoverHighlight:B,chartType:"StackedAreaChart",chartId:I,showLegend:Q,userMargin:l,marginDefaults:a.marginDefaults,loading:R,loadingContent:F,emptyContent:E,width:V,height:X}),{flattenedData:se,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=ul({safeData:ie,data:s,areaBy:f,lineDataAccessor:p,colorBy:re,colorScale:ae.colorScale,color:W,stroke:G,strokeWidth:Y,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:w,showPoints:k,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,groupField:f||y}),de=Gs({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=s&&{data:se}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:v,normalize:S,baseline:S?"zero":C,stackOrder:O,lineStyle:le}),k&&ce&&{pointStyle:ce}),{size:[V,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:a.showAxes,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),ae.legendBehaviorProps),sl({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===_?{tooltipContent:Tr(),tooltipMode:"multi"}:cl({tooltip:_,defaultTooltipContent:ue})),ll({linkedHover:$,onObservation:N,onClick:D,hoverHighlight:B,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),j&&j.length>0&&{annotations:j}),P&&{xExtent:P}),M&&{yExtent:M}),ae.crosshairProps),L);return ae.earlyReturn?ae.earlyReturn:de?e(Ms,{componentName:"StackedAreaChart",message:de,width:V,height:X}):e(Ns,{componentName:"StackedAreaChart",width:V,height:X,children:e(ka,Object.assign({ref:o},he))})});function yl(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=jt(o,t,n)}}else u.fill=l?l(e):o||ls;return void 0===u.r&&(u.r=a?a(e):i),u},[t,n,o,i,a,s,l,c,p]),m=r(()=>Us(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>Za(m,null!=g?g:null,f),[m,g,f])}function ml(e){const{accessor:t,data:n,isPushMode:o}=e,a=i(null),[s,c]=d(0),u=l(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(a.current?(a.current[0]>i&&(a.current[0]=i,n=!0),i>a.current[1]&&(a.current[1]=i,n=!0)):(a.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=l(()=>{o&&(a.current=null,c(e=>e+1))},[o]),g=r(()=>{var e;if(o)return null!==(e=a.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,s=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>s&&(s=n))}return Number.isFinite(r)&&Number.isFinite(s)?[r,s]:void 0},[n,t,o,s]);return{domain:g,trackPushed:u,reset:h}}function vl(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}pl.displayName="StackedAreaChart";const bl=g(function(t,n){const a=i(null),s=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:w=[3,15],symbolBy:k,symbolMap:A,pointRadius:S=5,pointOpacity:C=.8,tooltip:O,marginalGraphics:_,pointIdAccessor:j,annotations:P,regression:M,forecast:L,anomaly:T,xExtent:$,yExtent:N,frameProps:D={},selection:B,linkedHover:I,linkedBrush:R,onObservation:F,onClick:E,hoverHighlight:H,chartId:z,loading:W,loadingContent:G,emptyContent:Y,legendInteraction:q,legendPosition:V,color:X,stroke:U,strokeWidth:K,opacity:Q}=t,{width:Z,height:J,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:ae,xLabel:se,yLabel:le}=s,ce=r(()=>ke(c),[c]),ue=void 0===c,{domain:de,trackPushed:he,reset:ge}=ml({accessor:x,data:ce,isPushMode:ue}),fe=l(e=>{var t;he([e]),null===(t=a.current)||void 0===t||t.push(e)},[he]),pe=l(e=>{var t;he(e),null===(t=a.current)||void 0===t||t.pushMany(e)},[he]);Qs(n,{variant:"xy",frameRef:a,overrides:{push:fe,pushMany:pe,clear:()=>{var e;ge(),null===(e=a.current)||void 0===e||e.clear()}},deps:[fe,pe,ge]});const ye=Xs({data:ce,rawData:c,colorBy:v,colorScheme:b,legendInteraction:q,legendPosition:V,selection:B,linkedHover:I,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:F,onClick:E,hoverHighlight:H,chartType:"Scatterplot",chartId:z,showLegend:ne,userMargin:u,marginDefaults:s.marginDefaults,loading:W,loadingContent:G,emptyContent:Y,width:Z,height:J}),me=Qa(R),ve=Ia({name:(null==me?void 0:me.name)||"__unused_brush__",xField:(null==me?void 0:me.xField)||("string"==typeof f?f:void 0),yField:(null==me?void 0:me.yField)||("string"==typeof p?p:void 0)}),be=me?"xyBrush"===ve.brushInteraction.brush?"xy":"xBrush"===ve.brushInteraction.brush?"x":"y":void 0,xe=o.useRef(ve.brushInteraction);xe.current=ve.brushInteraction;const we=l(e=>{const t=xe.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Fs("Scatterplot",ce,"xAccessor",f),Fs("Scatterplot",ce,"yAccessor",p);const Ae=r(()=>x?null!=de?de:[0,1]:void 0,[x,de]),Se=r(()=>x?e=>Mt(e,x,w,Ae):void 0,[x,w,Ae]),Ce=yl({colorBy:v,colorScale:ye.colorScale,color:X,pointRadius:S,fillOpacity:C,radiusFn:Se,stroke:U,strokeWidth:K,opacity:Q,effectiveSelectionHook:ye.effectiveSelectionHook,resolvedSelection:ye.resolvedSelection}),Oe=r(()=>js([{label:se||As(f),accessor:f,role:"x",format:h},{label:le||As(p),accessor:p,role:"y",format:g},...v?[{label:As(v),accessor:v,role:"color"}]:[],...x?[{label:As(x),accessor:x,role:"size"}]:[]]),[f,p,se,le,v,x,h,g]),{effectiveData:_e,statisticalAnnotations:je}=rl({data:ce,xAccessor:f,yAccessor:p,forecast:L,anomaly:T}),Pe=r(()=>{const e=vl(M);return e||0!==je.length?[...e?[e]:[],...P||[],...je]:P},[M,P,je]);if(ye.earlyReturn)return ye.earlyReturn;const Me=Gs({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(Me)return e(Ms,{componentName:"Scatterplot",message:Me,width:Z,height:J});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:_e}),{xAccessor:f,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0}),k&&{symbolAccessor:k}),A&&{symbolMap:A}),{sizeRange:w,pointStyle:Ce,colorScheme:b,size:[Z,J],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ye.margin,showAxes:s.showAxes,xLabel:se,yLabel:le,xFormat:h,yFormat:g,enableHover:ee,showGrid:te}),ye.legendBehaviorProps),sl({title:oe,description:ie,summary:re,accessibleTable:ae,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:O,defaultTooltipContent:Oe})),ll({linkedHover:I,onObservation:F,onClick:E,hoverHighlight:H,customHoverBehavior:ye.customHoverBehavior,customClickBehavior:ye.customClickBehavior})),_&&{marginalGraphics:_}),j&&{pointIdAccessor:j}),Pe&&Pe.length>0&&{annotations:Pe}),$&&{xExtent:$}),N&&{yExtent:N}),me&&{brush:{dimension:be},onBrush:we}),ye.crosshairProps),D);return e(Ns,{componentName:"Scatterplot",width:Z,height:J,children:e(ka,Object.assign({ref:a},Le))})});function xl(e,t){return lt(1===t?.5:e/(t-1))}bl.displayName="Scatterplot";const wl=g(function(t,o){var a,s;const l=i(null);Qs(o,{variant:"xy",frameRef:l});const c=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:w,annotations:k,regression:A,forecast:S,anomaly:C,xExtent:O,yExtent:_,frameProps:j={},selection:P,linkedHover:M,onObservation:L,onClick:T,hoverHighlight:$,chartId:N,loading:D,loadingContent:B,emptyContent:I,legendInteraction:R,stroke:F,strokeWidth:E,opacity:H}=t,{width:z,height:W,enableHover:G,showGrid:Y,title:q,description:V,summary:X,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);Fs("ConnectedScatterplot",J,"xAccessor",p),Fs("ConnectedScatterplot",J,"yAccessor",y);const te=Xs({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:R,selection:P,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:$,chartType:"ConnectedScatterplot",chartId:N,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:D,loadingContent:B,emptyContent:I,width:z,height:W}),ne=null!==(s=null===(a=te.resolvedSelection)||void 0===a?void 0:a.unselectedOpacity)&&void 0!==s?s:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const a=t.filter(e=>"point"===e.type);if(2>a.length)return;const s=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,l=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>a.length,u=a.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=a[t],o=a[t+1],d=xl(t,u),h=!s||!l||l(null!==(i=n.datum)&&void 0!==i?i:n)||l(null!==(r=o.datum)&&void 0!==r?r:o),g=s?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,a;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const l=s.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const n=s[t],o=s[t+1],i=xl(t,l),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(a=o.style)||void 0===a?void 0:a.opacity)?o.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:u})},[b]),ae=r(()=>[re],[re]),se=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?xl(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),le=yl({colorScale:void 0,baseStyleExtras:se,stroke:F,strokeWidth:E,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>js([{label:K||As(p),accessor:p,role:"x",format:g},{label:Q||As(y),accessor:y,role:"y",format:f},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,g,f]),de=Gs({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:ge}=rl({data:J,xAccessor:p,yAccessor:y,forecast:S,anomaly:C});if(te.earlyReturn)return te.earlyReturn;const fe=vl(A),pe=fe||ge.length>0?[...fe?[fe]:[],...k||[],...ge]:k,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:le,size:[z,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:G,showGrid:Y}),sl({title:q,description:V,summary:X,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:x,defaultTooltipContent:ue})),ll({linkedHover:M,onObservation:L,onClick:T,hoverHighlight:$,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),w&&{pointIdAccessor:w}),{canvasPreRenderers:ie,svgPreRenderers:ae}),pe&&pe.length>0&&{annotations:pe}),O&&{xExtent:O}),_&&{yExtent:_}),te.crosshairProps),j);return de?e(Ms,{componentName:"ConnectedScatterplot",message:de,width:z,height:W}):e(Ns,{componentName:"ConnectedScatterplot",width:z,height:W,children:e(ka,Object.assign({ref:l},ye))})});wl.displayName="ConnectedScatterplot";const kl=g(function(t,n){const o=i(null),a=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:w="white",tooltip:k,marginalGraphics:A,pointIdAccessor:S,annotations:C,regression:O,xExtent:_,yExtent:j,frameProps:P={},selection:M,linkedHover:L,linkedBrush:T,onObservation:$,onClick:N,hoverHighlight:D,chartId:B,loading:I,loadingContent:R,emptyContent:F,legendInteraction:E,legendPosition:H,color:z,stroke:W,strokeWidth:G,opacity:Y}=t,{width:q,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=a,oe=r(()=>ke(s),[s]),ie=void 0===s,re=Xs({data:oe,rawData:s,colorBy:m,colorScheme:v,legendInteraction:E,legendPosition:H,selection:M,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:D,chartType:"BubbleChart",chartId:B,showLegend:K,userMargin:c,marginDefaults:a.marginDefaults,loading:I,loadingContent:R,emptyContent:F,width:q,height:V}),{domain:ae,trackPushed:se,reset:le}=ml({accessor:p,data:oe,isPushMode:ie}),ce=l(e=>{var t;se([e]),null===(t=o.current)||void 0===t||t.push(e)},[se]),ue=l(e=>{var t;se(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[se]);Qs(n,{variant:"xy",frameRef:o,overrides:{push:ce,pushMany:ue,clear:()=>{var e;le(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ce,ue,le]});const de=Qa(T);Ia({name:(null==de?void 0:de.name)||"__unused_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof g?g:void 0),yField:(null==de?void 0:de.yField)||("string"==typeof f?f:void 0)});const he=r(()=>({stroke:w,strokeWidth:x}),[w,x]),ge=r(()=>null!=ae?ae:[0,1],[ae]),fe=l(e=>Mt(e,p,y,ge),[p,y,ge]),pe=yl({colorBy:m,colorScale:re.colorScale,color:z,fillOpacity:b,radiusFn:fe,baseStyleExtras:he,stroke:W,strokeWidth:G,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ye=r(()=>js([{label:te||As(g),accessor:g,role:"x",format:d},{label:ne||As(f),accessor:f,role:"y",format:h},{label:As(p),accessor:p,role:"size"},...m?[{label:As(m),accessor:m,role:"color"}]:[]]),[g,f,te,ne,p,m,d,h]);if(re.earlyReturn)return re.earlyReturn;const me=Gs({componentName:"BubbleChart",data:s,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(me)return e(Ms,{componentName:"BubbleChart",message:me,width:q,height:V});const ve=vl(O),be=ve?[ve,...C||[]]:C,xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:oe}),{xAccessor:g,yAccessor:f,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:pe,colorScheme:v,size:[q,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:d,yFormat:h,enableHover:X,showGrid:U}),re.legendBehaviorProps),sl({title:Q,description:Z,summary:J,accessibleTable:ee,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:k,defaultTooltipContent:ye})),ll({linkedHover:L,onObservation:$,onClick:N,hoverHighlight:D,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),be&&be.length>0&&{annotations:be}),_&&{xExtent:_}),j&&{yExtent:j}),re.crosshairProps),P);return e(Ns,{componentName:"BubbleChart",width:q,height:V,children:e(ka,Object.assign({ref:o},xe))})});kl.displayName="BubbleChart";const Al=g(function(t,n){var o;const a=i(null);Qs(n,{variant:"xy",frameRef:a});const s=ws(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:k,yExtent:A,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,loading:T,loadingContent:$,emptyContent:N,showLegend:D,legendPosition:B,legendInteraction:I}=t,{width:R,height:F,enableHover:E,title:H,description:z,summary:W,accessibleTable:G,xLabel:Y,yLabel:q}=s,V=Rs(T,R,F,$),X=V?null:Is(l,R,F,N),U=r(()=>ke(l),[l]),K=function(){var e;const t=ss();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Q=null!==(o=null!=y?y:K)&&void 0!==o?o:"blues",Z=null!=D&&D,J=null!=B?B:"right",{margin:ee}=vs({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:s.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=ys({selection:O,linkedHover:_,fallbackFields:[],onObservation:j,onClick:P,chartType:"Heatmap",chartId:L,hoverHighlight:M,colorByField:void 0});Vs(O);const ie=ms(_,oe);bs(I,void 0,[]);const re=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ae=r(()=>uo(U.map(re)),[U,re]),se=r(()=>{if("custom"===Q&&m)return m;const e=pt(Q);return S(e).domain(ae)},[Q,m,ae]),le=r(()=>js([{label:Y||As(d),accessor:d,role:"x",format:f},{label:q||As(h),accessor:h,role:"y",format:p},{label:As(g),accessor:g,role:"value",format:b}]),[d,h,Y,q,g,f,p,b]),ce=Gs({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ue=r(()=>{if(Z)return{gradient:{colorFn:e=>se(e),domain:ae,label:"string"==typeof g?g:"value",format:b}}},[Z,se,ae,g,b]),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==Q?Q:void 0,showValues:v,heatmapValueFormat:b,size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,showAxes:s.showAxes,xLabel:Y,yLabel:q,xFormat:f,yFormat:p,enableHover:E}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ue&&{legend:ue,legendPosition:J}),sl({title:H,description:z,summary:W,accessibleTable:G,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:x,defaultTooltipContent:le})),ll({linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,customHoverBehavior:te,customClickBehavior:ne})),w&&w.length>0&&{annotations:w}),k&&{xExtent:k}),A&&{yExtent:A}),ie),C);return V||X||(ce?e(Ms,{componentName:"Heatmap",message:ce,width:R,height:F}):e(Ns,{componentName:"Heatmap",width:R,height:F,children:e(ka,Object.assign({ref:a},de))}))});Al.displayName="Heatmap";const Sl="__splomIdx",Cl={top:4,bottom:4,left:4,right:4};function Ol({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),s=n-Cl.left-Cl.right,l=n-Cl.top-Cl.bottom;return a(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,a],[s,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(a)],[i.x.invert(s),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[s,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${Cl.left},${Cl.top})`})})}function _l({data:n,xField:o,yField:r,cellSize:a,pointRadius:s,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const m=i(null),v=Na({name:h,clientId:`splom-${o}-${r}`}),b=Ia({name:h,xField:o,yField:r}),x=Na({name:g,clientId:"splom-hover-source"}),w=x.selectPoints,k=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Sl];void 0!==n&&(w({[Sl]:[n]}),null==y||y(t,e.x+Cl.left,e.y+Cl.top))},[w,y]),S=l(e=>{const t={opacity:c,r:s};return t.fill=u?jt(e,u,d):ls,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=f),t},[u,d,c,s,p,v.isActive,v.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:a,height:a},children:[e(ka,{ref:m,chartType:"scatter",data:n,size:[a,a],xAccessor:o,yAccessor:r,pointStyle:S,margin:Cl,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ol,{frameRef:m,cellSize:a,xField:o,yField:r,onBrush:k})]})}function jl({data:n,field:o,label:i,cellSize:a,bins:s,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Na({name:u,clientId:"splom-diag-"+o}),f=Na({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?f:g,y=p.isActive,m=p.predicate,v=r(()=>{const e="string"==typeof l?l:null,t=[],i=new Set;for(const r of n){const n=r[o];if(null==n||isNaN(n)||t.push(Number(n)),e){const t=r[e];null!=t&&i.add(t+"")}}if(0===t.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[r,c]=uo(t),u=(c-r)/s||1,d=Array.from(i),h=new Map(d.map((e,t)=>[e,t])),g=Array(s).fill(0),f=Array(s).fill(0),p=Array.from({length:s},()=>Array(d.length).fill(0)),v=Array.from({length:s},()=>Array(d.length).fill(0));for(const t of n){const n=t[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-r)/u),s-1);if(g[i]++,y&&!m(t)||f[i]++,e){const n=h.get(t[e]+"");void 0!==n&&(p[i][n]++,y&&!m(t)||v[i][n]++)}}const b=ho(g,1),x=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:d[o]};return n+=i,r})}),w=v.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:d[o]};return n+=i,r})});return{bars:g.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/b*(a-24),count:e})),selectedBars:f.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/b*(a-24),count:e})),categoryBars:x,selectedCategoryBars:w,max:b,categories:d}},[n,o,s,a,y,m,l]);return t("svg",{width:a,height:a,style:{overflow:"hidden"},children:[e("text",{x:a/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ls,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:ls,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ls,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:ls,opacity:.7},"sel-"+n)))]})}function Pl({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Ml(n){const{data:i,fields:a,fieldLabels:s={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:w=!1,tooltip:k,showLegend:A,idAccessor:S,className:C,onObservation:O,chartId:_}=n,j="splom",P="splom-hover",M=b?"hover":v?"brush":"hover",L=La(e=>e.clearSelection),[T,$]=d(null),N=l(()=>{L(P),$(null)},[L,P]),D=r(()=>(i||[]).map((e,t)=>void 0!==e[Sl]?e:Object.assign(Object.assign({},e),{[Sl]:t})),[i]),B=fs(D,c,u),I=void 0!==A?A:!!c,R=r(()=>{if(!I||!c)return null;const e="string"==typeof c?c:null;return e?Array.from(new Set(D.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:B?B(e+""):ls})):null},[I,c,D,B]),F=r(()=>({display:"grid",gridTemplateColumns:"40px "+a.map(()=>h+"px").join(" "),gridTemplateRows:a.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[a,h,g,40]);return t("div",{className:C,style:{position:"relative"},children:[R&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:R.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:F,onMouseLeave:"hover"===M?N:void 0,children:[a.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:s[n]||n}),a.map((t,o)=>i===o?"label"===y?e(Pl,{label:s[n]||n,cellSize:h},"diag-"+n):e(jl,{data:D,field:n,label:s[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:B,brushSelectionName:j,hoverSelectionName:P,unselectedOpacity:x,mode:M},"diag-"+n):e(_l,{data:D,xField:t,yField:n,fieldLabels:s,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:B,brushSelectionName:j,hoverSelectionName:P,unselectedOpacity:x,showGrid:w,tooltip:k,mode:M,onPointHover:"hover"===M?(e,r,a)=>{e?($({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=a?a:0}),O&&O({type:"hover",datum:e,x:null!=r?r:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:_})):($(null),O&&O({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:_}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",a.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t},"col-label-"+t))]}),T&&"hover"===M&&(()=>{const n=T.datum,o=s[T.xField]||T.xField,i=s[T.yField]||T.yField,r=c?"function"==typeof c?c(n):n[c]:null,a=S?"function"==typeof S?S(n):n[S]:"Row "+n[Sl];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),t("div",{children:[o,": ",null!=n[T.xField]?Number(n[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[T.yField]?Number(n[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function Ll(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(Ua,{selections:i,children:e(Ml,Object.assign({},t))})}function Tl({width:t,height:n,margin:o,scales:r,brushDirection:s,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+o.left+o.right,f=n+o.top+o.bottom;return a(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===s?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,s,c]),a(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===s?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,r,s]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function $l(n){var o,s;const{data:c,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:w,xAccessor:k="x",yAccessor:A="y",lineBy:S,lineDataAccessor:C="coordinates",colorBy:O,colorScheme:_,curve:j="linear",lineWidth:P=2,fillArea:M=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:$=3,enableHover:N=!0,showGrid:D=!1,showLegend:B,legendPosition:I,tooltip:R,minimap:F={},renderBefore:E=!1,onBrush:H,brushExtent:z,yExtent:W,frameProps:G={},loading:Y,loadingContent:q,emptyContent:V}=n,X=Rs(Y,u,h,q),U=X?null:Is(c,u,h,V),K=r(()=>ke(c),[c]),[Q,Z]=d(null),J=null!=z?z:Q,ee=l(e=>{z||Z(e),null==H||H(e)},[z,H]),te=i(null),[ne,oe]=d(null);a(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=te.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?oe(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ie=void 0!==(null===(o=K[0])||void 0===o?void 0:o[C]),re=r(()=>{if(ie)return K;if(S){const e=K.reduce((e,t)=>{const n="function"==typeof S?S(t):t[S];if(!e[n]){const t={[C]:[]};"string"==typeof S&&(t[S]=n),e[n]=t}return e[n][C].push(t),e},{});return Object.values(e)}return[{[C]:K}]},[K,S,C,ie]),ae=r(()=>ie||S?re.flatMap(e=>{const t=e[C]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):K,[re,C,ie,S,K]),se=fs(K,O,_),le=Ks({lineWidth:P,colorBy:O,colorScale:se,fillArea:M,areaOpacity:L}),ce=r(()=>{if(F.lineStyle)return F.lineStyle},[F.lineStyle]),ue=Ks({lineWidth:1,colorBy:O,colorScale:se}),de=null!=ce?ce:ue,he=r(()=>{if(T)return e=>{const t={r:$,fillOpacity:1};return t.fill=O?jt(e.parentLine||e,O,se):ls,t}},[T,$,O,se]),{legend:ge,margin:fe,legendPosition:pe}=vs({data:re,colorBy:O,colorScale:se,showLegend:B,legendPosition:I,userMargin:g}),ye=F.height||60,me=r(()=>{var e,t,n,o,i,r,a,s;return{top:null!==(t=null===(e=F.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=F.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=F.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:fe.left,right:null!==(s=null===(a=F.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:fe.right}},[F.margin,fe]),ve=F.brushDirection||"x",be=r(()=>js([{label:v||As(k),accessor:k,role:"x",format:x},{label:b||As(A),accessor:A,role:"y",format:w}]),[k,A,v,b,x,w]),xe=Gs({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:A}});if(xe)return e(Ms,{componentName:"MinimapChart",message:xe,width:u,height:h});const we=M?"area":"line",Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:we,data:ae,xAccessor:k,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:le},T&&{pointStyle:he}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:fe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:w,enableHover:N,showGrid:D}),ge&&{legend:ge,legendPosition:pe}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===R?()=>null:$r(R)||be}),J&&{xExtent:J}),W&&{yExtent:W}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),G),Se=Object.assign({chartType:we,data:ae,xAccessor:k,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:de,size:[u,ye+me.top+me.bottom],margin:me,showAxes:null!==(s=F.showAxes)&&void 0!==s&&s,background:F.background,enableHover:!1},W&&{yExtent:W}),Ce=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(ka,Object.assign({ref:te},Se)),e(Tl,{width:u-me.left-me.right,height:ye,margin:me,scales:ne,brushDirection:ve,extent:J,onBrush:ee})]},"minimap"),Oe=e("div",{style:{overflow:"hidden"},children:e(ka,Object.assign({},Ae))},"main");return X||U||e(Ns,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[E?Ce:Oe,E?Oe:Ce]})})}Ll.displayName="ScatterplotMatrix",$l.displayName="MinimapChart";const Nl={label:"Low / High",color:"#E9C46A",opacity:.08},Dl={label:"High / High",color:"#2A9D8F",opacity:.08},Bl={label:"Low / Low",color:"#E76F51",opacity:.08},Il={label:"High / Low",color:"#86BBD8",opacity:.08};function Rl(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const Fl=g(function(o,a){const s=i(null);Qs(a,{variant:"xy",frameRef:s});const l=ws(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:w=12,colorBy:k,colorScheme:A,sizeBy:S,sizeRange:C=[3,15],pointRadius:O=5,pointOpacity:_=.8,tooltip:j,pointIdAccessor:P,annotations:M,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:D,hoverHighlight:B,chartId:I,loading:R,loadingContent:F,emptyContent:E,legendInteraction:H,legendPosition:z,color:W,stroke:G,strokeWidth:Y,opacity:q}=o,{width:V,height:X,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=l,ie=r(()=>({topLeft:Rl(Nl,null==v?void 0:v.topLeft),topRight:Rl(Dl,null==v?void 0:v.topRight),bottomLeft:Rl(Bl,null==v?void 0:v.bottomLeft),bottomRight:Rl(Il,null==v?void 0:v.bottomRight)}),[v]),re=r(()=>ke(c),[c]),ae=Xs({data:re,rawData:c,colorBy:k,colorScheme:A,legendInteraction:H,legendPosition:z,selection:T,linkedHover:$,fallbackFields:"string"==typeof k?[k]:[],unwrapData:!1,onObservation:N,onClick:D,hoverHighlight:B,chartType:"QuadrantChart",chartId:I,showLegend:Q,userMargin:u,marginDefaults:l.marginDefaults,loading:R,loadingContent:F,emptyContent:E,width:V,height:X});Fs("QuadrantChart",re,"xAccessor",f),Fs("QuadrantChart",re,"yAccessor",p);const se=r(()=>{if(!re.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const a of re){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(r-i)||1;return{xExtent:[n-a,o+a],yExtent:[i-s,r+s]}},[re,f,p,y,m]),le=r(()=>{if(!S||0===re.length)return;const e=re.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?uo(e):void 0},[re,S]),ce=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ue=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=ce(e),n=ue(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?W||ls:i&&o?ie.topRight.color:i&&!o?ie.topLeft.color:!i&&o?ie.bottomRight.color:ie.bottomLeft.color},[ce,ue,y,m,ie,W]),he=r(()=>S?e=>Mt(e,S,C,le):void 0,[S,C,le]),ge=yl({colorBy:k,colorScale:ae.colorScale,color:W,pointRadius:O,fillOpacity:_,radiusFn:he,fallbackFill:de,stroke:G,strokeWidth:Y,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),fe=r(()=>{if(!re.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof S&&e.add(S);const t=re[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[re,f,p,k,S]),pe=r(()=>js([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ne||As(f),accessor:f,role:"x",format:h},{label:oe||As(p),accessor:p,role:"y",format:g},...k?[{label:As(k),accessor:k,role:"color"}]:[],...S?[{label:As(S),accessor:S,role:"size"}]:[]]),[fe,f,p,ne,oe,k,S,h,g]),ye=Gs({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),me=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=i.width,s=i.height,l=null!=y?o.x(y):a/2,c=null!=m?o.y(m):s/2;if(null!=y&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:ie.topLeft,x:0,y:0,w:u,h:d},{config:ie.topRight,x:u,y:0,w:a-u,h:d},{config:ie.bottomLeft,x:0,y:d,w:u,h:s-d},{config:ie.bottomRight,x:u,y:d,w:a-u,h:s-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[y,m,ie,b]),ve=r(()=>x?[...me,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,a=null!=y?n.x(y):i/2,s=null!=m?n.y(m):r/2;(null==y||isFinite(a))&&(null==m||isFinite(s))&&(e.font=`600 ${w}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ie.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ie.topLeft.label,8,8),e.fillStyle=ie.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ie.topRight.label,i-8,8),e.fillStyle=ie.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ie.bottomLeft.label,8,r-8),e.fillStyle=ie.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ie.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:me,[me,x,w,ie,y,m]),be=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),xe=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,a)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const s=a.width,l=a.height,c=null!=y?r.x(y):s/2,u=null!=m?r.y(m):l/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(s,c)),h=Math.max(0,Math.min(l,u));return t(n,{children:[[{config:ie.topLeft,x:0,y:0,w:d,h:h},{config:ie.topRight,x:d,y:0,w:s-d,h:h},{config:ie.bottomLeft,x:0,y:h,w:d,h:l-h},{config:ie.bottomRight,x:d,y:h,w:s-d,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:s,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+w,fill:ie.topLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:ie.topLeft.label}),e("text",{x:s-8,y:8+w,fill:ie.topRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:ie.topRight.label}),e("text",{x:8,y:l-8,fill:ie.bottomLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:ie.bottomLeft.label}),e("text",{x:s-8,y:l-8,fill:ie.bottomRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:ie.bottomRight.label})]})]})}]},[y,m,ie,b,x,w]);if(ae.earlyReturn)return ae.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:re}),{xAccessor:f,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:S||void 0,sizeRange:C,pointStyle:ge,colorScheme:A,size:[V,X],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae.margin,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:g,enableHover:U,showGrid:K}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),ae.legendBehaviorProps),Z&&{title:Z}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?pe:$r(j)||pe}),($||N||D||B)&&{customHoverBehavior:ae.customHoverBehavior}),(N||D||$)&&{customClickBehavior:ae.customClickBehavior}),P&&{pointIdAccessor:P}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:be}),ae.crosshairProps),L),be.length>0&&{canvasPreRenderers:be}),{svgPreRenderers:xe});return ye?e(Ms,{componentName:"QuadrantChart",message:ye,width:V,height:X}):e(Ns,{componentName:"QuadrantChart",width:V,height:X,children:e(ka,Object.assign({ref:s},we))})});Fl.displayName="QuadrantChart";const El="__ma_unitized",Hl="__ma_series";function zl(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Wl(e,t){return t[0]+e*(t[1]-t[0])}const Gl=g(function(t,n){var a;const s=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!s.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&s.current.push(Object.assign(Object.assign({},o),{[El]:zl(r,i),[Hl]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!s.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&o.push(Object.assign(Object.assign({},e),{[El]:zl(a,r),[Hl]:i.label||"Series "+(t+1)}))}s.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const d=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:w=2,tooltip:k,annotations:A,frameProps:S={},selection:C,linkedHover:O,onObservation:_,onClick:j,hoverHighlight:P,chartId:M,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:D,stroke:B,strokeWidth:I,opacity:R}=t,{width:F,height:E,enableHover:H,showGrid:z,showLegend:W=!0,title:G,description:Y,summary:q,accessibleTable:V,xLabel:X}=d,U=r(()=>ke(h),[h]),K=r(()=>ke(v),[v]),Q=K,Z=2===K.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||Z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${K.length}. Rendering as a standard multi-line chart.`);const J=Rs(L,F,E,T),ee=J?null:Is(h,F,E,$),te=hs(),ne=r(()=>{let e;if(Array.isArray(b))e=b;else if(te&&te.length>0)e=te;else{const t=At[b];e=Array.isArray(t)?t:St}return Q.map((t,n)=>t.color||e[n%e.length])},[Q,b,te]),oe=r(()=>K.map((e,t)=>e.label||"Series "+(t+1)),[K]),{unitizedData:ie,extents:re}=r(()=>{if(0===U.length){const e=K.map(e=>e.extent||null).filter(Boolean);return e.length===K.length&&(c.current=e),{unitizedData:[],extents:e.length===K.length?e:[]}}const e=K.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(U,e.yAccessor));if(c.current=e,!Z){const t=[];for(const e of U)for(let n=0;K.length>n;n++){const o=K[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[El]:i,[Hl]:oe[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of U)for(let o=0;2>o;o++){const i=K[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[El]:zl(r,e[o]),[Hl]:oe[o]}))}return{unitizedData:t,extents:e}},[U,K,Z,oe]),ae=r(()=>{if(Z&&re.length>=2)return[{orient:"left",label:oe[0],tickFormat:K[0].format||(e=>{const t=Wl(e,re[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:oe[1],tickFormat:K[1].format||(e=>{const t=Wl(e,re[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Z,re,K,oe]),se=Xs({data:r(()=>ie.length>0?ie:oe.map(e=>({[Hl]:e})),[ie,oe]),rawData:h,colorBy:Hl,colorScheme:ne,legendInteraction:N,legendPosition:D,selection:C,linkedHover:O,fallbackFields:[Hl],unwrapData:!1,onObservation:_,onClick:j,hoverHighlight:P,chartType:"MultiAxisLineChart",chartId:M,showLegend:W,userMargin:g,marginDefaults:Z?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:E}),le=r(()=>{const e=new Map;return oe.forEach((t,n)=>e.set(t,ne[n])),e},[oe,ne]),ce=Ks({lineWidth:w,resolveStroke:l(e=>le.get(e[Hl])||ne[0],[le,ne]),stroke:B,strokeWidth:I,opacity:R,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ue=r(()=>{if(!1===k)return()=>null;return $r(k)||(e=>{var t;const n=e.data||e,i=n[Hl],r=oe.indexOf(i),a=n[El],s=Z&&r>=0&&re[r]?Wl(a,re[r]):a,l=r>=0&&(null===(t=K[r])||void 0===t?void 0:t.format)?K[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ne[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(s)}`))})},[k,oe,ne,re,Z,K,m]);if(se.earlyReturn)return se.earlyReturn;const de=Gs({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),he=Z?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ie}),{xAccessor:m,yAccessor:El,groupAccessor:Hl,lineStyle:ce,colorScheme:ne,size:[F,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:d.showAxes}),ae&&{axes:ae}),{xLabel:X}),Z?{}:{yLabel:oe[0]}),{xFormat:y}),Z&&he&&{yExtent:he}),{enableHover:H}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:z,curve:x}),se.legendBehaviorProps),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==V&&{accessibleTable:V}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:ue}),A&&{annotations:A}),(O||_||j||P)&&{customHoverBehavior:se.customHoverBehavior}),(_||j||O)&&{customClickBehavior:se.customClickBehavior}),se.crosshairProps),S);return J||ee||(de?e(Ms,{componentName:"MultiAxisLineChart",message:de,width:F,height:E}):e(Ns,{componentName:"MultiAxisLineChart",width:F,height:E,children:e(ka,Object.assign({ref:s},ge))}))});Gl.displayName="MultiAxisLineChart";const Yl=g(function(t,n){const o=i(null);Qs(n,{variant:"xy",frameRef:o});const a=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:w,frameProps:k={},selection:A,linkedHover:S,onObservation:C,onClick:O,chartId:_,loading:j,loadingContent:P,emptyContent:M}=t,{width:L,height:T,enableHover:$,showGrid:N,title:D,description:B,summary:I,accessibleTable:R,xLabel:F,yLabel:E}=a,H=Rs(j,L,T,P),z=H?null:Is(s,L,T,M),W=r(()=>ke(s),[s]),G=null==p||null==y;Fs("CandlestickChart",W,"xAccessor",h),Fs("CandlestickChart",W,"highAccessor",g),Fs("CandlestickChart",W,"lowAccessor",f),G||(Fs("CandlestickChart",W,"openAccessor",p),Fs("CandlestickChart",W,"closeAccessor",y));const{customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:V}=ys({selection:A,linkedHover:S,onObservation:C,onClick:O,chartType:"CandlestickChart",chartId:_}),X=ms(S,V),U=r(()=>{const e=a.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:Object.assign(Object.assign({},n),function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(l))},[l,a.marginDefaults,t.mode]),K=r(()=>{const e=[{label:F||As(h),accessor:h,role:"x",format:u}];return G?(e.push({label:"High",accessor:g,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:g,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:y,format:d})),js(e)},[h,F,u,d,g,f,p,y,G]),Q=Gs({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!G&&{openAccessor:p,closeAccessor:y})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=s&&{data:W}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!G&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:a.showAxes,xLabel:F,yLabel:E,xFormat:u,yFormat:d,enableHover:$,showGrid:N}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),sl({title:D,description:B,summary:I,accessibleTable:R,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:v,defaultTooltipContent:K})),ll({linkedHover:S,onObservation:C,onClick:O,customHoverBehavior:Y,customClickBehavior:q})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),w&&{yExtent:w}),X),k);return H||z||(Q?e(Ms,{componentName:"CandlestickChart",message:Q,width:L,height:T}):e(Ns,{componentName:"CandlestickChart",width:L,height:T,children:e(ka,Object.assign({ref:o},ee))}))});function ql(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let i=0;return e=>{const r=t(e)+"",a=null==n?void 0:n[r];if(a)return a;let s=o.get(r);return s||(s=Xt[i%Xt.length],i++,o.set(r,s)),s}}function Vl(e,t,n,o,i,r,a){e.push(t?{type:"symbol",x:o,y:i,size:Math.PI*r*r,symbolType:t(n),style:a,datum:n}:{type:"point",x:o,y:i,r:r,style:a,datum:n})}function Xl(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,a=[],s=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:s,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),a.push(v)}return a}function Ul(e){var t,n,o;const i=e.length,r=e[0],a=e[i-1];return{n:i,min:r,q1:null!==(t=K(e,.25))&&void 0!==t?t:r,median:null!==(n=K(e,.5))&&void 0!==n?n:(r+a)/2,q3:null!==(o=K(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}function Kl(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=At[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function Ql(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}Yl.displayName="CandlestickChart";const Zl={bar:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=s.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(a))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(a)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const a=t.get(r);if(!a)continue;let s=a.total;y&&n>0&&(s/=n);const l=u(a.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(f){const t=d(0>s?i:o+s),n=0>s?d(i+s)-d(i):d(o)-d(o+s);g.push(qe(e.x,t,e.width,Math.abs(n),l,h,r)),0>s?i+=s:o+=s}else if(p){const t=d(0>s?i+s:o),n=0>s?d(i)-d(i+s):d(o+s)-d(o);g.push(qe(t,e.x,Math.abs(n),e.width,l,h,r)),0>s?i+=s:o+=s}}}const v="vertical"===h,b=s.roundedTop&&s.roundedTop>0?Math.max(0,s.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",s.gradientFill&&(e.fillGradient=s.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let a=0;h.length>a;a++){const c=i.get(h[a])||[];for(const i of c){const c=r(i),g=s(i,h[a]);if(d){const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(qe(r,Math.min(s,d),o,Math.abs(s-d),g,i,h[a]))}else{const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(qe(Math.min(s,d),r,Math.abs(d-s),o,g,i,h[a]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=ql(e),y=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[i]||c,v=l(t,e.name),b=v.r||5;let x,w;if(g){const t=m+(e.pctStart+e.pct/2)*y,n=u(r);x=Math.cos(t)*n,w=Math.sin(t)*n}else h?(x=e.middle,w=u(r)):(x=u(r),w=e.middle);Vl(d,p,t,x,w,b,v)}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="vertical"===s,u=ql(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=i(o),d=r(o,e.name),h=d.r||4,g=(7919*n%100/100-.5)*t*.8;Vl(l,u,o,c?e.middle+g:a(s),c?a(s):e.middle+g,h,d)}}return l},pie:Xl,donut:Xl,boxplot:function(e,t){var n,o,i,r,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(n=K(l,.25))&&void 0!==n?n:c,v=null!==(o=K(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=K(l,.75))&&void 0!==i?i:u,x=b-f,w=f-1.5*x,k=b+1.5*x,A=null!==(r=l.find(e=>e>=w))&&void 0!==r?r:c,S=null!==(a=[...l].reverse().find(e=>k>=e))&&void 0!==a?a:u,C=h(t.pieceData[0],t.name),O=[];if(m)for(const e of t.pieceData){const n=d(e);if(w>n||n>k){const o=y?t.middle:g(n),i=y?g(n):t.middle;O.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:C,datum:t.pieceData,category:t.name,outliers:O}),m)for(const t of O)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:C.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],a=t[t.length-1],s=(a-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/s),f-1)]++;const y=ho(d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const n=u(r+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(r+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(r+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(r+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=K(t,.25))&&void 0!==n?n:r,l=null!==(o=K(t,.5))&&void 0!==o?o:(r+a)/2,c=null!==(i=K(t,.75))&&void 0!==i?i:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(a),u(r)),width:e.width,height:Math.abs(u(a)-u(r))}:{x:Math.min(u(r),u(a)),y:e.x,width:Math.abs(u(a)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:Ul(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=uo(t),i=null!=g&&isFinite(g)?g:n,r=null!=f&&isFinite(f)?f:o,h=(r-i)/u||1,p=Array(u).fill(0);for(const e of t)i>e||e>r||p[Math.min(Math.floor((e-i)/h),u-1)]++;const y=t.length,m=ho(p,1),v=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===p[t])continue;const n=(d?p[t]/y:p[t]/m)*e.width*.9,o=l(i+t*h),r=l(i+(t+1)*h);c.push(qe(Math.min(o,r),e.x+e.width-n,Math.abs(r-o),n,v,{bin:t,count:p[t],range:[i+t*h,i+(t+1)*h],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const f=ho(c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Ul(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,s]=n,u=r(t,e.name);if(c){const n=a(Math.min(o,s)),i=a(Math.max(o,s));l.push(qe(n,e.x,i-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),i=a(Math.min(o,s));l.push(qe(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,a,s,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return f;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const i=e.groups.get(v[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const S=new Map;for(const e of v){const t=k[0].groups.get(e);S.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const C=k[0].stepTotal,O=x?.95*p:.9*t.width,_=w().domain([0,A]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let P=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,u=0===t,d=o.width,h=.55*d,m=o.x+(d-h)/2,b=new Map;if(x){let e=0;for(const t of v){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=p,i=p;for(let r=0;v.length>r;r++){const s=v[r],l=n.groups.get(s);if(!l)continue;const c=_(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const w=g(l.pieces[0],s),k=null!==(a=S.get(s))&&void 0!==a?a:l.total,A=k>0?l.total/k*100:0,C=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:s});y&&(0===r&&(C.__funnelStepLabel=o.name,C.__funnelStepLabelX=p,C.__funnelStepLabelY=m,C.__funnelRowWidth=e),C.__funnelValueLabelX=x+c/2,C.__funnelValueLabelY=m,C.__funnelBarW=c),f.push(qe(x,m,c,h,w,C,s)),b.set(s,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),a=p-t/2,s=v[0],l="_default"!==s,c=null!==(r=null===(i=n.groups.get(s))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?s:o.name,x=g(c,d),w=C>0?e/C*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?s:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=m,k.__funnelBarW=t),f.push(qe(a,m,t,h,x,k,d)),b.set(s,{x:a,y:m,w:t,h:h})}if(t>0&&P.size>0){const t=x?v:[v[0]];for(const i of t){const t=P.get(i),r=b.get(i);if(!t||!r)continue;const a=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:a.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:j},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(u)}}P=b}return f},"bar-funnel":function(e,t){var n,o,i,r;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=s(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,w=null==a?void 0:a.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:y,A=o?0:Math.max(0,k-y),S=n.x+e*s+l/2,C=v(y),O=v(0)-C,_=c(f.pieces[0],p?h:n.name),j=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(qe(S,C,u,O,_,j,p?h:n.name)),A>0){const e=v(y+A),t=C-e,o=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(qe(S,e,u,t,o,i,p?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),a=Math.min(o,r),s=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?qe(a,n.x,s,n.width,o,null,"__track__"):qe(n.x,a,n.width,s,o,null,"__track__");u.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=a?a(n):e.name,c=s(n,i);let f;if(d){const r=l(t),a=l(t+o);f=qe(r,e.x,a-r,e.width,c,n,i)}else{const r=l(t+o),a=l(t);f=qe(e.x,r,e.width,a-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=o}if(p>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return u}};class Jl{constructor(e){this.rExtent=new Fe,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Re(e.windowSize),this.getO=Qe(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Ue(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Fe)):(this.getR=Ue(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Qe(e.stackBy),this.getGroup=Qe(e.groupBy),this.getColor=Qe(e.colorAccessor),this.getSymbol=Qe(e.symbolAccessor),this.getConnector=Qe(e.connectorAccessor),this.getDataId=Qe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Re(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,r),s="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=C().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=w().domain(a).range([o,n])}else s?(u=C().domain(r).range([0,e.height]).padding(c),d=w().domain(a).range([0,e.width])):(u=C().domain(r).range([0,e.width]).padding(c),d=w().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const a=this.rExtents[i];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?w().domain([l,c]).range([0,e.width]):w().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o,i;if(!this.scales)return[];if(this.config.customLayout){const r=this.buildLayoutContext(e,t);let a;try{a=this.config.customLayout(r)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(n=a.overlays)&&void 0!==n?n:null;const s=null!==(o=a.nodes)&&void 0!==o?o:[];if(this._customRestyle=a.restyle,this.hasCustomRestyle=!!a.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,null!==(i=this.config.layoutSelection)&&void 0!==i?i:null)}return Zt({label:"ordinal customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const r=this.getSceneContext(),a=Zl[this.config.chartType];let s=a?a(r,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:a,getO:s}=e;if(!a||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=a(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:s(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const a=i[r],s=i[r+1],c="function"==typeof h?h(a.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:a.x,y1:a.y,x2:s.x,y2:s.y,style:c,datum:a.datum,group:t})}}return l}(r,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var n,o,i,r;const a=this.config,s=null!==(n=a.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},l=Kl(a.colorScheme,a.themeCategorical,Ct),c=this.scales;return{data:e,scales:{o:c.o,r:c.r,projection:c.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===c.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(o=a.themeSemantic)&&void 0!==o?o:{},categorical:[...l]},resolveColor:Ql(l),config:null!==(i=a.layoutConfig)&&void 0!==i?i:{},selection:null!==(r=a.layoutSelection)&&void 0!==r?r:null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Ct,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Lt(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const a=e[r],s=n?t(a):a[o];let l=i.get(s);l||(l=[],i.set(s,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,Jl.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=O().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,i),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(a>n){const e=1-n/a;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;a>i&&(n._pulseIntensity=1-i/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,a=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,s="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,s?{x:t.x,y:a,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:a,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),k=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:Bt(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=Nt(e,this.activeTransition),a=$t(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=Dt(i,e._targetOpacity,a)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=Dt(o.x,e._targetX,a),e.y=Dt(o.y,e._targetY,a)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=Dt(o.r,e._targetR,a))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=Dt(i,e._targetOpacity,a)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Dt(n.x,e._targetX,a),e.y=Dt(n.y,e._targetY,a),void 0!==n.w&&(e.w=Dt(n.w,e._targetW,a),e.h=Dt(n.h,e._targetH,a))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Dt(o,e._targetOpacity,a)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=Dt(n.startAngle,e._targetStartAngle,a),e.endAngle=Dt(n.endAngle,e._targetEndAngle,a))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},a=i(r,t);r.style=a?Object.assign(Object.assign({},e),a):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!Xe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Xe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Xe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Xe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Qe(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!Xe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Ue(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Fe)):(this.getR=Ue(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Xe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Qe(this.config.stackBy):void 0),"groupBy"in e&&!Xe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Qe(this.config.groupBy):void 0),"colorAccessor"in e&&!Xe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Qe(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!Xe(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Qe(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!Xe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Qe(this.config.connectorAccessor):void 0)}}function ec(e,t,n){const o=cn(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function tc(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>un(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function nc(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>un(Kt(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function oc(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const a=gn(Math.atan2(i,o)),s=gn(e.startAngle),l=gn(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function ic(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function rc(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:a}=e.bounds;return o>t||t>o+r||i>n||n>i+a?null:{datum:e.datum,x:o+r/2,y:i+a/2,distance:0,category:e.category,stats:e.stats}}function ac(o){const{width:i,height:a,totalWidth:s,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==u?void 0:u.projection),m="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||y?[]:(f||pi(u.r,5,p)).map(e=>({value:e,pixel:u.r(e),label:(g||sc)(e)})),[u,g,y,f,p]),b=h&&u&&!y,x=d&&u&&!y;return b||x?e("svg",{width:s,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,n)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&e(n,{children:t(n,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function sc(e){return Math.round(100*e)/100+""}function lc(o){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:C,legendIsolatedCategories:O,legendPosition:_="right",legendLayout:j,foregroundGraphics:P,annotations:M,autoPlaceAnnotations:L,svgAnnotationRules:T,xAccessor:$,yAccessor:N,annotationData:D,underlayRendered:B,children:I}=o,R="radial"===(null==g?void 0:g.projection),F="horizontal"===(null==g?void 0:g.projection),E=!1!==p,H=r(()=>{if(!f||!E||!g||R)return[];const e=g.o.bandwidth(),t=g.o.domain().map((t,n)=>{var o;return{value:t,pixel:(null!==(o=g.o(t))&&void 0!==o?o:0)+e/2,label:v?v(t,n):t}});if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e;let o,i=0,r=!1;for(const e of t)"string"==typeof e.label?i=Math.max(i,e.label.length):"number"==typeof e.label?i=Math.max(i,(e.label+"").length):r=!0;o=F?r?24:16:Math.max(6.5*i,r?60:0)+6;const a=Math.max(1,Math.ceil(o/n));return 1===a?t:t.filter((e,t)=>t%a===0)},[f,E,g,v,R,F]),z=o.rTickValues,W=o.tickLabelEdgeAlign,G=o.axisExtent,Y=r(()=>f&&g&&!R?(z||pi(g.r,5,G)).map(e=>({value:e,pixel:g.r(e),label:(b||sc)(e)})):[],[f,g,b,R,z,G]),q=i(new Map),V=i(null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0),X=null!==(s=null==M?void 0:M.length)&&void 0!==s?s:0;V.current!==X&&(V.current=X,q.current=new Map);const U=r(()=>{if(!M||0===M.length)return null;const e=Io(),t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:N,width:l,height:c,data:D,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:q.current};return Bo(L?ii(Object.assign({annotations:M,context:o},"object"==typeof L?L:{})):M,e,T,o)},[M,L,T,l,c,g,$,N,D]);return f||w||k||P||U&&U.length>0||x||I?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof w?w:"Ordinal Chart"}),e("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!R&&!B&&e("g",{className:"ordinal-grid",children:Y.map((t,n)=>e("line",{x1:F?t.pixel:0,y1:F?0:t.pixel,x2:F?t.pixel:l,y2:F?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!R&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(n,F?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!B&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!B&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!B&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Y.map((n,i)=>{const r=W?0===i?"start":i===Y.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!B&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,n=0>t||t>c?c:t;return e("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),H.map((n,i)=>t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!B&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),U,P,I]}),w&&e("text",{x:u/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 w?w:null}),co({legend:k,totalWidth:u,totalHeight:d,margin:h,legendPosition:_,title:w,legendLayout:j,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:C,legendIsolatedCategories:O})]}):null}function cc({width:t,height:n,totalWidth:o,totalHeight:r,margin:s,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,a(()=>{if(!u.current)return;const e=y(u.current).select(".brush-g"),o=b?m():v();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[t,n,b]),a(()=>{if(!l||!d.current||!p.current)return;if(!u.current)return;const e=p.current,t=y(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1)},[l,b]),e("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}function uc(e,t){var n,o,i,r;const a=t._gradientBand.colors;if(0===a.length)return;const{clipPath:s,slices:l}=Pi({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:a}),c=new Path2D(s);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=kn(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function dc(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function hc(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=V().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}Jl.QUADTREE_THRESHOLD=500;const gc=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"wedge"===e.type);for(const t of a){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)uc(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(dc(e,t),Ur(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?kn(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=ji({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),hc(e,t)):(dc(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(dc(e,t),Ur(e,t)),e.globalAlpha=1}}},fc=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=kn(e,"var(--semiotic-primary, #007bff)"),s=kn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?kn(e,l)||l:null!=l?l:a,u=t.style.stroke,d="string"==typeof u?kn(e,u)||u:s,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},pc=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?kn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},yc=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=kn(e,n.style.stroke)||("string"==typeof n.style.fill?kn(e,n.style.fill):n.style.fill)||kn(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},mc=(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function vc(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function bc(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let xc=null;const wc=new Map;function kc(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=wc.get(n);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(xc||(xc=document.createElement("canvas")),xc.width=e,xc.height=e,xc)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return wc.set(n,i),i}function Ac(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function Sc(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Cc(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Oc=e=>[yc,...e],_c={bar:Oc([ia]),clusterbar:Oc([ia]),point:Oc([Zr,ta]),swarm:Oc([Zr,ta]),pie:[gc],donut:[gc],boxplot:Oc([fc,Zr]),violin:Oc([pc]),histogram:Oc([ia]),ridgeline:Oc([pc]),timeline:Oc([ia]),funnel:[ia,mc,(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?vc(i):null!=r?`${vc(i)} (${bc(r)})`:vc(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=vc(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ia,(e,t,n,o)=>{var i,r;const a=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of a){const n=("string"==typeof t.style.fill?t.style.fill:null)||kn(e,"var(--semiotic-border, #999)"),o=kc(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=An(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,kn(e,"var(--semiotic-text, #333)")),a=r?"#1f2937":"#ffffff",s=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?Cc(i):"",d=Sc(o);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),Ac(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),Ac(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:Oc([ia]),custom:Oc([ia,Zr,ta,gc,fc,pc,mc])},jc={top:50,right:40,bottom:60,left:70},Pc={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Mc(n){const o=Or(n,{skipPositional:!1});return null==o.title&&0===o.entries.length?null:t("div",{className:"semiotic-tooltip",style:Pc,children:[null!=o.title&&e("div",{style:{fontWeight:"bold"},children:o.title+""}),o.entries.map(e=>t("div",{children:[t("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Lc({hover:n}){var o,i,r,a,s,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:Pc,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:Pc,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return t("div",{className:"semiotic-tooltip",style:Pc,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===n.length&&t("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f)return Mc(c);const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(s=null!==(a=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==a?a:c.__rValue)&&void 0!==s?s:c.pct)&&void 0!==l?l:"";return p||""!==y?t("div",{className:"semiotic-tooltip",style:Pc,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]}):Mc(c)}Lc.ownsChrome=!0;const Tc=g(function(n,s){var c,u,h,g,f,y,m,v,b,x,w,k;const{chartType:A,runtimeMode:S,data:C,oAccessor:O="category",rAccessor:_="value",colorAccessor:j,symbolAccessor:P,symbolMap:M,stackBy:L,groupBy:T,multiAxis:$,timeAccessor:N,valueAccessor:D,categoryAccessor:B,projection:I="vertical",size:R=[600,400],responsiveWidth:F,responsiveHeight:E,margin:H,barPadding:z,roundedTop:W,gradientFill:G,trackFill:Y,baselinePadding:q,innerRadius:X,cornerRadius:U,normalize:K,startAngle:Q,sweepAngle:Z,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,connectorOpacity:ie,showLabels:re,connectorAccessor:ae,connectorStyle:se,dataIdAccessor:le,rExtent:ce,oExtent:ue,extentPadding:de=.05,oSort:he,windowMode:ge="sliding",windowSize:fe=200,pieceStyle:pe,summaryStyle:ye,colorScheme:me,barColors:ve,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:we,valueLabel:Ae,categoryFormat:Se,valueFormat:Ce,oLabel:_e,rLabel:je,oFormat:Me,rFormat:Le,rTickValues:Te,tickLabelEdgeAlign:$e,axisExtent:Ne,enableHover:De=!0,hoverAnnotation:Be,tooltipContent:Ie,customHoverBehavior:Re,annotations:Fe,autoPlaceAnnotations:Ee,svgAnnotationRules:He,showGrid:ze=!1,legend:We,legendHoverBehavior:Ge,legendClickBehavior:Ye,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Xe,legendLayout:Ue,legendCategoryAccessor:Ke,onCategoriesChange:Qe,backgroundGraphics:Ze,foregroundGraphics:Je,title:et,className:tt,background:nt,centerContent:ot,decay:it,pulse:rt,transition:at,animate:st,staleness:lt,brush:ct,onBrush:ut,accessibleTable:dt=!0,description:ht,summary:gt,customLayout:ft,layoutConfig:pt,layoutSelection:yt}=n,mt=i(!0),vt=Er({sizeProp:R,responsiveWidth:F,responsiveHeight:E,userMargin:H,marginDefault:jc,foregroundGraphics:Je,backgroundGraphics:Ze,animate:st,transitionProp:at,themeDirtyRef:mt}),{reducedMotionRef:bt,responsiveRef:xt,size:wt,margin:kt,adjustedWidth:At,adjustedHeight:St,resolvedForeground:Ct,resolvedBackground:Ot,currentTheme:_t,transition:jt,introEnabled:Pt,tableId:Mt,rafRef:Lt,renderFnRef:Tt,scheduleRender:$t}=vt,Nt=Bi(),Dt=Ei(),Bt=r(()=>ke(C),[C]),It=null!=we?we:_e,Rt=null!=Ae?Ae:je,Ft=null!=Se?Se:Me,Et=null!=Ce?Ce:Le,Ht=i(null),zt=i(null),Wt=i([]),Gt=i(Ke),Yt=i(Qe);Gt.current=Ke,Yt.current=Qe;const[qt,Vt]=d(null),[Xt,Ut]=d(null),[Kt,Qt]=d(0),Zt=i(0),[Jt,en]=d(!1),tn=i({w:-1,h:-1}),nn=De||Be,on="streaming"===S,an=r(()=>{var e,t,n;return{chartType:A,runtimeMode:on?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:de,projection:I,oAccessor:on?void 0:O,rAccessor:on?void 0:_,colorAccessor:j,symbolAccessor:P,symbolMap:M,stackBy:L,groupBy:T,multiAxis:$,timeAccessor:on?N:void 0,valueAccessor:on?D||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:on?B||O:void 0,rExtent:ce,oExtent:ue,axisExtent:Ne,barPadding:z,roundedTop:W,gradientFill:G,trackFill:Y,baselinePadding:q,innerRadius:X,cornerRadius:U,normalize:K,startAngle:Q,sweepAngle:Z,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,connectorOpacity:ie,showLabels:re,connectorAccessor:ae,connectorStyle:se,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:me,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:Pe(_t),themeSequential:null===(t=null==_t?void 0:_t.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==_t?void 0:_t.colors)||void 0===n?void 0:n.diverging,barColors:ve,decay:it,pulse:rt,transition:jt,introAnimation:Pt,staleness:lt,customLayout:ft,layoutConfig:pt,layoutMargin:kt}},[A,fe,ge,de,I,O,_,j,P,M,L,T,$,N,D,B,ce,ue,Ne,z,W,G,Y,q,X,U,K,Q,Z,J,ee,te,ne,oe,ie,re,ae,se,le,he,pe,ye,me,ve,it,rt,null==jt?void 0:jt.duration,null==jt?void 0:jt.easing,Pt,lt,on,_t,ft,pt,kt]),sn=zi(an),cn=i(null);cn.current||(cn.current=new Jl(sn));const un=l(()=>{var e,t;const n=Gt.current,o=Yt.current;if(!o||!n)return;const i=ua(null!==(t=null===(e=cn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);da(i,Wt.current)||(Wt.current=i,o(i))},[]);a(()=>{var e;null===(e=cn.current)||void 0===e||e.updateConfig(sn),mt.current=!0,$t()},[sn,$t]);const dn=i(null);a(()=>{const e=cn.current;if(!e)return;const t=null!=yt?yt:null;dn.current!==t&&(dn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):mt.current=!0,$t())},[yt,$t]);const hn=i(null);hn.current||(hn.current=new Oe(e=>{const t=cn.current;t&&t.ingest(e)&&(mt.current=!0,$t())}));const gn=l(e=>{var t;null===(t=hn.current)||void 0===t||t.push(e)},[]),pn=l(e=>{var t;null===(t=hn.current)||void 0===t||t.pushMany(e)},[]),yn=l(()=>{var e,t;null===(e=hn.current)||void 0===e||e.clear(),null===(t=cn.current)||void 0===t||t.clear(),mt.current=!0,$t()},[$t]),mn=l(e=>{var t,n;null===(t=hn.current)||void 0===t||t.clearLastData(),null===(n=hn.current)||void 0===n||n.setReplacementData(e)},[]);p(s,()=>({push:gn,pushMany:pn,replace:mn,remove:e=>{var t,n,o,i;null===(t=hn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=cn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=zt.current)||void 0===i?void 0:i.data;!!zt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(zt.current=null,Vt(null)),mt.current=!0,$t()}return r},update:(e,t)=>{var n,o,i;null===(n=hn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=cn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(mt.current=!0,$t()),r},clear:yn,getData:()=>{var e,t,n;return null===(e=hn.current)||void 0===e||e.flush(),null!==(n=null===(t=cn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=cn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[gn,pn,mn,yn,$t]),a(()=>{var e;C&&(null===(e=hn.current)||void 0===e||e.setBoundedData(Bt))},[C,Bt]);const{hoverHandlerRef:vn,hoverLeaveRef:bn,onPointerMove:xn,onPointerLeave:wn}=vt;vn.current=e=>{if(!nn)return;const t=Ht.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-kt.left,i=e.clientY-n.top-kt.top;if(0>o||o>At||0>i||i>St)return void(zt.current&&(zt.current=null,Vt(null),Re&&Re(null),$t()));const r=cn.current;if(!r||0===r.scene.length)return;const a="radial"===I,s=function(e,t,n,o=30,i,r=0){let a=null;if(i){const e=fn(i,t,n,o,r);e&&(a={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=ec(r,t,n);break;case"point":if(i)break;e=tc(r,t,n,o);break;case"symbol":e=nc(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=oc(r,t,n);break;case"boxplot":e=ic(r,t,n);break;case"violin":e=rc(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}(r.scene,a?o-At/2:o,a?i-St/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!s)return void(zt.current&&(zt.current=null,Vt(null),Re&&Re(null),$t()));const l=xr(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A}));zt.current=l,Vt(l),Re&&(Re(l),mt.current=!0),$t()},bn.current=()=>{zt.current&&(zt.current=null,Vt(null),Re&&(Re(null),mt.current=!0),$t())};const An=i(-1),Sn=i(null),Cn=i(null),On=l(e=>{const t=cn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Cn.current&&Cn.current.version===n)o=Cn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("symbol"===r.type){if(0>=r.size)continue;i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=Hn(e),Cn.current={version:n,graph:o}}const i=An.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),An.current=0;const t=o.flat[0];Sn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},qn(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return zt.current=n,Vt(n),Re&&Re(n),void $t()}const r=zn(o,i),a=Wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return An.current=-1,Sn.current=null,zt.current=null,Vt(null),Re&&Re(null),void $t();An.current=a;const s=o.flat[a];Sn.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},qn(s)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});zt.current=l,Vt(l),Re&&Re(l),$t()},[Re,$t]),_n=l(e=>{An.current=-1,Sn.current=null,xn(e)},[xn]);Tt.current=()=>{var e,t;Lt.current=0;const n=Ht.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=cn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(bt.current?r+1e6:r),s=!bt.current&&a,l=tn.current.w!==At||tn.current.h!==St,c=mt.current;let u=!1;!c&&!l||s&&!l||(i.computeScene({width:At,height:St}),tn.current={w:At,h:St},u=!0,un()),mt.current=c&&s&&!u,(u||s)&&n.setAttribute("aria-label",Ki(i.scene,A+" chart"));const d=zr(),h=wt[0]*d,g=wt[1]*d;n.width===h&&n.height===g||(n.width=h,n.height=g,n.style.width=wt[0]+"px",n.style.height=wt[1]+"px"),o.setTransform(d,0,0,d,0,0),o.clearRect(0,0,wt[0],wt[1]);const f=null!==(e=null==lt?void 0:lt.threshold)&&void 0!==e?e:5e3,p=lt&&i.lastIngestTime>0&&r-i.lastIngestTime>f;if(p&&(o.globalAlpha=null!==(t=null==lt?void 0:lt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==nt&&!Ze){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=nt||(e&&"transparent"!==e?e:null),i=t?kn(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,wt[0],wt[1]))}const y="radial"===I;o.save(),o.beginPath(),o.rect(kt.left,kt.top,At,St),o.clip(),y?(o.save(),o.translate(kt.left+At/2,kt.top+St/2)):o.translate(kt.left,kt.top);const m=ft?_c.custom:_c[A]||[],v={width:At,height:St};for(const e of m)e(o,i.scene,i.scales,v);y&&o.restore(),o.restore(),p&&(o.globalAlpha=1),u&&i.scales?(Ut(i.scales),Qt(e=>e+1),Zt.current=r):s&&i.scales&&r-Zt.current>=33&&(Qt(e=>e+1),Zt.current=r),(null==lt?void 0:lt.showBadge)&&en(!!p),(s||null!=i.activeTransition||i.hasActivePulses)&&(Lt.current=requestAnimationFrame(()=>Tt.current()))},Hi({hydrated:Nt,wasHydratingFromSSR:Dt,storeRef:cn,dirtyRef:mt,renderFnRef:Tt,cleanup:()=>{var e;return null===(e=hn.current)||void 0===e?void 0:e.clear()}}),a(()=>{mt.current=!0,$t()},[A,At,St,be,nt,$t]),Zn(lt,cn,mt,$t,Jt,en);const jn=nn&&qt?Ie?Ie(qt):e(Lc,{hover:qt}):null,Pn="radial"===I,Mn=jn?e(Nr,{x:qt?Pn?qt.x+At/2:qt.x:0,y:qt?Pn?qt.y+St/2:qt.y:0,containerWidth:At,containerHeight:St,margin:kt,className:"stream-ordinal-tooltip",children:jn}):null,Ln=ha(O,void 0,"__semiotic_resolvedO",""),Tn=ha(_,void 0,"__semiotic_resolvedR",""),$n=Ln.key,Nn=Tn.key,Dn=ga(Ln,Tn,Fe&&Fe.length>0||!1);if(Ni||!Nt&&Dt){const n=cn.current;n&&C&&(n.ingest({inserts:Bt,bounded:!0}),n.computeScene({width:At,height:St}));const i=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,a="radial"===I,s=a?kt.left+At/2:kt.left,l=a?kt.top+St/2:kt.top;return t("div",{ref:xt,className:"stream-ordinal-frame"+(tt?" "+tt:""),role:"img","aria-label":ht||("string"==typeof et?et:"Ordinal chart"),style:{position:"relative",width:F?"100%":wt[0],height:E?"100%":wt[1]},children:[e(fr,{summary:gt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:wt[0],height:wt[1],style:{position:"absolute",left:0,top:0},children:[Ot&&e("g",{transform:`translate(${kt.left},${kt.top})`,children:Ot}),t("g",{transform:`translate(${s},${l})`,children:[nt&&e("rect",{x:0,y:0,width:At,height:St,fill:nt}),i.map((n,i)=>function(n,i,r){var a,s,l,c,u,d,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=$i(m)+"-grad",a=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,a=t.x,s=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,s=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,a=t.x,s=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,a=t.x+t.w,s=t.y);const l=[];if("colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let n=0;t.length>n;n++)l.push(e("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Li(t.style.fill);l.push(e("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:a,y2:s,children:l})}(i,r),s=a?`url(#${r})`:Li(i.style.fill);if(i.cornerRadii&&Ci(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:a,br:s,bl:l}=Oi(e);let c=`M${t+r},${n}`;return c+=` L${t+o-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o},${n+a}`),c+=` L${t+o},${n+i-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o-s},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:n,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:d,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Li(t.style.fill),opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"symbol":return Ti(n,i,r);case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=$i(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:a,slices:d}=Pi({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(s=o.roundedEnds)||void 0===s?void 0:s.start)||void 0===l||l,roundEnd:null===(u=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===u||u,colors:o._gradientBand.colors});return t("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:n,children:e("path",{d:a})})}),e("g",{clipPath:`url(#${n})`,children:d.map((t,n)=>e("path",{d:t.d,fill:Li(t.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&e("path",{d:a,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let a;if(o.roundedEnds)a=ji({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=V().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),a=e(Mi)||""}return e("path",{d:a,transform:`translate(${o.cx},${o.cy})`,fill:Li(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return t("g","vertical"===o.projection?{children:[e("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Li(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Li(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=n,o=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Li(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:o},m)}case"connector":return e("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=n,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:o,fill:Li(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(n,i,Mt)).filter(Boolean)]})]}),e(lc,{width:At,height:St,totalWidth:wt[0],totalHeight:wt[1],margin:kt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:It,rLabel:Rt,oFormat:Ft,rFormat:Et,rTickValues:Te,tickLabelEdgeAlign:$e,axisExtent:Ne,showGrid:ze,title:et,legend:We,legendHoverBehavior:Ge,legendClickBehavior:Ye,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Xe,legendLayout:Ue,foregroundGraphics:rn(Ct,ln(null===(h=cn.current)||void 0===h?void 0:h.customLayoutOverlays,null!=yt?yt:null)),annotations:Fe,autoPlaceAnnotations:Ee,svgAnnotationRules:He,annotationFrame:0,xAccessor:$n,yAccessor:Nn,annotationData:Dn(null==n?void 0:n.getData())}),ot&&"radial"===I&&e("div",{style:{position:"absolute",left:kt.left+At/2,top:kt.top+St/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ot})]})}return t("div",{ref:xt,className:"stream-ordinal-frame"+(tt?" "+tt:""),role:"group","aria-label":ht||("string"==typeof et?et:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:F?"100%":wt[0],height:E?"100%":wt[1],overflow:"visible"},onKeyDown:On,children:[dt&&e(pr,{tableId:Mt}),dt&&e(hr,{scene:null!==(f=null===(g=cn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:A+" chart",tableId:Mt,chartTitle:"string"==typeof et?et:void 0}),e(fr,{summary:gt}),e(yr,{hoverPoint:qt}),t("div",{role:"img","aria-label":ht||("string"==typeof et?et:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?_n:void 0,onMouseLeave:nn?wn:void 0,children:[Ot&&e("svg",{style:{position:"absolute",top:0,left:0,width:wt[0],height:wt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${kt.left},${kt.top})`,children:Ot})}),e(ac,{width:At,height:St,totalWidth:wt[0],totalHeight:wt[1],margin:kt,scales:Xt,showAxes:be,showGrid:ze,rFormat:Et,rTickValues:Te,axisExtent:Ne}),e("canvas",{ref:Ht,"aria-label":Ki(null!==(m=null===(y=cn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:wt[0],height:wt[1]}}),e(lc,{width:At,height:St,totalWidth:wt[0],totalHeight:wt[1],margin:kt,scales:Xt,showAxes:be,showCategoryTicks:xe,oLabel:It,rLabel:Rt,oFormat:Ft,rFormat:Et,rTickValues:Te,axisExtent:Ne,showGrid:ze,title:et,legend:We,legendHoverBehavior:Ge,legendClickBehavior:Ye,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Xe,legendLayout:Ue,foregroundGraphics:rn(Ct,ln(null===(v=cn.current)||void 0===v?void 0:v.customLayoutOverlays,null!=yt?yt:null)),annotations:Fe,autoPlaceAnnotations:Ee,svgAnnotationRules:He,annotationFrame:Kt,xAccessor:$n,yAccessor:Nn,annotationData:Dn(null===(b=cn.current)||void 0===b?void 0:b.getData()),underlayRendered:!0}),(ct||ut)&&"radial"!==I&&e(cc,{width:At,height:St,totalWidth:wt[0],totalHeight:wt[1],margin:kt,scales:Xt,onBrush:ut||(()=>{})}),ot&&"radial"===I&&e("div",{style:{position:"absolute",left:kt.left+At/2,top:kt.top+St/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ot}),(null==lt?void 0:lt.showBadge)&&e(Jn,{isStale:Jt,position:lt.badgePosition}),e(vr,{active:An.current>=0,hoverPoint:qt,margin:kt,size:wt,shape:null===(x=Sn.current)||void 0===x?void 0:x.shape,width:null===(w=Sn.current)||void 0===w?void 0:w.w,height:null===(k=Sn.current)||void 0===k?void 0:k.h}),Mn]})]})});function $c({ref:e,frameRef:t,setup:n}){return p(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Nc(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:a,categoryIndexMap:s,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=jt(e,t,n)}else c.fill=gs(o,i,a,f?r:void 0,s);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,a,s,f,p,y]),v=r(()=>Us(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:u,opacity:d}),[m,l,c,u,d]);return r(()=>Za(v,null!=h?h:null,g),[v,h,g])}Tc.displayName="StreamOrdinalFrame";const Dc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:A,valueExtent:S,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:D,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:E,showCategoryTicks:H,categoryFormat:z,dataIdAccessor:W}=t,{width:G,height:Y,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=o,te=r(()=>ke(s),[s]),ne=Xs({data:te,rawData:s,colorBy:f,colorScheme:p,legendInteraction:D,legendPosition:B,selection:O,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:j,onClick:P,hoverHighlight:M,chartType:"BarChart",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:G,height:Y}),{effectiveLegendProps:oe,effectiveMargin:ie}=$c({ref:n,frameRef:a,setup:ne});Fs("BarChart",te,"categoryAccessor",u),Fs("BarChart",te,"valueAccessor",d);const re=ps(te,y,d),ae=hs(),se=r(()=>new Map,[te]),le=Nc({colorBy:f,colorScale:ne.colorScale,color:I,themeCategorical:ae,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==C?void 0:C.pieceStyle,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=r(()=>Ps({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[u,d,f,g]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Gs({componentName:"BarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(Ms,{componentName:"BarChart",message:ue,width:G,height:Y});const de=vl(A),he=de?[de,...k||[]]:k,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[G,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),W&&{dataIdAccessor:W}),{baselinePadding:x,enableHover:q,showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:g}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:H,oSort:y}),oe),sl({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:w,defaultTooltipContent:ce})),ll({linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),S&&{rExtent:S}),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"BarChart",width:G,height:Y,children:e(Tc,Object.assign({ref:a},ge))})});Dc.displayName="BarChart";const Bc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,valueExtent:S,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:D,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:E,categoryFormat:H}=t,{width:z,height:W,enableHover:G,showGrid:Y,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=r(()=>ke(s),[s]),ee=p||d,te=Xs({data:J,rawData:s,colorBy:ee,colorScheme:y,legendInteraction:D,legendPosition:B,selection:O,linkedHover:_,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:j,onClick:P,hoverHighlight:M,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:z,height:W}),ne=hs(),oe=r(()=>new Map,[J]),ie=Nc({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==C?void 0:C.pieceStyle,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>Ps({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Gs({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:le}=$c({ref:n,frameRef:a,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[z,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:f}),H&&{oFormat:H}),{showGrid:Y}),se),sl({title:V,description:X,summary:U,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:k,defaultTooltipContent:re})),ll({linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return ae?e(Ms,{componentName:"StackedBarChart",message:ae,width:z,height:W}):e(Ns,{componentName:"StackedBarChart",width:z,height:W,children:e(Tc,Object.assign({ref:a},ce))})});Bc.displayName="StackedBarChart";const Ic=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:S={},selection:C,linkedHover:O,onObservation:_,onClick:j,hoverHighlight:P,chartId:M,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:D,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:E}=t,{width:H,height:z,enableHover:W,showGrid:G,showLegend:Y,title:q,description:V,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=o,Z=r(()=>ke(s),[s]),J=p||d,ee=Xs({data:Z,rawData:s,colorBy:J,colorScheme:y,legendInteraction:N,legendPosition:D,selection:C,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:j,hoverHighlight:P,chartType:"GroupedBarChart",chartId:M,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:H,height:z}),te=hs(),ne=r(()=>new Map,[Z]),oe=Nc({colorBy:J,colorScale:ee.colorScale,color:B,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:S.pieceStyle,stroke:I,strokeWidth:R,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>Ps({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),re=Gs({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ae,effectiveMargin:se}=$c({ref:n,frameRef:a,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:Z}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[H,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:Q,rFormat:f}),E&&{oFormat:E}),{showGrid:G}),ae),sl({title:q,description:V,summary:X,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:w,defaultTooltipContent:ie})),ll({linkedHover:O,onObservation:_,onClick:j,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e(Ms,{componentName:"GroupedBarChart",message:re,width:H,height:z}):e(Ns,{componentName:"GroupedBarChart",width:H,height:z,children:e(Tc,Object.assign({ref:a},le))})});function Rc({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=Qa("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),a=Ia({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof o?o:"value")}),s=i(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(r){s.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Ic.displayName="GroupedBarChart";const Fc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Qs(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:m=[3,8],symbolBy:v,symbolMap:b,pointRadius:x=4,pointOpacity:w=.7,categoryPadding:k=20,tooltip:A,annotations:S,valueExtent:C,brush:O,onBrush:_,linkedBrush:j,frameProps:P={},selection:M,linkedHover:L,onObservation:T,onClick:$,hoverHighlight:N,chartId:D,loading:B,loadingContent:I,emptyContent:R,legendInteraction:F,legendPosition:E,color:H,stroke:z,strokeWidth:W,opacity:G,showCategoryTicks:Y,categoryFormat:q}=t,{width:V,height:X,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=o,ie=r(()=>ke(s),[s]),re=Xs({data:ie,rawData:s,colorBy:f,colorScheme:p,legendInteraction:F,legendPosition:E,selection:M,linkedHover:L,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:T,onClick:$,hoverHighlight:N,chartType:"SwarmPlot",chartId:D,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:B,loadingContent:I,emptyContent:R,width:V,height:X}),ae=Rc({brushProp:O,onBrushProp:_,linkedBrush:j,valueAccessor:d}),se=r(()=>{if(y)return uo(ie.map(e=>"function"==typeof y?y(e):e[y]))},[ie,y]),le=hs(),ce=r(()=>new Map,[ie]),ue=Nc({colorBy:f,colorScale:re.colorScale,color:H,themeCategorical:le,colorScheme:p,categoryIndexMap:ce,userPieceStyle:null==P?void 0:P.pieceStyle,stroke:z,strokeWidth:W,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:w,r:y?Mt(e,y,m,se):x})}),de=r(()=>Ps({categoryAccessor:u,valueAccessor:d,groupAccessor:f||void 0,valueFormat:g}),[u,d,f,g]);if(re.earlyReturn)return re.earlyReturn;const he=Gs({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return e(Ms,{componentName:"SwarmPlot",message:he,width:V,height:X});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:ie}),{oAccessor:u,rAccessor:d}),v&&{symbolAccessor:v}),b&&{symbolMap:b}),{projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[V,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,barPadding:k,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:ne,rLabel:oe,rFormat:g}),q&&{oFormat:q}),{showGrid:K,showCategoryTicks:Y}),re.legendBehaviorProps),sl({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:A,defaultTooltipContent:de})),ll({linkedHover:L,onObservation:T,onClick:$,hoverHighlight:N,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),S&&S.length>0&&{annotations:S}),C&&{rExtent:C}),ae.brushStreamProps),Object.fromEntries(Object.entries(P).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"SwarmPlot",width:V,height:X,children:e(Tc,Object.assign({ref:a},ge))})});function Ec(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",a=o.stats||(o.data||o).stats;if(a&&null!=a.median)return t("div",{className:"semiotic-tooltip",style:_r,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=a.n&&t("div",{children:["n = ",a.n]}),null!=a.min&&t("div",{children:["Min: ",a.min.toLocaleString()]}),null!=a.q1&&t("div",{children:["Q1: ",a.q1.toLocaleString()]}),t("div",{children:["Median: ",a.median.toLocaleString()]}),null!=a.q3&&t("div",{children:["Q3: ",a.q3.toLocaleString()]}),null!=a.max&&t("div",{children:["Max: ",a.max.toLocaleString()]}),null!=a.mean&&t("div",{style:{opacity:.8},children:["Mean: ",a.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,a=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=a.length,l=s>0?s%2!=0?a[Math.floor(s/2)]:(a[s/2-1]+a[s/2])/2:null;return t("div",{className:"semiotic-tooltip",style:_r,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),s>0&&t("div",{children:["n = ",s]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:_r,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}Fc.displayName="SwarmPlot";const Hc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Qs(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:S,onClick:C,hoverHighlight:O,chartId:_,loading:j,loadingContent:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:D,opacity:B,showCategoryTicks:I,categoryFormat:R}=t,{width:F,height:E,enableHover:H,showGrid:z,showLegend:W,title:G,description:Y,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:U}=o,K=r(()=>ke(s),[s]),Q=Xs({data:K,rawData:s,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:C,hoverHighlight:O,chartType:"BoxPlot",chartId:_,showLegend:W,userMargin:l,marginDefaults:o.marginDefaults,loading:j,loadingContent:P,emptyContent:M,width:F,height:E}),Z=hs(),J=r(()=>new Map,[K]),ee=Nc({colorBy:f,colorScale:Q.colorScale,color:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:void 0,stroke:N,strokeWidth:D,opacity:B,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=r(()=>Ec(),[]);if(Q.earlyReturn)return Q.earlyReturn;const ne=Gs({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(Ms,{componentName:"BoxPlot",message:ne,width:F,height:E});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:K}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[F,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:X,rLabel:U,rFormat:g}),R&&{oFormat:R}),{showGrid:z,showCategoryTicks:I}),Q.legendBehaviorProps),sl({title:G,description:Y,summary:q,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:v,defaultTooltipContent:te})),ll({linkedHover:A,onObservation:S,onClick:C,hoverHighlight:O,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"BoxPlot",width:F,height:E,children:e(Tc,Object.assign({ref:a},oe))})});Hc.displayName="BoxPlot";const zc=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Wc=g(function(n,o){const a=ws(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=i(null);Qs(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d=zc,valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:S,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:D,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:E,showCategoryTicks:H,categoryFormat:z}=n,{width:W,height:G,enableHover:Y,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=a,ee=r(()=>ke(l),[l]),te=Xs({data:ee,rawData:l,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:B,selection:O,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:P,hoverHighlight:M,chartType:"Histogram",chartId:L,showLegend:V,userMargin:c,marginDefaults:a.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:W,height:G}),ne=Rc({brushProp:k,onBrushProp:A,linkedBrush:S,valueAccessor:h}),oe=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of ee){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[ee,h]),ie=hs(),re=r(()=>new Map,[ee]),ae=Nc({colorBy:y,colorScale:te.colorScale,color:I,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,a=o.range;return t("div",{className:"semiotic-tooltip",style:_r,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),a&&2===a.length&&t("div",{style:{opacity:.8},children:[Number(a[0]).toFixed(1)," – ",Number(a[1]).toFixed(1)]})]})},[]);if(te.earlyReturn)return te.earlyReturn;const le=Gs({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e(Ms,{componentName:"Histogram",message:le,width:W,height:G});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),w?{rExtent:w}:oe&&{rExtent:oe}),{size:[W,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Z,rLabel:J,rFormat:p}),z&&{oFormat:z}),{showGrid:q,showCategoryTicks:H}),te.legendBehaviorProps),sl({title:X,description:U,summary:K,accessibleTable:Q,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),cl({tooltip:b,defaultTooltipContent:se})),ll({linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),ne.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"Histogram",width:W,height:G,children:e(Tc,Object.assign({ref:s},ce))})});Wc.displayName="Histogram";const Gc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Qs(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:S,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:D,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:E,showCategoryTicks:H,categoryFormat:z}=t,{width:W,height:G,enableHover:Y,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=o,ee=r(()=>ke(s),[s]),te=Xs({data:ee,rawData:s,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:B,selection:O,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:P,hoverHighlight:M,chartType:"ViolinPlot",chartId:L,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:W,height:G}),ne=Rc({brushProp:k,onBrushProp:A,linkedBrush:S,valueAccessor:d}),oe=hs(),ie=r(()=>new Map,[ee]),re=Nc({colorBy:y,colorScale:te.colorScale,color:I,themeCategorical:oe,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>Ec({valueAccessor:d}),[d]);if(te.earlyReturn)return te.earlyReturn;const se=Gs({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(se)return e(Ms,{componentName:"ViolinPlot",message:se,width:W,height:G});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[W,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:v,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),z&&{oFormat:z}),{showGrid:q,showCategoryTicks:H}),te.legendBehaviorProps),sl({title:X,description:U,summary:K,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:b,defaultTooltipContent:ae})),ll({linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),ne.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"ViolinPlot",width:W,height:G,children:e(Tc,Object.assign({ref:a},le))})});Gc.displayName="ViolinPlot";const Yc=g(function(t,n){var o;const a=ws(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Qs(n,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:A,frameProps:S={},selection:C,linkedHover:O,onObservation:_,onClick:j,hoverHighlight:P,chartId:M,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:D,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:E}=t,{width:H,height:z,enableHover:W,showGrid:G,showLegend:Y,title:q,description:V,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=a,Z=r(()=>ke(l),[l]),J=Xs({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:D,selection:C,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:j,hoverHighlight:P,chartType:"DotPlot",chartId:M,showLegend:Y,userMargin:c,marginDefaults:a.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:H,height:z}),ee=ps(Z,m,h),te=hs(),ne=r(()=>new Map,[Z]),oe=Nc({colorBy:p,colorScale:J.colorScale,color:B,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:I,strokeWidth:R,opacity:F,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=r(()=>Ps({categoryAccessor:d,valueAccessor:h,valueFormat:f}),[d,h,f]);if(J.earlyReturn)return J.earlyReturn;const re=Gs({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e(Ms,{componentName:"DotPlot",message:re,width:H,height:z});const ae=vl(k),se=ae?[ae,...w||[]]:w,le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[H,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:K,rLabel:Q,rFormat:f}),E&&{oFormat:E}),{showGrid:G,oSort:m}),J.legendBehaviorProps),sl({title:q,description:V,summary:X,accessibleTable:U,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:x,defaultTooltipContent:ie})),ll({linkedHover:O,onObservation:_,onClick:j,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),se&&se.length>0&&{annotations:se}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"DotPlot",width:H,height:z,children:e(Tc,Object.assign({ref:s},le))})});Yc.displayName="DotPlot";const qc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Qs(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:S,onObservation:C,onClick:O,hoverHighlight:_,chartId:j,loading:P,loadingContent:M,emptyContent:L,legendInteraction:T,legendPosition:$,color:N,stroke:D,strokeWidth:B,opacity:I,showCategoryTicks:R,categoryFormat:F}=t,{width:E,height:H,enableHover:z,showGrid:W,showLegend:G,title:Y,description:q,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=r(()=>ke(s),[s]),Z=Xs({data:Q,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:$,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:O,hoverHighlight:_,chartType:"RidgelinePlot",chartId:j,showLegend:G,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:M,emptyContent:L,width:E,height:H}),J=hs(),ee=r(()=>new Map,[Q]),te=Nc({colorBy:y,colorScale:Z.colorScale,color:N,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:D,strokeWidth:B,opacity:I,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=r(()=>Ec(),[]);if(Z.earlyReturn)return Z.earlyReturn;const oe=Gs({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return e(Ms,{componentName:"RidgelinePlot",message:oe,width:E,height:H});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[E,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),F&&{oFormat:F}),{showGrid:W,showCategoryTicks:R,oSort:!1,amplitude:f}),Z.legendBehaviorProps),sl({title:Y,description:q,summary:V,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:b,defaultTooltipContent:ne})),ll({linkedHover:S,onObservation:C,onClick:O,hoverHighlight:_,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"RidgelinePlot",width:E,height:H,children:e(Tc,Object.assign({ref:a},ie))})});qc.displayName="RidgelinePlot";const Vc=g(function(t,n){var o,a;const s=ws(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(a=t.height)&&void 0!==a?a:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:S,hoverHighlight:C,chartId:O,loading:_,loadingContent:j,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:D}=t,{width:B,height:I,enableHover:R,showLegend:F,title:E,description:H,summary:z,accessibleTable:W}=s,G=r(()=>ke(c),[c]),Y=f||h,q=Xs({data:G,rawData:c,colorBy:Y,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:C,chartType:"PieChart",chartId:O,showLegend:F,userMargin:u,marginDefaults:s.marginDefaults,loading:_,loadingContent:j,emptyContent:P,width:B,height:I}),V=hs(),X=r(()=>new Map,[G]),U=Nc({colorBy:Y,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:p,categoryIndexMap:X,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:D,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=r(()=>Ps({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Q=Gs({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:J}=$c({ref:n,frameRef:l,setup:q});if(q.earlyReturn)return q.earlyReturn;const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:G}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[B,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Z),sl({title:E,description:H,summary:z,accessibleTable:W,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:v,defaultTooltipContent:K})),ll({linkedHover:k,onObservation:A,onClick:S,hoverHighlight:C,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Q?e(Ms,{componentName:"PieChart",message:Q,width:B,height:I}):e(Ns,{componentName:"PieChart",width:B,height:I,children:e(Tc,Object.assign({ref:l},ee))})});Vc.displayName="PieChart";const Xc=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:S,hoverHighlight:C,chartId:O,loading:_,loadingContent:j,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:D}=t,{width:B,height:I,enableHover:R,showLegend:F,title:E,description:H,summary:z,accessibleTable:W}=o,G=r(()=>ke(s),[s]),Y=f||u,q=Xs({data:G,rawData:s,colorBy:Y,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:C,chartType:"DonutChart",chartId:O,showLegend:F,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:j,emptyContent:P,width:B,height:I}),V=null!=h?h:Math.max(2,.15*Math.min(B,I)),X=hs(),U=r(()=>new Map,[G]),K=Nc({colorBy:Y,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:p,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:D,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=r(()=>Ps({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),Z=Gs({componentName:"DonutChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:J,effectiveMargin:ee}=$c({ref:n,frameRef:a,setup:q});if(q.earlyReturn)return q.earlyReturn;const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:G}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:K,innerRadius:V,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[B,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),sl({title:E,description:H,summary:z,accessibleTable:W,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:v,defaultTooltipContent:Q})),ll({linkedHover:k,onObservation:A,onClick:S,hoverHighlight:C,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(Ms,{componentName:"DonutChart",message:Z,width:B,height:I}):e(Ns,{componentName:"DonutChart",width:B,height:I,children:e(Tc,Object.assign({ref:a},te))})});function Uc(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function Kc(e){return Math.max(0,Math.min(1,e))}function Qc(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function Zc(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Jc(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Kc(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=Kc(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,a=r>0?(o-t.offset)/r:0,s=Qc(t.color),l=Qc(i.color);if(!s||!l)return.5>a?t.color:i.color;const[c,u,d]=s,[h,g,f]=l;return Zc(c+(h-c)*a,u+(g-u)*a,d+(f-d)*a)}return n[n.length-1].color}function eu(e,t,n){return`${e}-${t}`}Xc.displayName="DonutChart";const tu=g(function(n,o){const a=ws(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),s=i(null),l="context"===n.mode,{compactMode:c}=a,{value:u,min:d=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:w,valueFormat:k,showScaleLabels:A=!c,sweep:S=240,fillZones:C=!0,tooltip:O,annotations:_,frameProps:j={},className:P,stroke:M,strokeWidth:L,opacity:T}=n,{width:$,height:N,title:D,description:B,summary:I,accessibleTable:R}=a,F=f&&"object"==typeof f?f:void 0,E=Math.max(d,Math.min(h,u)),H=h-d||1,z=(E-d)/H,{gaugeData:W,pieceStyle:G,gaugeAnnotations:Y}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=s?h:1,t=eu("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Jc(c.colorStops,e*(t+.5)/n));const i=eu("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(i,{fill:o[0]||a})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-r),u=s?Math.max(0,i-c):0;if(c>0){const e=eu("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=eu("bg",n);p.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:a,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:a},gaugeAnnotations:m}}({min:d,max:h,value:u,thresholds:g,fillColor:p,backgroundColor:y,fillZones:C,showScaleLabels:A,gradientFill:F}),[u,d,h,g,p,y,A,C,F]),q=r(()=>Us(G,{stroke:M,strokeWidth:L,opacity:T}),[G,M,L,T]),{sweepRad:V,startAngleDeg:X}=Uc(S),U=function(e=240){const{sweepRad:t,offsetRad:n}=Uc(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),[a,s]=uo(i),[l,c]=uo(r);return{minX:a,maxX:s,minY:l,maxY:c,width:s-a,height:c-l,cx:(a+s)/2,cy:(l+c)/2}}(S),K=Math.min(10,Math.max(1,Math.min($,N)/12)),Q=U.cx,Z=U.cy,J=Math.max(4,Math.min(($-2*K)/U.width,(N-2*K)/U.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=$/2-Q*J,ne=N/2-Z*J,oe=2*(J+4),ie=r(()=>{if(c&&null==w)return null;if(null!=w)return"function"==typeof w?w(E,d,h):w;const n=k?k(E):Math.round(E)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[w,E,d,h,k,A,J,c]),re=r(()=>l&&null==w?{type:"gauge-value",text:k?k(E):Math.round(E)+""}:null,[l,w,E,k]),ae=r(()=>{if(!b)return null;const e=-Math.PI/2+X*Math.PI/180+z*V,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,z,X,V,ee,x]),se=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||$)/2,a=(i.height||N)/2,s=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*s)),c=Math.max(1,Math.min(5,.6*s));return t("g",{transform:`translate(${r},${a})`,children:[e("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+X*Math.PI/180+(n.value-d)/H*V,a=(i.width||$)/2,s=(i.height||N)/2,l=ee-1,c=J+1,u=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${a},${s})`,children:[e("line",{x1:u,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?e("text",{x:(i.width||$)/2,y:(i.height||N)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[$,N,d,H,X,V,ee,J]),le=r(()=>{const e=[...Y,..._||[]];return ae&&e.push(ae),re&&e.push(re),e},[Y,_,ae,re]),ce=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===W.length)return e(Ms,{componentName:"GaugeChart",message:"No data to display",width:$,height:N});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:q,innerRadius:ee,startAngle:X,sweepAngle:S},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[$,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:N-ne-oe/2,left:te-oe/2,right:$-te-oe/2},enableHover:a.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:$r(O)||ce,svgAnnotationRules:se}),le.length>0&&{annotations:le}),D&&{title:D}),B&&{description:B}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),P&&{className:P}),null!=n.animate&&{animate:n.animate}),j);return e(Ns,{componentName:"GaugeChart",width:$,height:N,children:e(Tc,Object.assign({ref:s},ue))})});tu.displayName="GaugeChart";const nu=g(function(n,o){const a=ws(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=i(null);Qs(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:S,onClick:C,hoverHighlight:O,chartId:_,loading:j,loadingContent:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:D,opacity:B,categoryFormat:I}=n,R="vertical"===y,{width:F,height:E,enableHover:H,showLegend:z,title:W,description:G,summary:Y,accessibleTable:q}=a,V=R?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=r(()=>ke(l),[l]),U=f||g,K=!U,Q=Xs({data:X,rawData:l,colorBy:U,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:C,hoverHighlight:O,chartType:"FunnelChart",chartId:_,showLegend:z,userMargin:c,marginDefaults:V,loading:j,loadingContent:P,emptyContent:M,width:F,height:E});Fs("FunnelChart",X,"stepAccessor",d),Fs("FunnelChart",X,"valueAccessor",h);const Z=hs(),J=r(()=>new Map,[X]),ee=r(()=>{if(K)return $||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,$,Z,p]),te=Nc({colorBy:ee?void 0:U,colorScale:Q.colorScale,color:null!=ee?ee:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:N,strokeWidth:D,opacity:B,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection}),ne=r(()=>n=>{var o,i,r,a,s,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(a=null==c?void 0:c.__funnelPercent)&&void 0!==a?a:null==c?void 0:c.__barFunnelPercent,g=null!==(s=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==s?s:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:_r,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const oe=Gs({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(oe)return e(Ms,{componentName:"FunnelChart",message:oe,width:F,height:E});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:R?"bar-funnel":"funnel"},null!=l&&{data:X}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:R?"vertical":"horizontal",barPadding:R?40:0,pieceStyle:te,size:[F,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:H}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:R,showCategoryTicks:R}),I&&{oFormat:I}),{showGrid:R}),!R&&{connectorOpacity:m}),{showLabels:v}),Q.legendBehaviorProps),W&&{title:W}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ne:$r(b)||ne}),(A||S||C||O)&&{customHoverBehavior:Q.customHoverBehavior}),(S||C||A)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Ns,{componentName:"FunnelChart",width:F,height:E,children:e(Tc,Object.assign({ref:s},ie))})});nu.displayName="FunnelChart";const ou={RdBu:yt,PiYG:mt,PRGn:vt,BrBG:bt,RdYlBu:xt,RdYlGn:wt,Spectral:kt},iu="__likert_neutral_neg",ru="__likert_neutral_pos";function au(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function su(e,t,n,o,i,r){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],a=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:i})}}return l}function lu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:iu,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:ru,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function cu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const a=[];for(const[,e]of r){const t=new Map;let r,s;for(const n of e)n.__likertLevel===iu?r=n:n.__likertLevel===ru?s=n:t.set(n.__likertLevelIndex,n);o&&r&&a.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const uu=["Very Low","Low","Neutral","High","Very High"],du=new Map,hu=g(function(t,n){const a=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:c,margin:u,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:m="count",levels:v=uu,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,valueExtent:S,frameProps:C={},selection:O,linkedHover:_,onObservation:j,onClick:P,hoverHighlight:M,chartId:L,valueFormat:T,loading:$,loadingContent:N,emptyContent:D,legendInteraction:B,legendPosition:I,categoryFormat:R,stroke:F,strokeWidth:E,opacity:H}=t,{width:z,height:W,enableHover:G,showGrid:Y,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=a,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=ss();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=ou[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);r&&s.push(i);for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);return s}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:ae,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=r(()=>au(n,"question"),[n]),g=r(()=>d?au(o,"score"):null,[d,o]),f=r(()=>d?null:au(a,"level"),[d,a]),p=r(()=>d?null:au(s,"count"),[d,s]),y=e||[],m=i([]),v=r(()=>{if(0===y.length)return[];let e=su(y,t,h,g,f,p);return c&&(e=lu(e,t),e=cu(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var n;let o=su(e,t,h,g,f,p);c&&(o=lu(o,t),o=cu(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:s}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:a="right"}){const s=i(new Set),c=i([]),[u,h]=d(0),g=Ca(),f=hs(),p=l(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=l(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||s.current.has(t)||(s.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=l(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{s.current=new Set,c.current=[],h(e=>e+1)},[]);qa(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:Ct,a=t,s=i.map(e=>({[a]:e})),l=Pt(s,a,r);return Ka({data:s,colorBy:a,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:jt})},[e,t,o,n,g,f,u]),k=r(()=>{if(w)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[w,a]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:q,legendPosition:I}),ue=l(ce.wrapPush(e=>{se.current.push(e),ae(se.current)}),[ce.wrapPush,ae,se]),de=l(ce.wrapPushMany(e=>{se.current.push(...e),ae(se.current)}),[ce.wrapPushMany,ae,se]);p(n,()=>({push:ue,pushMany:de,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],ce.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ue,de,ce.resetCategories,se]);const he=Xs({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:B,legendPosition:I,selection:O,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:P,hoverHighlight:M,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:u,marginDefaults:a.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:z,height:W}),ge=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),fe=Nc({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:du,userPieceStyle:null==C?void 0:C.pieceStyle,stroke:F,strokeWidth:E,opacity:H,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===iu||i===ru)return{fill:ge};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===iu||n===ru?pe:n,r=t.__likertCategory||"",a=Math.abs(t.__likertPct||0),s=n===iu||n===ru?2*a:a,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:_r},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${s.toFixed(1)}% (n=${l})`))},[pe]),me=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),Gs({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,f,y,m,v,te]),ve=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),be=r(()=>!1!==q?Object.assign(Object.assign({},he.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||he.legendPosition||"bottom"}):he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,I,q,ve]),xe=r(()=>{const e=Object.assign({},he.margin);if(ee&&!1!==q){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[he.margin,ce.streamingMarginAdjust,J,ee,q,I]),we=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]);if(he.earlyReturn)return he.earlyReturn;const ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:fe,size:[z,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:w,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Q,rLabel:Z||(J?void 0:"Percentage"),rFormat:we}),R&&{oFormat:R}),{showGrid:Y}),be),V&&{title:V}),X&&{description:X}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:!1===k?()=>null:!0===k?ye:$r(k)||ye}),(_||j||P||M)&&{customHoverBehavior:he.customHoverBehavior}),(j||P||_)&&{customClickBehavior:he.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return me?e(Ms,{componentName:"LikertChart",message:me,width:z,height:W}):e(Ns,{componentName:"LikertChart",width:z,height:W,children:e(Tc,Object.assign({ref:s},ke))})});hu.displayName="LikertChart";const gu=g(function(t,n){const o=ws(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:S,linkedHover:C,onObservation:O,onClick:_,hoverHighlight:j,chartId:P,loading:M,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:N,color:D,stroke:B,strokeWidth:I,opacity:R,categoryFormat:F,rTickValues:E,tickLabelEdgeAlign:H,showCategoryTicks:z,gradientFill:W,trackFill:G,roundedTop:Y,valueExtent:q}=t,{width:V,height:X,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=o,ie=r(()=>ke(s),[s]),re=p||d,ae=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,e.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?X:V)-2*n)/(n-1))):1},[m,t.mode,ie,u,g,V,X]),se=Xs({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:$,legendPosition:N,selection:S,linkedHover:C,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:_,hoverHighlight:j,chartType:"SwimlaneChart",chartId:P,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:L,emptyContent:T,width:V,height:X}),le=Rc({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h}),ce=hs(),ue=r(()=>new Map,[ie]),de=Nc({colorBy:re,colorScale:se.colorScale,color:D,themeCategorical:ce,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:B,strokeWidth:I,opacity:R,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,cycleByCategory:!0}),he=r(()=>Ps({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ge=Gs({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:fe,effectiveMargin:pe}=$c({ref:n,frameRef:a,setup:se});if(se.earlyReturn)return se.earlyReturn;const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[V,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:ae,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===z?void 0:ne,rLabel:oe,rFormat:f}),E&&{rTickValues:E}),null!=H&&{tickLabelEdgeAlign:H}),F&&{oFormat:F}),void 0!==z&&{showCategoryTicks:z}),{showGrid:K}),fe),sl({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),cl({tooltip:v,defaultTooltipContent:he})),ll({linkedHover:C,onObservation:O,onClick:_,hoverHighlight:j,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),W&&{gradientFill:!0===W?{topOpacity:.8,bottomOpacity:.05}:W}),null!=G&&{trackFill:G}),null!=Y&&{roundedTop:Y}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e(Ms,{componentName:"SwimlaneChart",message:ge,width:V,height:X}):e(Ns,{componentName:"SwimlaneChart",width:V,height:X,children:e(Tc,Object.assign({ref:a},ye))})});gu.displayName="SwimlaneChart";const fu={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},pu={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class yu{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const n=this.particles[t];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,n,o){var i;for(let r=0;this.capacity>r;r++){const a=this.particles[r];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(r);continue}const l=o&&null!==(i=o[a.edgeIndex])&&void 0!==i?i:1;a.t+=e*t*l*(s.bezier.circular?.3:1),1>a.t?mu(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}}function mu(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,i){const r=e.length,a=t*r,s=Math.min(Math.floor(a),r-1),l=a-s,[c,u,d,h]=e[s];vu(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*n*o*2,i.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[i,r,a,s]=e.points;vu(i,r,a,s,t,o);const l=s.x-i.x,c=s.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function vu(e,t,n,o,i,r){const a=1-i,s=a*a,l=s*a,c=i*i,u=c*i;r.x=l*e.x+3*s*i*t.x+3*a*c*n.x+u*o.x,r.y=l*e.y+3*s*i*t.y+3*a*c*n.y+u*o.y}function bu(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function xu(e,t){var n,o=[],i=[],r=[],a={},s=[];function l(e){r[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],r[t]&&l(t)})}function c(e){var t,o,d=!1;for(i.push(e),r[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,i),d=!0):r[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return i.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),i=Array(t),r=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,i[l]=!1,r[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}r[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var w=0;m[f].length>w;w++)x[--v]=m[f][w];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=o.components.filter(function(e){return e.length>1}),r=1/0,a=0;i.length>a;a++)for(var s=0;i[a].length>s;s++)r>i[a][s]&&(r=i[a][s],n=a);var l=i[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];r[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function wu(e){return e.y0-e.y1>0?"up":"down"}function ku(e,t){return t(e.source)==t(e.target)}function Au(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Su(e){return e.target.x0-e.source.x1}function Cu(e,t){var n=_u(e),o=Su(t)/Math.tan(n);return"up"==wu(e)?e.y1-o:e.y1+o}function Ou(e,t){var n=_u(e),o=Su(t)/Math.tan(n);return"up"==wu(e)?e.y1+o:e.y1-o}function _u(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ju(e,t){return t(e)}function Pu(e){return Lu(e.source)}function Mu(e){return Lu(e.target)}function Lu(e){return(e.y0+e.y1)/2}function Tu(e){return e.virtual?0:e.value}function $u(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!ku(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!ku(e,t)?o+1:o}),n+o}function Nu(e){return e.target.depth}function Du(e,t){return e.sourceLinks.length?e.depth:t-1}function Bu(e,t){return e.y0-t.y0}function Iu(e,t){return t.y0-e.y0}function Ru(e,t){return e.y1-t.y1}function Fu(e,t){return t.y1-e.y1}function Eu(e,t){return zu(e.source,t.source)||e.index-t.index}function Hu(e,t){return zu(e.target,t.target)||e.index-t.index}function zu(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Wu(e,t){return Gu(e)==Gu(t)?"bottom"==e.circularLinkType?Iu(e,t):Bu(e,t):Gu(t)-Gu(e)}function Gu(e){return e.target.column-e.source.column}function Yu(e,t){return qu(e)==qu(t)}function qu(e){return e.y0-e.y1>0?"up":"down"}function Vu(e,t,n,o,i){let r=e;var a=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=Q(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Xu(r.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Xu(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,ku(e,t)&&Au(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Iu:Bu);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=r.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Fu:Ru),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,i=e.y1,r=(t+o)/2;return"M"+t+","+n+"C"+r+","+n+" "+r+","+i+" "+o+","+i}(e)}),r}function Xu(e,t,n){e.sort(Wu);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(ku(e,t)&&Au(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Uu(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function Uu(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Ku(e){return function(){return e}}function Qu(e){return e.index}function Zu(e){return e.nodes}function Ju(e){return e.links}function ed(e,t,n){var o=Z(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(i,r){var a=i.length;if(t)i.sort(t);else if(r>0){var s=new Map;i.forEach(function(e,t){var n,o,i,r=(o=0,i=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Lu(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Lu(e.target)*t,o+=t}}),o>0?i/o:NaN);s.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var n=s.get(e),o=s.get(t),i=n.bc,r=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?n.idx-o.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?$u(t,n)-$u(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==$u(t,n)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+i,t.y1=t.y0+t.value*e.ky)})})}function td(e,t,n,o,i,r){var a=Z(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=r;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(i){var r=i.length,a=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&$u(i,n)>0){var l=te(i.sourceLinks,Mu),c=te(i.targetLinks,Pu),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Lu(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==a&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(a==o-1&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var h=te(i.sourceLinks,Mu),g=te(i.targetLinks,Pu),f=((h&&g?(h+g)/2:h||g)-Lu(i))*t;i.y0+=f,i.y1+=f}})})}function u(){a.forEach(function(n){var r,a,s,l=e.y0,c=n.length;for(n.sort(t||zu),s=0;c>s;++s)(a=l-(r=n[s]).y0)>0&&(r.y0+=a,r.y1+=a),l=r.y1+o;if((a=l-o-e.y1)>0)for(l=r.y0-=a,r.y1-=a,s=c-2;s>=0;--s)(a=(r=n[s]).y1+i-l)>0&&(r.y0-=a,r.y1-=a),l=r.y0})}}function nd(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Hu),e.targetLinks.sort(Eu)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,i=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function od(){var e=0,t=0,n=1,o=1,i=24,r=8,a=null,s=Qu,l=Du,c=void 0,u=32,d=2,h=Zu,g=Ju;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return ne(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,i=e.target;"object"!=typeof o&&(o=e.source=bu(n,o)),"object"!=typeof i&&(i=e.target=bu(n,i)),o.sourceLinks.push(e),i.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],i=0;e.links.length>i;i++){var r=e.links[i],a=r.source.index,s=r.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=xu(o);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:o>n?"top":"bottom","top"==i.circularLinkType?n++:o++,e.nodes.forEach(function(e){ju(e,t)!=ju(i.source,t)&&ju(e,t)!=ju(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),ku(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(ee(e.sourceLinks,Tu),ee(e.targetLinks,Tu)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,i,r;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,r):e.column})}(h,c,l);var g=r;if(null!==a){var f=Z(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=J(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=Z(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=Q(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/ee(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=J(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/r),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,i),ed(h,c,s),td(h,c,s,g,g,u),nd(h),Vu(h,s,d,10,8),ed(h,c,s),td(h,c,s,g,g,u),nd(h),Vu(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return ju(n.source,t)==ju(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Yu(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Cu(t,e);return e.y1-n}if(t.target.column>e.target.column)return Cu(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return ju(n.target,t)==ju(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Yu(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Ou(t,e);return e.y0-n}if(t.source.column>e.source.column)return Ou(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,i=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==o||0==i){var r=Q(t,function(e){return e.y0}),a=J(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-r);function l(t){return(t-r)/(a-r)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Vu(h,s,d,10,8)}(f),f}return f.update=function(e){return nd(e),Vu(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ku(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:Ku(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Ku(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Ku(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],o=+i[1][1],f):[[e,t],[n,o]]},f.size=function(i){return arguments.length?(e=t=0,n=+i[0],o=+i[1],f):[n-e,o-t]},f}function id(e){const{sx:t,sTop:n,sBot:o,tx:i,tTop:r,tBot:a,cp1X:s,cp2X:l}=e,c=(n+o)/2,u=(r+a)/2;return{pathD:[`M${t},${n}`,`C${s},${n} ${l},${r} ${i},${r}`,`L${i},${a}`,`C${l},${a} ${s},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(o-n)/2}}}const rd=e=>{let t,n,o,i,r,a,s,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,a=e.target.x0,s=he(r,a),l=s(.5),c=s(.5),`M${t},${r}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${i},${l} ${i},${r}Z`;const u=e.sankeyWidth/2,d=he(e.source.x1,e.target.x0),{pathD:h}=id({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function ad(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,o=i.sourceY,r=i.targetX,a=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${r},${a-n}L${r-l},${a-n}L${r-l},${a+n}L${r},${a+n}Z`}const r=i.sourceX,a=i.sourceY,s=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${r},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${r},${a+h*n}Z`}const sd=new Set,ld=new WeakMap;function cd(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=ld.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,ld.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;sd.has(e)||(sd.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const ud={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Nu))-1:0},justify:Du};function dd(e){return"string"==typeof e?e:e.id}const hd={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(i=n.nodeWidth)&&void 0!==i?i:15,f=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=od().extent(v).links(m).nodes(y).nodeAlign(ud[h]||Du).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>i&&(i=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const r=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-a&&(e=r.leftFullExtent-a),r.rightFullExtent+a>t&&(t=r.rightFullExtent+a),n>r.verticalFullExtent-a&&(n=r.verticalFullExtent-a),r.verticalFullExtent+a>i&&(i=r.verticalFullExtent+a)}const r=t-e,a=i-n,u=o[0],d=o[1];if(r>0&&a>0&&(0>e||0>n||t>u||i>d)){const t=Math.min(u/r,d/a),o=-e*t+(u-r*t)/2,i=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of m)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+i,n.targetY=n.targetY*t+i,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+i,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+i,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const w=new Map;for(const e of t)w.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=dd(e.source),n=dd(e.target),o=w.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);if(o){o.y0=e.y0,o.y1=e.y1,o.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,o.circular=!!e.circular,o.circularPathData=e.circularPathData,o._circularWidth=e._circularWidth,o._circularStub=e._circularStub,o.path=e.path,o.circularLinkType=e.circularLinkType,o.direction=d;const i=x.get(t),r=x.get(n);i&&(o.source=i),r&&(o.target=r)}}},buildScene(e,t,n,o){var i,r,a,s,l,c;const u="vertical"===n.orientation?"down":"right",d=n.nodeStyle,h=n.edgeStyle,g=null!==(i=n.edgeOpacity)&&void 0!==i?i:.5,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:tt,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=[],v=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=d?d(cd(t,"nodeStyle")):{},i={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),m.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:i,datum:t,id:t.id,label:t.id})}const w=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of w){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(o.id)||y.get(o.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(cd(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,o=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=u.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+o},${t.sourceY-n}L${t.sourceX+o},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+o}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-r},${t.targetY-n}L${t.targetX-r},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:a,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?ad(e):rd(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};v.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null;for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const r=t?t(n):n.id;if(!r)continue;let a,s,l;"down"===u?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(a=n.x0-6,l="end"):(a=n.x1+6,l="start"),s=n.y0+i/2),b.push({x:a,y:s,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var k;return{sceneNodes:m,sceneEdges:v,labels:b}}},gd={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r;if(0===e.length)return;const a=null!==(i=n.forceStrength)&&void 0!==i?i:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=fd(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const i=pd(e.id),r=i%360*(Math.PI/180),a=10+i%20;e.x=t/o.length+a*Math.cos(r),e.y=n/o.length+a*Math.sin(r)}else{const t=pd(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),i=n*t;o.x=s+e*Math.cos(i),o.y=l+e*Math.sin(i)}}}const g=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=yd(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=ge().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),o=fe().force("charge",pe().strength(e=>-25*y(e))).force("center",ye(s,l).strength(.8)).force("x",me(s).strength(.15)).force("y",ve(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.links(e),o.force("link",n)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.edgeStyle,g=yd(n.nodeSize,n.nodeSizeRange,e),f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:tt,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],m=[],v=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(cd(t,"nodeSize")),o=d?d(cd(t,"nodeStyle")):{},s={fill:o.fill||p.get(t.id)||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:2,opacity:o.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:s,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),o="object"==typeof e.target?e.target:b.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const i=h?h(cd(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};m.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=g(cd(n,"nodeSize"));v.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function fd(e,t,n){const o=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let a=null;if(t===e?a=r:r===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function pd(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function yd(e,t,n){var o;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],r=[];for(const t of n){const n=null===(o=t.data)||void 0===o?void 0:o[e];"number"==typeof n&&r.push(n)}if(0===r.length)return()=>i[0];const[a,s]=uo(r);if(a===s)return()=>(i[0]+i[1])/2;const l=w().domain([a,s]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:l(o)}}const md=tt,vd={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-r,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const i=d(e);p[n][o]=i}const y=xe().padAngle(i);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=V().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid({innerRadius:l,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+c,n.y=o[1]+u,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,i=w.get(`${n}\0${o}`)||w.get(`${o}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,o){var i,r,a,s;const{groupWidth:l=20,edgeOpacity:c=.5}=n,u=Math.min(o[0],o[1])/2,d=u-l,h=o[0]/2,g=o[1]/2,f=n.nodeStyle,p=n.edgeStyle,y=n.edgeColorBy||"source",m=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:md,v=new Map;e.forEach((e,t)=>{v.set(e.id,m[t%m.length])});const b=be().radius(d),x=[],w=[],k=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let r;r=f?f(cd(n,"nodeStyle")).fill||v.get(n.id)||m[t%m.length]:v.get(n.id)||m[t%m.length];const a=f?f(cd(n,"nodeStyle")):{},s={fill:r,stroke:a.stroke||"black",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=b(t);if(!o)continue;const i=bd(o,h,g);let l=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(p)l=p(cd(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?l=v.get(n.id)||l:t&&(l=v.get(t.id)||l)}const u=p?p(cd(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};w.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==n.showLabels){const t=(A=n.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,o=u+12;for(const n of e){const e=n.__arcData;if(!e)continue;const i=t?t(n):n.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,a=r-Math.PI/2;k.push({x:h+Math.cos(a)*o,y:g+Math.sin(a)*o,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:w,labels:k}}};function bd(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const i=[];let r=0;for(;o.length>r;){const e=o[r];if("M"===e||"L"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("C"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;3>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("Q"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;2>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("A"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&(i.push(Number(o[r])+t+""),r++),o.length>r&&(i.push(Number(o[r])+n+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(o[r]),r++)}return i.join(" ")}const xd=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function wd(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}function kd(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Ad(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>{var n;return t(null!==(n=e.data)&&void 0!==n?n:e)}}return t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}}function Sd(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:xd}function Cd(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Od(e,t,n,o,i){if("horizontal"===i){const i=(e+n)/2;return`M ${e},${t} C ${i},${t} ${i},${o} ${n},${o}`}if("radial"===i){const i=(e+n)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+o)/2} T ${n},${o}`}{const i=(t+o)/2;return`M ${e},${t} C ${e},${i} ${n},${i} ${n},${o}`}}const _d={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var i;const r=n.__hierarchyRoot;if(!r)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,u=ie(r,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=ue();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=ce();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var i,r;const a=null!==(i=t.padding)&&void 0!==i?i:4,s=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=se().size([n,o]).tile(le).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;ae().size([n,o]).padding(r)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var i;re().size([n,o]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],r={id:kd(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=o.value)&&void 0!==i?i:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?jd(r,o,n):"treemap"===a||"partition"===a?Pd(r,o):"circlepack"===a&&Md(r,o),r.__hierarchyNode=o,e.push(r),f.set(o,r)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const i=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,i,r){var a,s,l,c,u,d,h,g;const f=[],p=[],y=[],m=n.treeOrientation||"vertical",v="radial"===m,b=o[0]/2,x=o[1]/2,w="number"==typeof(k=n.nodeSize)?k:5;var k;for(const t of e){let e=t.x,o=t.y;v&&(e+=b,o+=x);const r=i(cd(t,"nodeStyle"));let l=r.fill||Cd(n);if(n.colorByDepth&&void 0!==t.depth){const e=Sd(n);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(s=r.strokeWidth)&&void 0!==s?s:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:o,r:w,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=n.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=t.x,a=t.y,s=o.x,l=o.y;v&&(i+=b,a+=x,s+=b,l+=x);const g=Od(i,a,s,l,m),f=r(cd(e,"edgeStyle")),y={fill:"none",stroke:f.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=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==n.showLabels){const t=Ad(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,i,r,a=n.x,s=n.y;if(v&&(a+=b,s+=x),v){const e=a-b,t=s-x,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,i=s+t/n*10,r=0>e?"end":"start"):(o=a,i=s-12,r="middle")}else"horizontal"===m?((null===(g=n.data)||void 0===g?void 0:g.children)&&0!==n.data.children.length?(o=a-w-6,r="end"):(o=a+w+6,r="start"),i=s):(o=a,i=s+w+14,r="middle");y.push({x:o,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,n,o,i,r);case"treemap":case"partition":return function(e,t,n,o){var i,r,a,s,l;const c=[],u=[];for(const n of e){const e=n.x1-n.x0,a=n.y1-n.y0;if(0>=e||0>=a)continue;const s=o(cd(n,"nodeStyle"));let l=s.fill||Cd(t);if(t.colorByDepth&&void 0!==n.depth){const e=Sd(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.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:e,h:a,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ad(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(a=c.data)||void 0===a?void 0:a.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=n?n(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=o(cd(c,"nodeStyle")).fill||Cd(t);if(t.colorByDepth&&void 0!==c.depth){const e=Sd(t);f=e[c.depth%e.length]}const p="string"==typeof f?wd(f):null!==(l=null===(s=t.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,i);case"circlepack":return function(e,t,n,o){var i,r,a,s,l,c,u,d,h,g;const f=[],p=[];for(const n of e){const e=null!==(i=n.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=o(cd(n,"nodeStyle"));let c=l.fill||Cd(t);if(t.colorByDepth&&void 0!==n.depth){const e=Sd(t);c=e[n.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=l.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=l.opacity)&&void 0!==s?s:.7};f.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ad(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=n?n(i):i.id;if(!r)continue;if(15>e)continue;const a=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let s=o(cd(i,"nodeStyle")).fill||Cd(t);if(t.colorByDepth&&void 0!==i.depth){const e=Sd(t);s=e[i.depth%e.length]}if(a){const n="string"==typeof s?wd(s):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function jd(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Pd(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Md(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Ld(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Td={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const i=n.__hierarchyRoot;i&&function(e,t,n,o,i){var r,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Ld(n);f.metaMap.clear(),o.length=0,i.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,r,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,w=0;for(;v>x;)x+=c[Math.min(w,c.length-1)],w++,b++;let k=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],w=m.slice(k,k+x);if(!w.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},C=p?u/h(S)*A:u*A,O=X().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),_=O(w),j=g(S);for(let t=0;w.length>t;t++){const s=(_[t].startAngle+_[t].endAngle)/2,c=w[t],u=y(l(c)),h=r+C*Math.sin(s),g=a+C*Math.cos(s)*j;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:C,angle:s,depth:d,parentId:n,eccentricity:j}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,C,d+1,!0)}k+=x}}(e,x,m,v,b,1,!1)}(i,o,n,e,t)},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==n.orbitShowRings){const t=Ld(n),o=new Map;for(const t of e)o.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;i.has(n)||i.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of i)for(let i=0;r>i;i++){const s=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(cd(t,"nodeSize")),o=d?d(cd(t,"nodeStyle")):{},c={fill:o.fill||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=o.opacity)&&void 0!==s?s:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),n="object"==typeof e.target?e.target:m.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=g(cd(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(u=null===(c=n.data)||void 0===c?void 0:c[t])&&void 0!==u?u:n.id;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,n,o,i)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const i=Ld(t),r=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},$d={sankey:hd,force:gd,chord:vd,tree:_d,cluster:_d,treemap:_d,circlepack:_d,partition:_d,orbit:Td};function Nd(e){return $d[e]}class Dd{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,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._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},fu),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new yu(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(e.layoutSelection=t.layoutSelection),this.config=e,this.tensionConfig=Object.assign(Object.assign({},fu),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new yu(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Bd(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",i=c(n)+"",r=u(n),a=null==r?NaN:Number(r),s=Number.isFinite(a)?a:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Bd(o)),{data:n})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Bd(i)),{data:n}));const d=`${o}\0${i}\0${e}`,h={source:o,target:i,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&Id(n.bezier)&&(h.bezier=n.bezier),this.edges.set(d,h)}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,i=0===this.nodes.size;let r=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Bd(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,Bd(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,r=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,i,r,a,s,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Nd(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const s of u)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(i=s._prevY0)&&void 0!==i?i:0);e.set(s.id,{x:(null!==(r=s._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}setLayoutSelection(e){this.config.layoutSelection=e}snapshotBaseStyles(){this._baseStyles=new WeakMap;for(const e of this.sceneNodes)this._baseStyles.set(e,e.style);for(const e of this.sceneEdges)this._baseStyles.set(e,e.style)}restyleScene(e){var t,n;if(this._customRestyle){const n=this._customRestyle;for(const o of this.sceneNodes){const i=null!==(t=this._baseStyles.get(o))&&void 0!==t?t:o.style,r=n(o,e);o.style=r?Object.assign(Object.assign({},i),r):i}}if(this._customRestyleEdge){const t=this._customRestyleEdge;for(const o of this.sceneEdges){const i=null!==(n=this._baseStyles.get(o))&&void 0!==n?n:o.style,r=t(o,e);o.style=r?Object.assign(Object.assign({},i),r):i}}}buildScene(e){var t,n,o,i,r,a,s,l,c;if(this._sceneNodesRevision++,this.config.customNetworkLayout){const u=Array.from(this.nodes.values()),d=Array.from(this.edges.values()),h=Kl(this.config.colorScheme,this.config.themeCategorical,tt),g={nodes:u,edges:d,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...h]},resolveColor:Ql(h),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{},selection:null!==(o=this.config.layoutSelection)&&void 0!==o?o:null};let f;try{f=this.config.customNetworkLayout(g)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,void(this.customLayoutHtmlMarks=[])}return this.sceneNodes=null!==(i=f.sceneNodes)&&void 0!==i?i:[],this.sceneEdges=null!==(r=f.sceneEdges)&&void 0!==r?r:[],this.labels=null!==(a=f.labels)&&void 0!==a?a:[],this.customLayoutOverlays=null!==(s=f.overlays)&&void 0!==s?s:null,this.customLayoutHtmlMarks=null!==(l=f.htmlMarks)&&void 0!==l?l:[],this._customRestyle=f.restyle,this._customRestyleEdge=f.restyleEdge,this.hasCustomRestyle=!(!f.restyle&&!f.restyleEdge),this.hasCustomRestyle&&(this.snapshotBaseStyles(),this.restyleScene(null!==(c=this.config.layoutSelection)&&void 0!==c?c:null)),void Zt({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[];const u=Nd(this.config.chartType);if(!u)return;const d=u.hierarchical?Array.from(this.nodes.values()):this.nodesArray,h=u.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:g,sceneEdges:f,labels:p}=u.buildScene(d,h,this.config,e);this.sceneNodes=g,this.sceneEdges=f,this.labels=p}rebuildNodeQuadtree(){let e=0,t=0;for(const n of this.sceneNodes)"circle"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxNodeRadius=t,Dd.QUADTREE_THRESHOLD>=e)return void(this._nodeQuadtree=null);const n=Array(e);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[o++]=e);this._nodeQuadtree=O().x(e=>e.cx).y(e=>e.cy).addAll(n)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Nd(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Nd(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,i=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(o,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Nt(e,this.transition),n=$t(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Dt(e._prevX0,e._targetX0,n),e.x1=Dt(e._prevX1,e._targetX1,n),e.y0=Dt(e._prevY0,e._targetY0,n),e.y1=Dt(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Dt(e._prevY0,e._targetY0,n),e.y1=Dt(e._prevY1,e._targetY1,n),e.sankeyWidth=Dt(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=null==e?void 0:e.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=n.x0,a=he(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:r}],halfWidth:o}}const i=t.x1,r=n.x0,a=he(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const i=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],r=n.x-t.x,a=n.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+a/3},{x:t.x+2*r/3,y:t.y+2*a/3},n])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,i,r;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const i=e-o;s>i&&(t._pulseIntensity=1-i/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(i=n.source)||void 0===i?void 0:i.id:n.source,a="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;if(!this._decaySortedNodes){this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const e=new Map;for(let t=0;this._decaySortedNodes.length>t;t++)e.set(this._decaySortedNodes[t][0],t);this._decayAgeMap=e}const i=this._decayAgeMap;for(const r of this.sceneNodes){const a=r.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const l=Lt(n,s,o),c=null!==(t=null===(e=r.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;r.style=Object.assign(Object.assign({},r.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const i=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const i=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}updateEdge(e,t,n){var o;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,a=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){a.push(i.data?Object.assign({},i.data):{}),i.data=n(null!==(o=i.data)&&void 0!==o?o:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return a.length>0&&(this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now()),a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&o(i.data)===e&&n.push(t)}else for(const[o,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&(this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now()),n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,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.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear()}}function Bd(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Id(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Rd(e))return!1;return!0}return Rd(t.points)}function Rd(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function Fd(e,t,n,o,i=30,r,a=0){let s=null,l=i,c=1/0;if(r){const e=fn(r,n,o,i,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(r&&"circle"===t.type)continue;const e=Ed(t,n,o,i);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(s=e,c=n)}else l>e.distance&&(s=e,l=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=Yd(e,n,o);t&&l>t.distance&&(s=t,l=t.distance)}return s}function Ed(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,a=Math.sqrt(i*i+r*r);return a>un(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=cn(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const a=gn(Math.atan2(i,o)),s=gn(e.startAngle),l=gn(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);case"symbol":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,a=Math.sqrt(i*i+r*r);return a>un(Kt(e.size),o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);default:return null}}Dd.QUADTREE_THRESHOLD=500;let Hd=null,zd=null;function Wd(){return zd||(Hd=document.createElement("canvas"),Hd.width=1,Hd.height=1,zd=Hd.getContext("2d")),zd}function Gd(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function Yd(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=Gd(e),i=Wd();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,i=e.y2-e.y1,r=o*o+i*i;if(0===r)return null;let a=((t-e.x1)*o+(n-e.y1)*i)/r;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*i,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=Gd(e),i=Wd();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function qd(i){const{width:r,height:a,totalWidth:s,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:m="right",legendLayout:v,foregroundGraphics:b,sceneNodes:x,annotations:w,autoPlaceAnnotations:k,svgAnnotationRules:A}=i,S=o.useMemo(()=>{const e=(x||[]).flatMap(e=>{const t=function(e){var t,n,o,i;const r=null!==(t=e.cx)&&void 0!==t?t:null!=e.x&&null!=e.w?e.x+e.w/2:e.x,a=null!==(n=e.cy)&&void 0!==n?n:null!=e.y&&null!=e.h?e.y+e.h/2:e.y;return"number"!=typeof r||"number"!=typeof a?null:{x:r,y:a,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Kt(e.size)):Math.max(1,null!==(o=e.w)&&void 0!==o?o:0,null!==(i=e.h)&&void 0!==i?i:0)/2}}(e),n=function(e){var t,n,o,i,r,a,s,l;const c=null!==(a=null!==(o=null!==(t=e.id)&&void 0!==t?t:null===(n=e.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:null===(r=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===r?void 0:r.id)&&void 0!==a?a:null===(l=null===(s=e.datum)||void 0===s?void 0:s.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:n},t)]:[]});return{scales:null,width:r,height:a,frameType:"network",pointNodes:e,sceneNodes:x}},[a,x,r]),C=o.useMemo(()=>w&&k?ii(Object.assign({annotations:w,context:S},"object"==typeof k?k:{})):w,[w,k,S]),O=C?No(C.reduce((t,n,i)=>{if("widget"===n.type||!A)return t;const r=A(n,i,S);return r&&t.push({node:e(o.Fragment,{children:r},"annotation-"+i),annotation:n}),t},[])):null,_=!0===(null==C?void 0:C.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return t(n,{children:[_&&e("style",{children:Po},"annotation-widget-disclosure-style"),t("svg",{role:"img",width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,n)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+n)),O,b]}),d&&"string"==typeof d?e("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?e("foreignObject",{x:0,y:0,width:s,height:c.top,children:d}):null,co({legend:h,totalWidth:s,totalHeight:l,margin:c,legendPosition:m,title:d,legendLayout:v,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==C?void 0:C.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,n)=>{var o,i,r,a,s,l,u,d,h;const g=!0===t._annotationDeferred,f=x.find(e=>{var n,o,i,r,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(i=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(a=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===a?void 0:a.name)===t.nodeId});if(!f)return null;const p=c.left+(null!==(o=f.cx)&&void 0!==o?o:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(i=f.x)&&void 0!==i?i:0),y=c.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(a=f.y)&&void 0!==a?a:0),m=null!==(s=t.dx)&&void 0!==s?s:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,b=null!==(u=t.width)&&void 0!==u?u:32,w=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{className:g?"annotation-deferred":void 0,"data-annotation-disclosure":g?"deferred":void 0,style:{position:"absolute",left:p+m-b/2,top:y+v-w/2,width:b,height:w,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:k},"widget-"+n)})]})}qd.displayName="NetworkSVGOverlay";const Vd={position:"absolute",top:0,left:0,pointerEvents:"none"};function Xd({marks:t,margin:n,selection:i=null,overscan:r=400}){const a=o.useRef(null),s=function(e,t,n){const[i,r]=o.useState(null);return o.useLayoutEffect(()=>{const e=t.current,n=function(e){var t;let n=null!==(t=null==e?void 0:e.parentElement)&&void 0!==t?t:null;for(;n;){const{overflow:e,overflowX:t,overflowY:o}=window.getComputedStyle(n);if(/(auto|scroll|overlay)/.test(`${e} ${o} ${t}`))return n;n=n.parentElement}return null}(e);if(!e||!n)return void r(null);let o=0;const i=()=>{o=0;const t=n.getBoundingClientRect(),i=e.getBoundingClientRect();r(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},a=()=>{0===o&&(o=window.requestAnimationFrame(i))};i(),n.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(n),()=>{0!==o&&window.cancelAnimationFrame(o),n.removeEventListener("scroll",a),s.disconnect()}},[t,e,n]),o.useMemo(()=>{if(!e||!i)return e;const{scroll:t,originX:o,originY:r}=i,a=t.left-n,s=t.right+n,l=t.top-n,c=t.bottom+n;return e.filter(e=>{const t=o+e.x,n=r+e.y;return!(a>t+e.width||t>s||l>n+e.height||n>c)})},[e,i,n])}(t,a,r);if(!t||0===t.length)return null;const l=e("div",{className:"semiotic-network-html-marks",ref:a,style:Object.assign(Object.assign({},Vd),{transform:`translate(${n.left}px, ${n.top}px)`}),children:(null!=s?s:t).map(t=>e("div",{className:"semiotic-network-html-mark","data-mark-id":t.id,style:{position:"absolute",transform:`translate(${t.x}px, ${t.y}px)`,width:t.width,height:t.height,pointerEvents:"none"},children:t.content},t.id))});return null!=i?e(sn,{value:i,children:l}):l}const Ud=new Map;function Kd(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=Ud.get(n);return o||(o=new Path2D(Ut(e.symbolType,e.size)),Ud.size>256&&Ud.clear(),Ud.set(n,o)),o}catch(e){return null}}function Qd(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Zd(e,t){var n,o,i,r,a,s;if(!t.pathD)return;e.save();const l=Qd(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const i=e.createLinearGradient(a.x0,0,a.x1,0),r=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999",l=kn(e,s)||s;i.addColorStop(0,1===a.from?l:"transparent"),i.addColorStop(1,1===a.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Jd(e,t){var n,o;e.save();const i=t.style.stroke||"#999";e.strokeStyle=kn(e,i)||i,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function eh(e,t){var n,o,i,r;if(!t.pathD)return;e.save();const a=Qd(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function th(e,t){var n,o;if(!t.pathD)return;e.save();const i=Qd(t),r=t.style.stroke||"#999";e.strokeStyle=kn(e,r)||r,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(i)),e.restore()}const nh={top:20,right:80,bottom:20,left:80},oh={top:40,right:40,bottom:40,left:40},ih=new Set(["chord","force","circlepack","orbit"]),rh=[800,600],ah={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 sh({data:n}){var o,i,r,a,s,l,c;if("edge"===n.nodeOrEdge){const e=n.data;return e?t("div",{className:"semiotic-tooltip",style:ah,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const u=n.data;if(!u)return null;const d=u.__hierarchyNode;if(d){const n=[];let s=d;for(;s;){const e=null!==(a=null!==(i=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==i?i:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==a?a:u.id;null!=e&&n.unshift(e+""),s=s.parent}n.length>1&&n.shift();const l=n.length-1;return t("div",{className:"semiotic-tooltip",style:ah,children:[e("div",{children:n.map((n,o)=>t("span",{children:[o>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===l?e("strong",{children:n}):e("span",{style:{opacity:.7},children:n})]},o))}),null!=u.value&&u.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof u.value?u.value.toLocaleString():u.value+""})]})}const h=((null===(s=u.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(l=u.targetLinks)||void 0===l?void 0:l.length)||0),g=(u.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(u.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),f=Or(null!==(c=u.data)&&void 0!==c?c:u),p=null!=f.title?f.title+"":u.id,y=f.entries.some(e=>lh.test(e.key));return t("div",{className:"semiotic-tooltip",style:ah,children:[e("div",{style:{fontWeight:600},children:p}),f.entries.map(e=>t("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Ss(e.value)]},e.key)),!y&&null!=u.value&&u.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof u.value?u.value.toLocaleString():u.value+""]}),h>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",h,g!==h&&` (weighted: ${g.toLocaleString()})`]})]})}const lh=/^(value|amount|total|count|weight|score)$/i;sh.ownsChrome=!0;const ch=g(function(n,o){var s,c,u,h,g,f,y,m,v,b,x,w,k,A,S,C,O,_,j;const{chartType:P,nodes:M,edges:L,data:T,initialEdges:$,nodeIDAccessor:N="id",sourceAccessor:D="source",targetAccessor:B="target",valueAccessor:I="value",edgeIdAccessor:R,childrenAccessor:F,hierarchySum:E,orientation:H="horizontal",nodeAlign:z="justify",nodePaddingRatio:W=.05,nodeWidth:G=15,iterations:Y=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:U=20,sortGroups:K,edgeSort:Q,treeOrientation:Z="vertical",edgeType:J="curve",padding:ee,paddingTop:te,tensionConfig:ne,showParticles:oe=!1,particleStyle:ie,nodeStyle:re,edgeStyle:ae,colorBy:se,colorScheme:le="category10",edgeColorBy:ce="source",edgeOpacity:ue=.5,colorByDepth:de=!1,nodeSize:he=8,nodeSizeRange:ge=[5,20],nodeLabel:fe,showLabels:pe=!0,labelMode:ye,size:me=rh,responsiveWidth:ve,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Ce,customHoverBehavior:Oe,customClickBehavior:_e,onObservation:je,chartId:Me,onTopologyChange:Le,annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,legend:De,legendPosition:Be,legendLayout:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:Ee,legendIsolatedCategories:He,title:ze,foregroundGraphics:We,backgroundGraphics:Ge,decay:Ye,pulse:qe,transition:Ve,animate:Xe,staleness:Ue,thresholds:Ke,accessibleTable:Qe=!0,description:Ze,summary:Je,orbitMode:et,orbitSize:tt,orbitSpeed:nt,orbitRevolution:ot,orbitRevolutionStyle:it,orbitEccentricity:rt,orbitShowRings:at,orbitAnimated:st,customNetworkLayout:lt,layoutConfig:ct,layoutSelection:ut}=n,dt=ih.has(P)?oh:nh,ht=i(!0),gt=Er({sizeProp:me,responsiveWidth:ve,responsiveHeight:be,userMargin:xe,marginDefault:dt,foregroundGraphics:We,backgroundGraphics:Ge,animate:Xe,transitionProp:Ve,themeDirtyRef:ht}),{reducedMotionRef:ft,responsiveRef:pt,size:yt,margin:mt,adjustedWidth:vt,adjustedHeight:bt,resolvedForeground:xt,resolvedBackground:wt,transition:kt,introEnabled:At,tableId:Ct,rafRef:Ot,renderFnRef:_t,scheduleRender:jt,currentTheme:Pt}=gt,Mt=Bi(),Lt=Ei(),Tt=r(()=>ke(M),[M]),$t=r(()=>Array.isArray(L)?ke(L):L,[L]),Nt=r(()=>Object.assign(Object.assign({},fu),ne),[ne]),Dt=r(()=>Object.assign(Object.assign({},pu),ie),[ie]),Bt=r(()=>{var e;return{chartType:P,nodeIDAccessor:N,sourceAccessor:D,targetAccessor:B,valueAccessor:I,edgeIdAccessor:R,childrenAccessor:F,hierarchySum:E,orientation:H,nodeAlign:z,nodePaddingRatio:W,nodeWidth:G,iterations:Y,forceStrength:q,padAngle:X,groupWidth:U,sortGroups:K,edgeSort:Q,treeOrientation:Z,edgeType:J,padding:ee,paddingTop:te,tensionConfig:Nt,showParticles:oe,particleStyle:Dt,nodeStyle:re,edgeStyle:ae,nodeLabel:fe,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:le,themeCategorical:null===(e=null==Pt?void 0:Pt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Pe(Pt),edgeColorBy:ce,edgeOpacity:ue,colorByDepth:de,nodeSize:he,nodeSizeRange:ge,decay:Ye,pulse:qe,transition:kt,introAnimation:At,staleness:Ue,thresholds:Ke,orbitMode:et,orbitSize:tt,orbitSpeed:nt,orbitRevolution:ot,orbitRevolutionStyle:it,orbitEccentricity:rt,orbitShowRings:at,orbitAnimated:st,customNetworkLayout:lt,layoutConfig:ct}},[P,N,D,B,I,F,E,H,z,W,G,Y,q,X,U,K,Q,Z,J,ee,te,Nt,oe,Dt,re,ae,fe,pe,ye,se,le,ce,ue,de,he,ge,Ye,qe,null==kt?void 0:kt.duration,null==kt?void 0:kt.easing,At,Ue,Ke,et,tt,nt,ot,it,rt,at,st,Pt,lt,ct]),It=zi(Bt),Rt=zi({chartType:P,nodeIDAccessor:N,sourceAccessor:D,targetAccessor:B,valueAccessor:I,childrenAccessor:F,hierarchySum:E,orientation:H,nodeAlign:z,nodePaddingRatio:W,nodeWidth:G,iterations:Y,forceStrength:q,padAngle:X,groupWidth:U,sortGroups:K,edgeSort:Q,treeOrientation:Z,edgeType:J,padding:ee,paddingTop:te,tensionConfig:Nt,orbitMode:et,orbitSize:tt,orbitEccentricity:rt,customNetworkLayout:lt}),Ft=i(null),Et=i(0),Ht=i(0),zt=i(!1),Wt=i(null);Wt.current||(Wt.current=new Dd(It));const[Gt,Yt]=d(null),[qt,Vt]=d(0),[Xt,Kt]=d(0),[Qt,Zt]=d(!1),Jt=i(null),en=i(new Map),tn=i(0),nn=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!en.current.has(t+"")){const e=Array.isArray(le)?le:St;en.current.set(t+"",e[tn.current++%e.length])}return en.current.get(t+"")}}if(en.current.has(e.id))return en.current.get(e.id);const t=Array.isArray(le)?le:St,n=se?t[tn.current++%t.length]:t[0];return en.current.set(e.id,n),n},[se,le]),on=(null===(s=null==Pt?void 0:Pt.colors)||void 0===s?void 0:s.border)||(null===(c=null==Pt?void 0:Pt.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==Pt?void 0:Pt.colors)||void 0===u?void 0:u.primary)||"#999",an=l(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Wt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),sn=l(e=>{if("function"==typeof ce)return ce(e);const t=an(e.source),n=an(e.target);return"target"===ce&&n?nn(n):t?nn(t):on},[ce,nn,on,an]),cn=l(e=>{if("function"==typeof Dt.color){const t=an(e.source);return t?Dt.color(e,t):on}if(!(null==ie?void 0:ie.colorBy))return sn(e);const t=Dt.colorBy,n=an(e.source),o=an(e.target);return"target"===t&&o?nn(o):n?nn(n):on},[null==ie?void 0:ie.colorBy,Dt.color,Dt.colorBy,nn,sn,on,an]),un=("sankey"===P||!!lt)&&oe||!!qe||null!==(g=null===(h=Wt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;a(()=>{var e;null===(e=Wt.current)||void 0===e||e.updateConfig(It),ht.current=!0,jt()},[It,jt]);const dn=i(null);a(()=>{const e=Wt.current;if(!e)return;const t=null!=ut?ut:null;dn.current!==t&&(dn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):ht.current=!0,jt())},[ut,jt]),a(()=>{var e;const t=Wt.current;if(t){t.buildScene([vt,bt]);for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);ht.current=!0,jt()}},[Pt,vt,bt,jt]);const hn=l(()=>{var e;const t=Wt.current;if(!t)return;t.runLayout([vt,bt]),t.buildScene([vt,bt]),ht.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);const n=Array.isArray(le)?le:St,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];en.current.has(t.id)||en.current.set(t.id,n[e%n.length])}if(tn.current=o.length,Vt(t.layoutVersion),Le){const{nodes:e,edges:n}=t.getLayoutData();Le(e,n)}},[vt,bt,Le,le]),gn=l(e=>{if(null==e||"object"!=typeof e)return;const t=Wt.current;t&&(t.ingestEdge(e)&&hn(),jt())},[hn,jt]),fn=l(e=>{const t=Wt.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&hn(),jt()},[hn,jt]),pn=l(()=>{var e,t,n;null===(e=Wt.current)||void 0===e||e.clear(),en.current.clear(),tn.current=0,Vt(null!==(n=null===(t=Wt.current)||void 0===t?void 0:t.layoutVersion)&&void 0!==n?n:0),Yt(null),Jt.current=null,ht.current=!0,jt()},[jt]),yn=l(()=>{const e=Wt.current;e&&(e.tension+=999,hn(),jt())},[hn,jt]);p(o,()=>({push:gn,pushMany:fn,removeNode:e=>{var t,n,o;const i=null!==(n=null===(t=Wt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(i){const t=(null===(o=Jt.current)||void 0===o?void 0:o.data)?"function"==typeof N?N(Jt.current.data):Jt.current.data[N]:void 0;Jt.current&&"node"===Jt.current.nodeOrEdge&&t===e&&(Jt.current=null,Yt(null)),en.current.delete(e),hn(),ht.current=!0,jt()}return i},removeEdge:(e,t)=>{var n,o;const i=null!==(o=null===(n=Wt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(i){if(Jt.current&&"edge"===Jt.current.nodeOrEdge){const n=Jt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!R||!n||("function"==typeof R?R:e=>null==e?void 0:e[R])(n)===e,o&&(Jt.current=null,Yt(null))}hn(),ht.current=!0,jt()}return i},updateNode:(e,t)=>{var n,o;const i=null!==(o=null===(n=Wt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return i&&(ht.current=!0,jt()),i},updateEdge:(e,t,n)=>{var o,i;const r=null!==(i=null===(o=Wt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==i?i:[];return r.length>0&&(hn(),ht.current=!0,jt()),r},clear:pn,getTopology:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Wt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:yn,getTension:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[gn,fn,pn,yn,hn,jt]);const mn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(P),vn=mn?T||(Array.isArray(L)?void 0:L):void 0;a(()=>{var e;const t=Wt.current;if(t)if(mn&&vn)t.ingestHierarchy(vn,[vt,bt]),t.buildScene([vt,bt]),ht.current=!0,jt();else{const n=Tt,o=Array.isArray($t)?$t:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[vt,bt]),t.buildScene([vt,bt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill+"");const i=Array.isArray(le)?le:St,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];en.current.has(t.id)||en.current.set(t.id,i[e%i.length])}tn.current=r.length,ht.current=!0,jt()}},[Tt,$t,T,vn,mn,vt,bt,Rt,jt,le]),a(()=>{$&&$.length>0&&fn($)},[]);const bn=l(e=>{if(Oe&&Oe(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[Oe,je,Me]),xn=l(e=>{if(_e&&_e(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[_e,je,Me]),{hoverHandlerRef:wn,hoverLeaveRef:An,onPointerMove:Sn,onPointerLeave:Cn}=gt,On=()=>{var e,t;return!lt||null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.hasCustomRestyle)&&void 0!==t&&t};wn.current=e=>{if(!Se)return;const t=On(),n=Ft.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-mt.left,r=e.clientY-o.top-mt.top;if(0>i||i>vt||0>r||r>bt)return void(Jt.current&&(Jt.current=null,Yt(null),bn&&(bn(null),t&&(ht.current=!0)),t&&jt()));const a=Wt.current;if(!a)return;const s=Fd(a.sceneNodes,a.sceneEdges,i,r,30,a.nodeQuadtree,a.maxNodeRadius);if(!s)return void(Jt.current&&(Jt.current=null,Yt(null),bn&&(bn(null),t&&(ht.current=!0)),t&&jt()));const l=xr(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Jt.current=l,Yt(l),bn&&(bn(l),t&&(ht.current=!0)),t&&jt()},An.current=()=>{if(Jt.current){const e=On();Jt.current=null,Yt(null),bn&&(bn(null),e&&(ht.current=!0)),e&&jt()}};const _n=i(()=>{});_n.current=e=>{if(!_e&&!je)return;const t=Ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-mt.left,i=e.clientY-n.top-mt.top;if(0>o||o>vt||0>i||i>bt)return;const r=Wt.current;if(!r)return;const a=Fd(r.sceneNodes,r.sceneEdges,o,i,30,r.nodeQuadtree,r.maxNodeRadius);xn(a?xr(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const jn=l(e=>_n.current(e),[]),Pn=i(-1),Mn=i(null),Ln=i(-1),Tn=l(e=>{var t;const n=Wt.current;if(!n)return;const o=function(e){var t,n,o,i,r,a,s,l;const c=[];for(const u of e)if("circle"===u.type&&null!=u.cx){if(0>=u.r)continue;c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(n=null===(t=u.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===u.type&&null!=u.x){if(0>=u.w||0>=u.h)continue;c.push({x:u.x+u.w/2,y:u.y+u.h/2,datum:u.datum,shape:"rect",w:u.w,h:u.h,group:null!==(i=null===(o=u.datum)||void 0===o?void 0:o.id)&&void 0!==i?i:"_default"})}else if("arc"===u.type&&null!=u.cx)c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(a=null===(r=u.datum)||void 0===r?void 0:r.id)&&void 0!==a?a:"_default"});else if("symbol"===u.type&&null!=u.cx){if(0>=u.size)continue;c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(l=null===(s=u.datum)||void 0===s?void 0:s.id)&&void 0!==l?l:"_default"})}return c.sort((e,t)=>e.x-t.x||e.y-t.y),c}(n.sceneNodes);if(0===o.length)return;const i=Hn(o),r=Pn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Pn.current=0,Ln.current=-1;const t=i.flat[0];Mn.current={shape:t.shape,w:t.w,h:t.h};const n=xr(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Jt.current=n,Yt(n),bn&&(bn(n),ht.current=!0),void jt()}const a=zn(i,r),s=function(e,t,n,o,i){var r,a,s;const l=n.flat[t.flatIndex];if(!l)return Wn(e,t,n);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,i=1/0;for(let r=0;e.flat.length>r;r++){const a=e.flat[r];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;i>u&&(i=u,o=r)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(i.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n;const o=e+"",i=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,r=Yn(t.source),a=Yn(t.target),s=null!=r,l=null!=a;s&&r+""===o&&l?i.push(a+""):l&&a+""===o&&s&&i.push(r+"")}return i}(c,o);if(0===e.length)return t.flatIndex;const r=null!==(s=n.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==s?s:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const o=Wn(e,t,n);return null!==o&&o!==t.flatIndex&&(i.current=-1),o}}}(e.key,a,i,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Ln);if(null===s)return;if(e.preventDefault(),0>s)return Pn.current=-1,Mn.current=null,Ln.current=-1,Jt.current=null,Yt(null),bn&&(bn(null),ht.current=!0),void jt();Pn.current=s;const l=i.flat[s];Mn.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Jt.current=c,Yt(c),bn&&(bn(c),ht.current=!0),jt()},[bn,jt]),$n=l(e=>{Pn.current=-1,Mn.current=null,Sn(e)},[Sn]);_t.current=()=>{var e,t,n,o,i,r,a;Ot.current=0;const s=Ft.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=Wt.current;if(!c)return;const u=performance.now(),d=Et.current?Math.min((u-Et.current)/1e3,.1):.016;Et.current=u;const h=c.advanceTransition(ft.current?u+1e6:u),g=!ft.current&&h,f=!ft.current&&c.tickAnimation([vt,bt],d);(h||ht.current||f)&&c.buildScene([vt,bt]);const p=zr();if(!Hr(s,yt,mt,p))return;if(l.clearRect(-mt.left,-mt.top,yt[0],yt[1]),Ae){const e=kn(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,vt,bt))}Ye&&c.applyDecay(),qe&&c.applyPulse(u),Ke&&c.applyThresholds(u),!1!==Xe&&c.applyTopologyDiff(u);const y=null!==(e=null==Ue?void 0:Ue.threshold)&&void 0!==e?e:5e3,m=Ue&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ue?void 0:Ue.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Zd(e,n);break;case"line":Jd(e,n);break;case"ribbon":eh(e,n);break;case"curved":th(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Vr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),Xr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),function(e,t){var n,o,i;const r=e.globalAlpha;for(const a of t){if("symbol"!==a.type)continue;const t=a;if(0>=t.size)continue;const s=Kd(t);if(!s)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const l=null!==(n=t.style.opacity)&&void 0!==n?n:1;t.style.fill&&(e.globalAlpha=r*l*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fillStyle="string"==typeof t.style.fill&&kn(e,t.style.fill)||t.style.fill,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=r*l,e.strokeStyle=kn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:1,e.stroke(s)),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!m){const e=c.edgesArray;if(e.length>0){!function(e,t,n,o){var i,r;const a=null!==(i=o.spawnRate)&&void 0!==i?i:pu.spawnRate,s=null!==(r=o.maxPerEdge)&&void 0!==r?r:pu.maxPerEdge;for(let o=0;t.length>o;o++){const i=t[o];if(!i.bezier)continue;if(e.countForEdge(o)>=s)continue;const r=i.value*a*n*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,Dt);const t=.5*(null!==(n=Dt.speedMultiplier)&&void 0!==n?n:1);let o;if(Dt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,i){var r,a;const s=null!==(r=o.radius)&&void 0!==r?r:pu.radius,l=null!==(a=o.opacity)&&void 0!==a?a:pu.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const a=t.particles[r];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:i(l),e.fillStyle=kn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Dt,cn)}}m&&(l.globalAlpha=1);const v=ht.current;if(ht.current=!1,v||g||f){const e=Ft.current;e&&e.setAttribute("aria-label",Qi(null!==(i=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==i?i:0,null!==(a=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==a?a:0,"Network chart"))}const b=v||g||f||zt.current;b&&u-Ht.current>=33?(Kt(e=>e+1),Ht.current=u,zt.current=!1):zt.current=!!b,(un||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||!1!==Xe&&c.hasActiveTopologyDiff||zt.current)&&(Ot.current=requestAnimationFrame(()=>_t.current()))},Hi({hydrated:Mt,wasHydratingFromSSR:Lt,storeRef:Wt,dirtyRef:ht,renderFnRef:_t}),a(()=>{ht.current=!0,jt()},[P,vt,bt,Ae,jt]),Zn(Ue,Wt,ht,jt,Qt,Zt);const Nn=Se&&Gt?e(Nr,{x:Gt.x,y:Gt.y,containerWidth:vt,containerHeight:bt,margin:mt,className:"stream-network-tooltip",zIndex:2,children:Ce?Ce(Gt):e(sh,{data:Gt})}):null;if(Ni||!Mt&&Lt){const n=Wt.current;if(n){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(P),t=e?T||(Array.isArray(L)?void 0:L):void 0;if(e&&t)n.ingestHierarchy(t,[vt,bt]),n.buildScene([vt,bt]);else{const e=Tt,t=Array.isArray($t)?$t:[];(e.length>0||t.length>0)&&(n.ingestBounded(e,t,[vt,bt]),n.buildScene([vt,bt]))}}const o=null!==(f=null==n?void 0:n.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==n?void 0:n.sceneEdges)&&void 0!==y?y:[],r=null!==(m=null==n?void 0:n.labels)&&void 0!==m?m:[];return t("div",{ref:pt,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ze||("string"==typeof ze?ze:"Network chart"),style:{position:"relative",width:ve?"100%":yt[0],height:be?"100%":yt[1]},children:[e(fr,{summary:Je}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:yt[0],height:yt[1],style:{position:"absolute",left:0,top:0},children:[wt&&e("g",{transform:`translate(${mt.left},${mt.top})`,children:wt}),t("g",{transform:`translate(${mt.left},${mt.top})`,children:[Ae&&e("rect",{x:0,y:0,width:vt,height:bt,fill:Ae}),i.map((t,n)=>function(t,n){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+n);case"bezier":{const o=t;return e("path",{d:o.pathD,fill:Li(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"ribbon":{const o=t;return e("path",{d:o.pathD,fill:Li(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"curved":{const o=t;return e("path",{d:o.pathD,fill:Li(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+n)}default:return null}}(t,n)).filter(Boolean),o.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:Li(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+n)}case"rect":{const o=t;return e("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Li(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,i=V().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Mi)||"";return e("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Li(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}case"symbol":{const o=t,i=Ut(o.symbolType,o.size,o.path);return e("path",{d:i,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?Li(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+n)}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+n)}(t,n)).filter(Boolean)]})]}),e(qd,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,labels:r,sceneNodes:o,title:ze,legend:De,legendPosition:Be,legendLayout:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:Ee,legendIsolatedCategories:He,foregroundGraphics:rn(xt,ln(null===(v=Wt.current)||void 0===v?void 0:v.customLayoutOverlays,null!=ut?ut:null)),annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:0}),e(Xd,{marks:null==n?void 0:n.customLayoutHtmlMarks,margin:mt,selection:null!=ut?ut:null})]})}const Dn=Wt.current;return t("div",{ref:pt,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ze||("string"==typeof ze?ze:"Network chart"),tabIndex:0,style:{position:"relative",width:ve?"100%":yt[0],height:be?"100%":yt[1],overflow:"visible"},onKeyDown:Tn,children:[Qe&&e(pr,{tableId:Ct}),Qe&&e(gr,{nodes:null!==(b=null==Dn?void 0:Dn.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==Dn?void 0:Dn.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:Ct,chartTitle:"string"==typeof ze?ze:void 0}),e(fr,{summary:Je}),e(yr,{hoverPoint:Gt}),t("div",{role:"img","aria-label":Ze||("string"==typeof ze?ze:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?$n:void 0,onMouseLeave:Se?Cn:void 0,onClick:_e||je?jn:void 0,children:[wt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:yt[0],height:yt[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${mt.left},${mt.top})`,children:wt})}),e("canvas",{ref:Ft,"aria-label":Qi(null!==(k=null===(w=null==Dn?void 0:Dn.sceneNodes)||void 0===w?void 0:w.length)&&void 0!==k?k:0,null!==(S=null===(A=null==Dn?void 0:Dn.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(qd,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,labels:(null==Dn?void 0:Dn.labels)||[],sceneNodes:null==Dn?void 0:Dn.sceneNodes,title:ze,legend:De,legendPosition:Be,legendLayout:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:Ee,legendIsolatedCategories:He,foregroundGraphics:rn(xt,ln(null===(C=Wt.current)||void 0===C?void 0:C.customLayoutOverlays,null!=ut?ut:null)),annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:Xt}),e(Xd,{marks:null==Dn?void 0:Dn.customLayoutHtmlMarks,margin:mt,selection:null!=ut?ut:null}),e(vr,{active:Pn.current>=0,hoverPoint:Gt,margin:mt,size:yt,shape:null===(O=Mn.current)||void 0===O?void 0:O.shape,width:null===(_=Mn.current)||void 0===_?void 0:_.w,height:null===(j=Mn.current)||void 0===j?void 0:j.h}),Nn,(null==Ue?void 0:Ue.showBadge)&&e(Jn,{isStale:Qt,position:Ue.badgePosition})]})]})});function uh(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(o)};return o(e),n}function dh(e,t,n,o){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],r="function"==typeof o?o(e):e[o];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function hh(e){return"function"==typeof e?e:t=>t[e]||1}function gh({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:i,baseStyle:r={}}){return a=>{const s=Object.assign({fillOpacity:i},r);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=jt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=jt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*i);return s}}function fh(e){const{nodes:t,edges:n,inferNodes:o=!0,sourceAccessor:i="source",targetAccessor:a="target",colorBy:s,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:w,loading:k,loadingContent:A,emptyContent:S,emptyDataKey:C="edges"}=e,O=r(()=>ke(n),[n]),_=r(()=>ke(t),[t]),j=Rs(k,x,w,A),P=j?null:Is("nodes"===C?void 0===t?void 0:_:void 0===n?void 0:O,x,w,S),M=r(()=>o?dh(_,O,i,a):_,[o,_,O,i,a]),L=fs(M,s,l),T=hs(),$=r(()=>{if(Array.isArray(l))return l;if(T&&T.length>0)return T;if("string"==typeof l){const e=At[l];if(Array.isArray(e)&&e.length>0)return e}return St},[l,T]),N=r(()=>{if(!s)return[];const e=new Set;for(const t of M){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[M,s]),D=bs(d,s,N),{legend:B,margin:I,legendPosition:R}=vs({data:M,colorBy:s,colorScale:L,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:N}),F=ys({selection:h,linkedHover:g,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:E,customClickBehavior:H,activeSelectionHook:z,hoverSelectionHook:W,crosshairSourceId:G}=F;return{safeNodes:M,safeEdges:O,colorScale:L,effectivePalette:$,themeCategorical:T,allCategories:N,legendState:D,legend:B,margin:I,legendPosition:R,customHoverBehavior:E,customClickBehavior:H,activeSelectionHook:z,hoverSelectionHook:W,crosshairSourceId:G,loadingEl:j,emptyEl:P}}ch.displayName="StreamNetworkFrame";const ph=g(function(t,n){var o;const a=i(null);Qs(n,{variant:"network",frameRef:a});const s=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:w=1,edgeColor:k="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:C=.1,tooltip:O,frameProps:_={},onObservation:j,onClick:P,chartId:M,selection:L,linkedHover:T,loading:$,loadingContent:N,emptyContent:D,legendInteraction:B,legendPosition:I,stroke:R,strokeWidth:F,opacity:E}=t,H=null!==(o=null!=h?h:g)&&void 0!==o?o:"id",{width:z,height:W,enableHover:G,showLegend:Y,showLabels:q=!1,title:V,description:X,summary:U,accessibleTable:K}=s,Q=fh({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:m,colorScheme:v,showLegend:Y,legendPosition:I,legendInteraction:B,selection:L,linkedHover:T,onObservation:j,onClick:P,chartType:"ForceDirectedGraph",chartId:M,marginDefaults:s.marginDefaults,userMargin:u,width:z,height:W,loading:$,loadingContent:N,emptyContent:D,emptyDataKey:"nodes"}),Z=r(()=>new Map,[]),J=r(()=>e=>{const t={};return t.fill=m?jt(e.data||e,m,Q.colorScale):gs(void 0,Q.themeCategorical,v,void 0,Z),"number"==typeof b&&(t.r=b),t},[m,Q.colorScale,b,Q.themeCategorical,v,Z]),ee=r(()=>Us(J,{stroke:R,strokeWidth:F,opacity:E}),[J,R,F,E]),te=r(()=>e=>{const t=e.data||e;let n;if("number"==typeof w)n=w;else if("function"==typeof w)n=w(t);else{const e=t[w],o="number"==typeof e?e:Number(e);n=Number.isFinite(o)&&o>0?o:1}return{stroke:k,strokeWidth:n,opacity:A}},[w,k,A]),ne=r(()=>Us(te,{stroke:R,strokeWidth:F,opacity:E}),[te,R,F,E]),oe=r(()=>{if(q&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[q,y]),ie=qs({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:H}});return ie?e(Ms,{componentName:"ForceDirectedGraph",message:ie,width:z,height:W}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:e(Ns,{componentName:"ForceDirectedGraph",width:z,height:W,children:e(ch,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:Q.safeNodes},null!=c&&{edges:Q.safeEdges},{size:[z,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,nodeIDAccessor:H,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:C,nodeStyle:ee,edgeStyle:ne,colorBy:m,colorScheme:Q.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:q,enableHover:G,tooltipContent:!1===O?()=>null:$r(O)||void 0,customHoverBehavior:T||j||P?Q.customHoverBehavior:void 0,customClickBehavior:j||P?Q.customClickBehavior:void 0,legend:Q.legend,legendPosition:Q.legendPosition},B&&"none"!==B&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},{className:d,title:V,description:X,summary:U,accessibleTable:K},null!=t.animate&&{animate:t.animate},_))})});ph.displayName="ForceDirectedGraph";const yh=g(function(t,n){const o=i(null);Qs(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",padAngle:v=.01,groupWidth:b=20,sortGroups:x,nodeLabel:w,edgeOpacity:k=.5,tooltip:A,frameProps:S={},onObservation:C,onClick:O,chartId:_,selection:j,linkedHover:P,loading:M,loadingContent:L,emptyContent:T,legendInteraction:$,stroke:N,strokeWidth:D,opacity:B}=t,{width:I,height:R,enableHover:F,showLabels:E=!0,title:H,description:z,summary:W,accessibleTable:G}=a,Y=fh({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:$,selection:j,linkedHover:P,onObservation:C,onClick:O,chartType:"ChordDiagram",chartId:_,marginDefaults:a.marginDefaults,userMargin:c,width:I,height:R,loading:M,loadingContent:L,emptyContent:T}),q=r(()=>new Map,[]),V=Y.safeNodes.length>0,X=r(()=>{if(V)return(e,t)=>{var n,o;const i={stroke:"black",strokeWidth:1};if(p)i.fill=jt(e.data||e,p,Y.colorScale);else{const r=Array.isArray(y)?y:At[y]||St,a=Array.isArray(r)?r:St,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;i.fill=a[s%a.length]}return i}},[V,p,Y.colorScale,y]),U=r(()=>X?Us(X,{stroke:N,strokeWidth:D,opacity:B}):void 0,[X,N,D,B]),K=r(()=>{if(V)return gh({edgeColorBy:m,colorBy:p,colorScale:Y.colorScale,nodeStyleFn:U||(e=>({fill:gs(void 0,Y.themeCategorical,y,void 0,q)})),edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}})},[V,m,p,Y.colorScale,U,k,Y.themeCategorical,y,q]),Q=r(()=>K?Us(K,{stroke:N,strokeWidth:D,opacity:B}):void 0,[K,N,D,B]),Z=r(()=>{if(!E)return;const e=w||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[E,w,f]),J=qs({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(Ms,{componentName:"ChordDiagram",message:J,width:I,height:R}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e(Ns,{componentName:"ChordDiagram",width:I,height:R,children:e(ch,Object.assign({ref:o,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=l&&{edges:Y.safeEdges},{size:[I,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,padAngle:v,groupWidth:b,sortGroups:x,nodeStyle:U,edgeStyle:Q,colorBy:p,colorScheme:Y.effectivePalette,edgeColorBy:m,edgeOpacity:k,nodeLabel:Z,showLabels:E,enableHover:F,tooltipContent:!1===A?()=>null:$r(A)||void 0,customHoverBehavior:P||C||O?Y.customHoverBehavior:void 0,customClickBehavior:C||O?Y.customClickBehavior:void 0},$&&"none"!==$&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:u,title:H,description:z,summary:W,accessibleTable:G},null!=t.animate&&{animate:t.animate},S))})});yh.displayName="ChordDiagram";const mh=g(function(t,n){const o=i(null);Qs(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",orientation:v="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:w=15,nodeLabel:k,edgeOpacity:A=.5,edgeSort:S,tooltip:C,frameProps:O={},onObservation:_,onClick:j,chartId:P,selection:M,linkedHover:L,loading:T,loadingContent:$,emptyContent:N,showLegend:D,legendPosition:B,legendInteraction:I,stroke:R,strokeWidth:F,opacity:E}=t,{width:H,height:z,enableHover:W,showLabels:G=!0,title:Y,description:q,summary:V,accessibleTable:X}=a,U=fh({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:D,legendPosition:B,legendInteraction:I,selection:M,linkedHover:L,onObservation:_,onClick:j,chartType:"SankeyDiagram",chartId:P,marginDefaults:a.marginDefaults,userMargin:c,width:H,height:z,loading:T,loadingContent:$,emptyContent:N}),K=r(()=>new Map,[]),Q=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?jt(e.data||e,p,U.colorScale):gs(void 0,U.themeCategorical,y,void 0,K),t},[p,U.colorScale,U.themeCategorical,y,K]),Z=r(()=>Us(Q,{stroke:R,strokeWidth:F,opacity:E}),[Q,R,F,E]),J=r(()=>gh({edgeColorBy:m,colorBy:p,colorScale:U.colorScale,nodeStyleFn:Z,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[m,p,U.colorScale,Z,A]),ee=r(()=>Us(J,{stroke:R,strokeWidth:F,opacity:E}),[J,R,F,E]),te=r(()=>{if(!G)return;const e=k||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[G,k,f]),ne=qs({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e(Ms,{componentName:"SankeyDiagram",message:ne,width:H,height:z}):U.loadingEl?U.loadingEl:U.emptyEl?U.emptyEl:e(Ns,{componentName:"SankeyDiagram",width:H,height:z,children:e(ch,Object.assign({ref:o,chartType:"sankey"},U.safeNodes.length>0&&{nodes:U.safeNodes},null!=l&&{edges:U.safeEdges},{size:[H,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,orientation:v,nodeAlign:b,nodePaddingRatio:x,nodeWidth:w,nodeStyle:Z,edgeStyle:ee,colorBy:p,colorScheme:U.effectivePalette,edgeColorBy:m,edgeOpacity:A,edgeSort:S,nodeLabel:te,showLabels:G,enableHover:W,tooltipContent:!1===C?()=>null:$r(C)||void 0,customHoverBehavior:L||_||j?U.customHoverBehavior:void 0,customClickBehavior:_||j?U.customClickBehavior:void 0,legend:U.legend,legendPosition:U.legendPosition},I&&"none"!==I&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},{className:u,title:Y,description:q,summary:V,accessibleTable:X},null!=t.animate&&{animate:t.animate},O))})});function vh(e,t,n){const o=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of o)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const a={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},s=()=>{r.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=a[e.kind])&&void 0!==n?n:99)-(null!==(o=a[t.kind])&&void 0!==o?o:99)})},l=r.length?function(e,t=1/0){let n=t;for(const t of e)n>t&&(n=t);return n}(r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};s();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let n=t-("top"===e.side?p:y);if(n>0){const t="top"===e.side?"bot":"top",o=Math.min(n,"top"===t?p:y);if(o>0){const i=g(e.time);f.push({time:i,delta:-o,kind:"transfer-out",side:t}),f.push({time:i,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?p-=o:y-=o,"top"===e.side?p+=o:y+=o,n-=o}n>0&&null!==u&&(f.push({time:u,delta:+n,kind:"create",side:e.side}),"top"===e.side?p+=n:y+=n)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),s();let m=0,v=0,b=0,x=0,w=0;const k=[],A=new Map;for(const e of r){if(k.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>w&&(w=v),k.push({t:e.time,topMass:m,botMass:v})}const S=[];let C=0;for(;k.length>C;){let e=C;for(;k.length>e+1&&k[e+1].t===k[C].t;)e++;S.push(k[C]);for(let t=C+1;e>=t;t++){const e=S[S.length-1];k[t].topMass===e.topMass&&k[t].botMass===e.botMass||S.push(k[t])}C=e+1}const O=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let _=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===_||_>e.systemInTime)&&(_=e.systemInTime);let j=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===j||e.systemOutTime>j)&&(j=e.systemOutTime);if(S.length>0){const e=S[S.length-1],t=Math.max(null!=O?O:-1/0,null!=j?j:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&S.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=S[0],o=Math.min(null!=c?c:1/0,null!=_?_:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&S.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:w,localAttachments:A}}function bh(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function xh(e,t){return e.map(e=>({t:bh(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function wh(e,t,n){const o=e.value*n;if("out"===e.kind){const i=e.sideMassBefore*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}const i=e.sideMassAfter*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}function kh(e,t){let n=0;for(let o=0;t.length>o;o++)for(let i=o+1;t.length>i;i++){const r=t[o],a=t[i];r.source!==a.source&&r.target!==a.target&&r.source!==a.target&&r.target!==a.source&&(Math.min(r.endTime,a.endTime)>Math.max(r.startTime,a.startTime)&&e[a.source]>e[r.source]!=e[a.target]>e[r.target]&&n++)}return n}function Ah(e,t){let n=0;for(const o of t)n+=Math.abs(e[o.source]-e[o.target])*(o.value||1);return n}function Sh(e,t){return 1e3*kh(e,t)+Ah(e,t)}function Ch(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Oh(e,t,n){e.length>8||n.length>40?(function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Ch(e,t),a=Sh(t,n);for(let s=0;o>s;s++){const o=Array(i).fill(0),s=Array(i).fill(0);for(const e of n){const n=t[e.source],i=t[e.target];o[n]+=i*(e.value||1),s[n]+=e.value||1,o[i]+=n*(e.value||1),s[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(s[e]>0?o[e]/s[e]:e)-(s[t]>0?o[t]/s[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=Sh(t,n);if(a>d)a=d,r=Ch(e,t);else if(d===a)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,r)}(e,t,n,6),function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Sh(t,n);for(let a=0;o>a;a++){let o=!1;for(let a=0;i-1>a;a++){const i=e[a];e[a]=e[a+1],e[a+1]=i;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=Sh(t,n);if(r>s)r=s,o=!0;else{const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!o)break}}(e,t,n,6)):function(e,t,n){const o=e.length;if(1>=o)return;const i=Object.assign({},t),r=Object.keys(i),a=Array.from({length:o},(e,t)=>t),s=a.slice(),l=Object.assign({},i);let c=a.slice(),u=1/0;const d=()=>{for(const e of r)l[e]=s[i[e]];const e=Sh(l,n);u>e&&(u=e,c=a.slice())},h=(e,t)=>{const n=a[e],o=a[t];a[e]=o,a[t]=n,s[n]=t,s[o]=e};d();const g=Array(o).fill(0);let f=0;for(;o>f;)f>g[f]?(h(f%2==0?0:g[f],f),d(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,n)}function _h(e,t,n,o,i){var r,a,s,l,c,u,d,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=n[t.id].topPeak||0,x[t.id]=n[t.id].botPeak||0;const w="half"===v,k={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,n=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of o.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=w?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of o.incoming[t.id]){const t=w?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}k[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},S=[];if("reuse"===y){const n=new Map;for(const t of e)n.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const d=[];for(const t of e)0===(null!==(a=i.get(t.id))&&void 0!==a?a:0)&&d.push(t.id);for(;d.length;){const e=d.shift();for(const t of null!==(s=o.outgoing[e])&&void 0!==s?s:[]){const o=(null!==(l=n.get(e))&&void 0!==l?l:0)+1;o>(null!==(c=n.get(t.target))&&void 0!==c?c:0)&&n.set(t.target,o),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&d.push(t.target)}}const h=[...e].filter(e=>null!==k[e.id].start).sort((e,t)=>{var o,i;const r=null!==(o=n.get(e.id))&&void 0!==o?o:0,a=null!==(i=n.get(t.id))&&void 0!==i?i:0;return r!==a?r-a:k[e.id].start-k[t.id].start}),g=e.filter(e=>null===k[e.id].start);for(const e of[...h,...g]){const t=k[e.id];let n=-1;for(let e=0;S.length>e;e++){const o=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=S.length-1),S[n].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),S[n].peak.topPeak=Math.max(S[n].peak.topPeak,b[e.id]),S[n].peak.botPeak=Math.max(S[n].peak.botPeak,x[e.id]),A[e.id]=n}}else e.forEach((e,t)=>{var n,o;S.push({occupants:[{id:e.id,end:null!==(o=null===(n=k[e.id])||void 0===n?void 0:n.end)&&void 0!==o?o:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let C=null,O=null,_=null,j=null;const P=()=>{C=kh(A,t),_=Ah(A,t)},M=()=>{O=kh(A,t),j=Ah(A,t)};"crossing-min"===m?(P(),Oh(S,A,t),M()):"inside-out"===m?(P(),function(e,t){const n=e.length;if(1>=n)return;const o=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>o(t.slot)-o(e.slot)),r=Array(n),a=Math.floor((n-1)/2);r[a]=i[0].idx;let s=a-1,l=a+1;for(let e=1;i.length>e;e++)e%2==1&&n>l||0>s?r[l++]=i[e].idx:r[s--]=i[e].idx;const c=r.map(t=>e[t]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(S,A),M()):"crossing-min+inside-out"===m&&(P(),Oh(S,A,t),function(e,t,n){const o=e.length;if(1>=o)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((o-1)/2);let a=Sh(t,n);for(const{slot:s}of i){const i=e.indexOf(s);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const u=new Map;for(let e=0;o>e;e++)u.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)u.set(e,e-1);u.set(i,l)}else{for(let e=l;i>e;e++)u.set(e,e+1);u.set(i,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=Sh(t,n);if(d>a){const n=e[l];e.splice(l,1),e.splice(i,0,n);const r=new Map;for(let e=0;o>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else a=d}}(S,A,t),M());const L=S.map(e=>{const t=new Map;for(const o of e.occupants){const e=n[o.id];if(e)for(const n of e.samples){const e=t.get(n.t)||{top:0,bot:0};t.set(n.t,{top:Math.max(e.top,n.topMass),bot:Math.max(e.bot,n.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let n={top:0,bot:0};for(const[o,i]of e){if(o>t)break;n=i}return n},$=[];for(let e=0;S.length-1>e;e++){const t=L[e],n=L[e+1],o=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let i=0;for(const e of o){const o=T(t,e),r=T(n,e);o.bot+r.top>i&&(i=o.bot+r.top)}$.push(i)}const N=[];let D=f+(null!==(h=null===(d=S[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&N.push(D);for(let e=1;S.length>e;e++)D+=$[e-1]*p+f,N.push(D);if(S.length>0&&(D+=S[S.length-1].peak.botPeak*p+f),D>g){const e=g/D;for(let t=0;N.length>t;t++)N[t]*=e}const B=0===S.length?0:S[0].peak.topPeak+$.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,I={};for(const t of e)I[t.id]=N[A[t.id]];return{effectiveSlotsHeight:B,centerlines:I,laneLifetime:k,slots:S,slotByNode:A,slotCenter:N,crossingsBefore:C,crossingsAfter:O,lengthBefore:_,lengthAfter:j}}mh.displayName="SankeyDiagram";const jh=e=>{var t,n;const{bands:o=[],ribbons:i=[],showLabels:r=!0}=e.config,a=[];for(const e of i)a.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];a.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of o)a.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const s=r?o.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:o.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:a,labels:s}};function Ph(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Mh(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Lh(e,t){return"function"==typeof e?e(t):t[e]}const Th=g(function(o,a){const{nodes:s,edges:c,domain:u,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:m="startTime",endTimeAccessor:v="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:w="xExtent",edgeIdAccessor:k="id",colorBy:S,colorScheme:C,showLegend:O,legendPosition:_="right",pairing:j="temporal",packing:P="reuse",laneOrder:M="crossing-min",ribbonLane:L="both",lifetimeMode:T="half",showLaneRails:$=!1,showQualityReadout:N=!1,showLabels:D=!0,width:B=600,height:I=400,margin:R,title:F,description:E,summary:H,accessibleTable:z,responsiveWidth:W,responsiveHeight:G,loading:Y,loadingContent:q,emptyContent:V,edgeOpacity:X=.35,timeFormat:U,valueFormat:K,tooltip:Q,enableHover:Z=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:ne,chartId:oe,frameProps:ie={}}=o,[re,ae]=d([]),[se,le]=d([]),ce=i(re),ue=i(se);ce.current=re,ue.current=se;const de=l(e=>{ce.current=e,ae(e)},[]),he=l(e=>{ue.current=e,le(e)},[]),ge=void 0!==c,fe=ke(ge?c:re),pe=r(()=>{const e=ke(null!=s?s:[]),t=se;if(0===e.length&&0===t.length)return dh([],fe,f,p);const n=new Set,o=[];for(const t of e){const e=Lh(g,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Lh(g,e)+"";n.has(t)||(n.add(t),o.push(e))}const i=dh([],fe,f,p);for(const e of i)n.has(e.id)||(n.add(e.id),o.push(e));return o},[s,se,fe,g,f,p]),ye=i(null),me=l((e,t)=>{const n=Lh(k,e);return null!=n?n+"":`${Lh(f,e)}-${Lh(p,e)}-${t}`},[k,f,p]),ve=l(e=>{if(null==e)return!1;const t=e;return null!=Lh(f,t)&&null!=Lh(p,t)},[f,p]);Qs(a,{variant:"network",frameRef:ye,overrides:{push(e){if(ve(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");de([...ce.current,e])}else he([...ue.current,e])},pushMany(e){const t=[],n=[];for(const o of e)ve(o)?t.push(o):n.push(o);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):de([...ce.current,...t])),n.length>0&&he([...ue.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){const e=ce.current,o=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(me(r,i))?n.push(r):o.push(r)}o.length!==e.length&&de(o)}const o=ue.current,i=[];for(const e of o){const o=Lh(g,e)+"";t.has(o)?n.push(e):i.push(e)}return i.length!==o.length&&he(i),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){let e=!1;const i=ce.current.map((i,r)=>n.has(me(i,r))?(o.push(i),e=!0,t(i)):i);e&&de(i)}let i=!1;const r=ue.current.map(e=>{const r=Lh(g,e)+"";return n.has(r)?(o.push(e),i=!0,t(e)):e});return i&&he(r),o},clear(){var e;ge||de([]),he([]),null===(e=ye.current)||void 0===e||e.clear()},getData:()=>null!=fe?fe:[],getScales:()=>null},deps:[ge,ve,me,g,fe,de,he]});const be=me,xe=l(e=>Lh(g,e)+"",[g]),{nodes:we,edges:Ae,domain:Se,rawNodeById:Ce,rawEdgeById:Oe}=r(()=>{const e=(null!=pe?pe:[]).map(e=>{const t={id:xe(e),__raw:e},n=w?Lh(w,e):null;if(Array.isArray(n)&&2===n.length){const e=Mh(n[0]),o=Mh(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=fe?fe:[]).map((e,t)=>{const n={id:be(e,t),source:Lh(f,e)+"",target:Lh(p,e)+"",value:Number(Lh(y,e)),startTime:Mh(Lh(m,e)),endTime:Mh(Lh(v,e)),__raw:e};if(b){const t=Mh(Lh(b,e));Number.isFinite(t)&&(n.systemInTime=t)}if(x){const t=Mh(Lh(x,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[Mh(u[0]),Mh(u[1])],o=new Map;for(const t of e)null!=t.__raw&&o.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:n,rawNodeById:o,rawEdgeById:i}},[pe,fe,u,xe,be,w,f,p,y,m,v,b,x]),_e=fh({nodes:pe,edges:fe,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:S,colorScheme:C,showLegend:!1,legendPosition:_,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:oe,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:R,width:B,height:I,loading:Y,loadingContent:q,emptyContent:V}),je=(null!=O?O:!!S)&&!!S,Pe=l(e=>null!=R&&("number"==typeof R||null!=R[e]),[R]),Me=r(()=>{const e=Object.assign({},_e.margin);return je&&("right"===_&&!Pe("right")&&140>e.right?e.right=140:"bottom"===_&&!Pe("bottom")&&80>e.bottom&&(e.bottom=80)),e},[_e.margin,je,_,Pe]),Le=B-Me.left-Me.right,Te=I-Me.top-Me.bottom,$e=r(()=>function(e,t,n){const o=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(n)&&2===n.length,a=r&&Number.isFinite(n[0])&&Number.isFinite(n[1]);r&&a&&a&&n[1]>=n[0]||o.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||o.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||o.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||o.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||o.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||o.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):o.push({kind:"invalid-edge-time",id:e.id});return o}(we,Ae,Se),[we,Ae,Se]),Ne=r(()=>$e.length>0?null:function(e,t,n){var o;const{plotH:i,pairing:r="temporal",packing:a="reuse",laneOrder:s="crossing-min",lifetimeMode:l="half"}=n,c=function(e,t){const n={},o={};for(const t of e)n[t.id]=[],o[t.id]=[];for(const e of t)o[e.source]&&o[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:o}}(e,t),u=function(e,t,n,o="value"){const i="temporal"===o?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===o?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const n=new Map;for(const o of e){const e=o[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=n.get(e);i.edges.push(o),i.total+=o.value,i.earliestStart=Math.min(i.earliestStart,o.startTime),i.latestEnd=Math.max(i.latestEnd,o.endTime)}const a=[...n.values()];a.sort("temporal"===o?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?r:i);return a};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)s(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=n});else if(0===e.length)s(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=n});else{const t=s(o,"source"),n=s(e,"target"),i=Math.max(t.length,n.length);for(let e=0;i>e;e++){const o=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)a.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)a.get(t.id).sourceSide=o}}}return a}(e,t,c,r);let d={};for(const t of e)d[t.id]=vh(t,c,u);const h=_h(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],n=h.slotByNode[e.target];if(void 0===t||void 0===n)continue;const o=u.get(e.id);t!==n?t>n?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(g.add(e.id),o.sourceSide="bot",o.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],n=c.incoming[t.id],o=new Set(e.map(e=>u.get(e.id).sourceSide)),i=new Set(n.map(e=>u.get(e.id).targetSide));if(1===o.size&&n.length>0){const e=[...o][0];for(const t of n)h.slotByNode[t.source]===h.slotByNode[t.target]&&(u.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const n of e)h.slotByNode[n.source]===h.slotByNode[n.target]&&(u.get(n.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],n=c.outgoing[t.id];if(0===e.length||0===n.length)continue;const o=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===u.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===u.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=o(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,a="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=a)return!1;const s=Math.min(r,a),l=n.filter(t=>!g.has(t.id)&&u.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=n.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=vh(t,c,u);const f=_h(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),p=null!==(o=f.effectiveSlotsHeight)&&void 0!==o?o:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=_h(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:a,laneOrder:s,lifetimeMode:l});return{nodeData:d,sides:u,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(we,Ae,{plotH:Te,pairing:j,packing:P,laneOrder:M,lifetimeMode:T}),[$e,we,Ae,Te,j,P,M,T]),De=r(()=>A().domain(Se).range([0,Le]),[Se,Le]),Be=l((e,t)=>{if(S&&pe){const t=Ce.get(e);if(t)return jt(t,S,_e.colorScale)}return _e.effectivePalette[t%_e.effectivePalette.length]||"#475569"},[S,pe,Ce,_e.colorScale,_e.effectivePalette]),Ie=r(()=>{const e=new Map;return we.forEach((t,n)=>e.set(t.id,n)),e},[we]),Re=r(()=>{if(!Ne)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Ne,o=[],i=[];return we.forEach((i,r)=>{var a;const s=t[i.id];if(!s||0===s.samples.length)return;const l=function(e,t,n,o,i){if(0===e.length)return null;const r=xh(e,i),a=e=>t-r[e].topMass*n,s=e=>t+r[e].botMass*n;let l=`M${o(r[0].t)},${a(0)}`;for(let e=1;r.length>e;e++)l+=` L${o(r[e].t)},${a(e)}`;l+=` L${o(r[r.length-1].t)},${s(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${o(r[e].t)},${s(e)}`;return l+" Z"}(s.samples,e[i.id],n,De,Se);if(!l)return;const c=xh(s.samples,Se),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*n/2,h=Be(i.id,r),g=null!==(a=Ce.get(i.id))&&void 0!==a?a:i,f=function(e,t,n,o,i){const r=n.nodeData[e];if(!r||0===r.samples.length)return[];const a=n.valueScale,s=n.centerlines[e],l=xh(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=o(c.t),h=o(u.t),g=e=>o(bh(e,i)),f=[],p=(e,t,n,o)=>`M${e},${t} L${n},${t} L${n},${o} L${e},${o} Z`;for(const n of t){if(n.source===e&&null!=n.systemInTime&&Number.isFinite(n.systemInTime)){const e=r.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=g(n.systemInTime),o=g(n.startTime),i=t-20,r=Math.max(d,i);if(o>r){const[n,l]=wh(e,s,a);f.push({pathD:p(r,n,o,l),x0:i,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=r.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=g(n.systemOutTime),o=g(n.endTime),i=t+20,r=Math.min(h,i);if(r>o){const[n,l]=wh(e,s,a);f.push({pathD:p(o,n,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,Ae,Ne,De,Se);o.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:De(u.t)-4,labelY:d,labelText:i.id}))}),Ae.forEach(o=>{var r,a,s,l;const c=null===(r=t[o.source])||void 0===r?void 0:r.localAttachments.get(o.id),u=null===(a=t[o.target])||void 0===a?void 0:a.localAttachments.get(o.id);if(!c||!u)return;const d=null!==(s=Ie.get(o.source))&&void 0!==s?s:0,h=Be(o.source,d),g=function(e,t,n,o,i,r,a,s){const l=i,c=e=>s?Math.max(s[0],Math.min(s[1],e)):e,u=r(c(e.time)),d=r(c(n.time)),h=e.value*l,g=n.value*l,f=e.sideMassBefore*l,p=n.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===n.side?(v=o-p,b=v+g):(b=o+p,v=b-g);const x="source"===a?u+.85*(d-u):"target"===a?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[o.source],u,e[o.target],n,De,L,Se),{pathD:f,bezier:p}=id(g),y=null!==(l=Oe.get(o.id))&&void 0!==l?l:o;i.push({id:o.id,pathD:f,fill:h,opacity:X,rawDatum:y,bezier:p})}),{bands:o,ribbons:i}},[Ne,we,Ae,De,Se,Be,Ce,Oe,L,X,Ie]),Fe=r(()=>({bands:Re.bands,ribbons:Re.ribbons,showLabels:D}),[Re,D]),Ee=r(()=>{if(!je||!S)return;const e=new Map;(null!=pe?pe:[]).forEach((t,n)=>{const o=Lh(S,t),i=null==o?"":o+"";i&&!e.has(i)&&e.set(i,{label:i,color:Be(xe(t),n)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[je,S,pe,Be,xe]),He=r(()=>!1!==Q&&Z?void 0===Q||!0===Q?null:$r(Q)||null:null,[Q,Z]),ze=l(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),We=l(e=>K?K(e):e+"",[K]),Ge=l(o=>{if(!o||!o.data)return null;const i=o.data;if(!Ph(i))return null;const r=i.data;if(He)return He(r);if("band"===i.__kind){const n=i.id,o=Ne?function(e){if(!e)return[];const t=new Set,n=[];for(const o of e.samples){const e=o.topMass+o.botMass,i=`${o.t}:${e}`;t.has(i)||(t.add(i),n.push({t:o.t,total:e}))}return n}(Ne.nodeData[n]):[],r=5,a=o.length>r?o.length:null,s=function(e,t=5){if(t>=e.length)return e.slice();const n=[...e].sort((e,t)=>e.total-t.total),o=n.length-1,i=[Object.assign(Object.assign({},n[0]),{mark:"min"}),Object.assign(Object.assign({},n[Math.floor(.25*o)]),{mark:"q25"}),Object.assign(Object.assign({},n[Math.floor(.5*o)]),{mark:"median"}),Object.assign(Object.assign({},n[Math.floor(.75*o)]),{mark:"q75"}),Object.assign(Object.assign({},n[o]),{mark:"max"})],r=new Set,a=[];for(const e of i)r.has(e.t)||(r.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:n}),s.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=a&&e("th",{})]})}),e("tbody",{children:s.map((n,o)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:ze(n.t)}),e("td",{style:{textAlign:"right"},children:We(n.total)}),null!=a&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:n.mark})]},o))})]}),null!=a&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",a," samples"]})]})}const a=r,s=Lh(f,a),l=Lh(p,a),c=Lh(y,a),u=Lh(m,a),d=Lh(v,a);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[s+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(n,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:We(Number(c))})]}),null!=u&&t(n,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:ze(Mh(u))})]}),null!=d&&t(n,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:ze(Mh(d))})]})]})]})},[Ne,He,ze,We,f,p,y,m,v]),Ye=r(()=>{if(!Ne)return null;const{centerlines:n,laneLifetime:o,nodeData:i,valueScale:r,compressedPadding:a,crossingsBefore:s,crossingsAfter:l,lengthBefore:c,lengthAfter:u}=Ne;let d=null,g=null;for(const e of we){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=De(t.start),i=De(t.end);(null===d||d>n)&&(d=n),(null===g||i>g)&&(g=i)}const f=e=>Math.max(0,Math.min(Le,e)),p=f(null!=d?d:0),y=Math.max(p,f(null!=g?g:Le));return t("g",{children:[N&&null!==(null!=l?l:null)&&t("text",{x:Le,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),a&&e("text",{x:Le,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,n)=>{const o=De(Mh(t.date));return p-.5>o||o>y+.5?null:e("line",{x1:o,y1:0,x2:o,y2:Te,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),$&&we.map((a,s)=>{const l=o[a.id];if(!l||null===l.start)return null;const c=i[a.id],u=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},d=n[a.id]+(u.botPeak-u.topPeak)*r/2,h=De(l.start),g=De(l.end),f=Be(a.id,s);return t("g",{children:[e("line",{x1:h,y1:d,x2:g,y2:d,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:d-4,x2:h,y2:d+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:d-4,x2:g,y2:d+4,stroke:f,strokeOpacity:.5})]},"lane-"+a.id)}),e("line",{x1:p,y1:Te+4,x2:y,y2:Te+4,stroke:"#94a3b8"}),h.map((n,o)=>{const i=Mh(n.date),r=De(i);if(p-.5>r||r>y+.5)return null;const a=null!=n.label?n.label:U?U(new Date(i)):"";return t("g",{transform:`translate(${r},${Te+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:a})]},o)})]})},[Ne,h,De,Le,Te,$,we,Be,N,U]),qe=r(()=>(null!=pe?pe:[]).map(e=>({id:xe(e),data:e})),[pe,xe]),Ve=r(()=>{const e=new Map;for(const t of Re.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Re]),Xe=r(()=>(null!=fe?fe:[]).map((e,t)=>{const n=be(e,t),o=Number(Lh(y,e));return{id:n,source:Lh(f,e)+"",target:Lh(p,e)+"",value:Number.isFinite(o)?o:0,bezier:Ve.get(n),data:e}}),[fe,be,f,p,y,Ve]),Ue=_e.loadingEl,Ke=_e.emptyEl;return $e.length>0?t("svg",{width:B,height:I,role:"img","aria-label":null!=F?F:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),$e.map((t,n)=>{return e("text",{x:20,y:56+18*n,fontSize:12,fill:"#64748b",children:"• "+(o=t,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},n);var o})]}):Ue||Ke||e(ch,Object.assign({ref:ye,chartType:"force",nodes:qe,edges:Xe,customNetworkLayout:jh,layoutConfig:Fe,size:[B,I],responsiveWidth:W,responsiveHeight:G,margin:Me,title:F,description:null!=E?E:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:H,accessibleTable:z,enableHover:Z,tooltipContent:!1===Q?()=>null:Ge,backgroundGraphics:Ye,showParticles:te,particleStyle:ne,legend:Ee,legendPosition:_,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;Ph(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:oe,colorScheme:Array.isArray(C)?C:void 0},ie))});function $h(t){const n=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,layout:s="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:w,chartId:k,selection:A,linkedHover:S,loading:C,loadingContent:O,legendInteraction:_,stroke:j,strokeWidth:P,opacity:M}=t,{width:L,height:T,enableHover:$,showLabels:N=!0,title:D,description:B,summary:I,accessibleTable:R}=n,F=fh({nodes:r(()=>uh(null!=o?o:null,c),[o,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:_,selection:A,linkedHover:S,onObservation:x,onClick:w,chartType:"TreeDiagram",chartId:k,marginDefaults:n.marginDefaults,userMargin:i,width:L,height:T,loading:C,loadingContent:O}),E=r(()=>new Map,[]),H=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?Ot[(e.depth||0)%Ot.length]:h?jt(e.data||e,h,F.colorScale):gs(void 0,F.themeCategorical,g,void 0,E),t},[h,f,F.colorScale,F.themeCategorical,g,E]),z=r(()=>Us(H,{stroke:j,strokeWidth:P,opacity:M}),[H,j,P,M]),W=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),G=r(()=>Us(W,{stroke:j,strokeWidth:P,opacity:M}),[W,j,P,M]),Y=r(()=>{if("treemap"===s||"circlepack"===s||"partition"===s)return hh(u)},[s,u]),q=Ys({componentName:"TreeDiagram",data:o});return q?e(Ms,{componentName:"TreeDiagram",message:q,width:L,height:T}):F.loadingEl?F.loadingEl:e(Ns,{componentName:"TreeDiagram",width:L,height:T,children:e(ch,Object.assign({chartType:s},null!=o&&{data:o},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:Y,treeOrientation:l,edgeType:p,nodeStyle:z,edgeStyle:G,colorBy:h,colorScheme:F.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:N?y||d:void 0,showLabels:N,enableHover:$,tooltipContent:!1===v?()=>null:$r(v)||void 0,customHoverBehavior:S||x||w?F.customHoverBehavior:void 0,customClickBehavior:x||w?F.customClickBehavior:void 0},_&&"none"!==_&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},{className:a,title:D,description:B,summary:I,accessibleTable:R},null!=t.animate&&{animate:t.animate},b))})}function Nh(t){const n=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:m,nodeStyle:v,tooltip:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:S,chartId:C,loading:O,loadingContent:_,legendInteraction:j,stroke:P,strokeWidth:M,opacity:L}=t,{nodeStyle:T}=x,$=Zs(x,["nodeStyle"]),{width:N,height:D,enableHover:B,showLabels:I=!0,title:R,description:F,summary:E,accessibleTable:H}=n,z=fh({nodes:r(()=>uh(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:g?void 0:d,colorScheme:h,showLegend:!1,legendInteraction:j,selection:w,linkedHover:k,onObservation:A,onClick:S,chartType:"Treemap",chartId:C,marginDefaults:n.marginDefaults,userMargin:i,width:N,height:D,loading:O,loadingContent:_}),W=Vs(w),G=z.customHoverBehavior,Y=l(e=>{if(!e)return G(null);const t=e.data||e;G({data:(null==t?void 0:t.data)||t})},[G]),q=r(()=>new Map,[]),V=r(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=g?Ot[(e.depth||0)%Ot.length]:d?jt(e.data||e,d,z.colorScale):gs(void 0,z.themeCategorical,h,void 0,q),t},[d,g,z.colorScale,z.themeCategorical,h,q]),X=r(()=>v||T?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},V(e)),T&&null!==(t=T(e))&&void 0!==t?t:{}),v&&null!==(n=v(e))&&void 0!==n?n:{})}:V,[V,v,T]),U=r(()=>Us(X,{stroke:P,strokeWidth:M,opacity:L}),[X,P,M,L]),K=r(()=>z.activeSelectionHook?e=>{var t;const n=Object.assign({},U(e));if(z.activeSelectionHook.isActive)if(z.activeSelectionHook.predicate(e.data||e))(null==W?void 0:W.selectedStyle)&&Object.assign(n,W.selectedStyle);else{const e=null!==(t=null==W?void 0:W.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==W?void 0:W.unselectedStyle)&&Object.assign(n,W.unselectedStyle)}return n}:U,[U,z.activeSelectionHook,W]),Q=r(()=>hh(c),[c]),Z=void 0!==m?m:!I||"parent"!==f&&"all"!==f?void 0:18,J=Ys({componentName:"Treemap",data:o});return J?e(Ms,{componentName:"Treemap",message:J,width:N,height:D}):z.loadingEl?z.loadingEl:e(Ns,{componentName:"Treemap",width:N,height:D,children:e(ch,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[N,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:u,childrenAccessor:s,hierarchySum:Q,padding:y,paddingTop:Z,nodeStyle:K,colorBy:d,colorScheme:z.effectivePalette,colorByDepth:g,nodeLabel:I?p||u:void 0,showLabels:I,labelMode:f,enableHover:B,tooltipContent:!1===b?()=>null:$r(b)||void 0},(k||A||S)&&{customHoverBehavior:Y},(A||S)&&{customClickBehavior:z.customClickBehavior},j&&"none"!==j&&{legendHoverBehavior:z.legendState.onLegendHover,legendClickBehavior:z.legendState.onLegendClick,legendHighlightedCategory:z.legendState.highlightedCategory,legendIsolatedCategories:z.legendState.isolatedCategories},{className:a,title:R,description:F,summary:E,accessibleTable:H},null!=t.animate&&{animate:t.animate},$))})}function Dh(t){const n=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:w,linkedHover:k,loading:A,loadingContent:S,legendInteraction:C,stroke:O,strokeWidth:_,opacity:j}=t,{width:P,height:M,enableHover:L,showLabels:T=!0,title:$,description:N,summary:D,accessibleTable:B}=n,I=fh({nodes:r(()=>uh(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:w,linkedHover:k,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:i,width:P,height:M,loading:A,loadingContent:S}),R=r(()=>new Map,[]),F=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?Ot[(e.depth||0)%Ot.length]:u?jt(e.data||e,u,I.colorScale):gs(void 0,I.themeCategorical,d,void 0,R),t},[u,h,I.colorScale,f,I.themeCategorical,d,R]),E=r(()=>Us(F,{stroke:O,strokeWidth:_,opacity:j}),[F,O,_,j]),H=r(()=>hh(l),[l]),z=Ys({componentName:"CirclePack",data:o});return z?e(Ms,{componentName:"CirclePack",message:z,width:P,height:M}):I.loadingEl?I.loadingEl:e(Ns,{componentName:"CirclePack",width:P,height:M,children:e(ch,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[P,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:H,padding:p,nodeStyle:E,colorBy:u,colorScheme:I.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:$r(y)||void 0,customHoverBehavior:k||v||b?I.customHoverBehavior:void 0,customClickBehavior:v||b?I.customClickBehavior:void 0},C&&"none"!==C&&{legendHoverBehavior:I.legendState.onLegendHover,legendClickBehavior:I.legendState.onLegendClick,legendHighlightedCategory:I.legendState.highlightedCategory,legendIsolatedCategories:I.legendState.isolatedCategories},{className:a,title:$,description:N,summary:D,accessibleTable:B},null!=t.animate&&{animate:t.animate},m))})}Th.displayName="ProcessSankey",$h.displayName="TreeDiagram",Nh.displayName="Treemap",Dh.displayName="CirclePack";const Bh=Ot;function Ih(t){const n=ws(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:w=!0,tooltip:k,foregroundGraphics:A,annotations:S,frameProps:C={},onObservation:O,onClick:_,chartId:j,selection:P,linkedHover:M,loading:L,loadingContent:T,stroke:$,strokeWidth:N,opacity:D}=t,{width:B,height:I,enableHover:R,title:F,description:E,summary:H,accessibleTable:z}=n,W=fh({nodes:r(()=>uh(o,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:P,linkedHover:M,onObservation:O,onClick:_,chartType:"OrbitDiagram",chartId:j,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:B,height:I,loading:L,loadingContent:T}),G=r(()=>new Map,[]),{colorScale:Y,customClickBehavior:q,customHoverBehavior:V,themeCategorical:X}=W,U=r(()=>{if(Array.isArray(u))return u;const e=At[u];return Array.isArray(e)?e:St},[u]),K=r(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?U[0]:Bh[(e.depth||0)%Bh.length]:c?jt(e.data||e,c,Y):gs(void 0,X,u,void 0,G),n.opacity=o?1:.85,n},[c,d,Y,U,X,u,G]),Q=r(()=>Us(K,{stroke:$,strokeWidth:N,opacity:D}),[K,$,N,D]),Z=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=r(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),ee=r(()=>{if(q)return e=>{q(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[q]),te=Ys({componentName:"OrbitDiagram",data:o});return te?e(Ms,{componentName:"OrbitDiagram",message:te,width:B,height:I}):W.loadingEl?W.loadingEl:e(Ns,{componentName:"OrbitDiagram",width:B,height:I,children:e(ch,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[B,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Q,edgeStyle:Z,colorBy:c,colorScheme:W.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!w&&R,tooltipContent:w?void 0:!1===k?()=>null:$r(k)||void 0,customHoverBehavior:M||O||_?J:void 0,customClickBehavior:O||_?ee:void 0,foregroundGraphics:A,annotations:S,className:a,title:F,description:E,summary:H,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:w,accessibleTable:z},null!=t.animate&&{animate:t.animate},C))})}Ih.displayName="OrbitDiagram";const Rh={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"},Fh={opacity:.7,marginRight:4};function Eh(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function Hh(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function zh(e={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=e;return e=>{var a;const s=null!==(a=null==e?void 0:e.data)&&void 0!==a?a:null,l=Eh(s,n,"time"),c=Eh(s,o,"value");return t("div",{className:"semiotic-tooltip",style:Rh,children:[t("div",{children:[t("span",{style:Fh,children:[i,":"]}),Hh(l)]}),t("div",{children:[t("span",{style:Fh,children:[r,":"]}),Hh(c)]})]})}}function Wh(e,t){var n;return null!=e?e:Math.max(null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0,200)}class Gh{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const e=new Gh;return e._count=this._count,e._mean=this._mean,e._m2=this._m2,e._min=this._min,e._max=this._max,e}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}}class Yh{constructor(e){var t,n,o;this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=null!==(t=e.window)&&void 0!==t?t:"tumbling",this.size=e.size;const i=null!==(n=e.hop)&&void 0!==n?n:e.size;this.hop=i>0&&e.size>=i?i:e.size,this.gap=null!==(o=e.gap)&&void 0!==o?o:e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,o=Math.floor(e/n);for(let i=Math.floor((e-this.size)/n)+1;o>=i;i++)this.bump(i*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new Gh,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,o=new Gh;o.push(t);let i=e,r=e;const a=[],s={start:i,end:r,stats:o};for(const t of this.sessions)e-n>t.end||t.start>e+n?a.push(t):(s.stats.merge(t.stats),i>t.start&&(i=t.start),t.end>r&&(r=t.end));s.start=i,s.end=r,a.push(s),a.sort((e,t)=>e.start-t.start),this.sessions=a}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const o=t+this.size;e.push(this.row(t,o,n,o>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,o){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:o}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}}function qh(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}const Vh={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Xh=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Uh(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;Xh.lastIndex=0;let n,o=0,i=0;for(;null!==(n=Xh.exec(t));){const e=parseFloat(n[1]),t=Vh[n[2]];if(null==t||!Number.isFinite(e))return null;o+=e*t,i+=n[0].length}return i!==t.length?null:o>0?o:null}const Kh="time",Qh="value",Zh="__aggLower",Jh="__aggUpper",eg="__aggPartial",tg="count",ng="__aggStart",og="__aggEnd";function ig(e,t){var n,o,i;const r=null!==(n=t.stat)&&void 0!==n?n:"mean",a=null!==(o=t.band)&&void 0!==o?o:"none",s=null!==(i=t.sigma)&&void 0!==i?i:1;return e.emit().map(e=>{const t={[Kh]:(e.start+e.end)/2,[Qh]:qh(e,r),[tg]:e.count,[eg]:e.partial,[ng]:e.start,[og]:e.end},n=function(e,t,n,o=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const i=qh(e,n),r=e.stddev*o;return[i-r,i+r]}(e,a,r,s);return n&&(t[Zh]=n[0],t[Jh]=n[1]),t})}class rg{constructor(e){var t;this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=null!==(t=e.latePolicy)&&void 0!==t?t:"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const o of this.held)this.getTime(o)>e?n.push(o):t.push(o);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}}function ag(e,t,n){const o="function"==typeof t?t(e):e[null!=t?t:n];if(null==o)return null;if(o instanceof Date)return o.getTime();const i=Number(o);return Number.isFinite(i)?i:null}const sg=g(function(t,n){var o,r,s,c,u,h,g,f,y,m,v;const b=ws(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(c=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:x,margin:w,className:k,arrowOfTime:A="right",windowMode:S="sliding",windowSize:C,data:O,timeAccessor:_,valueAccessor:j,timeExtent:P,valueExtent:M,extentPadding:L,stroke:T="#007bff",strokeWidth:$=2,strokeDasharray:N,opacity:D,background:B,tooltipContent:I,tooltip:R,onHover:F,annotations:E,autoPlaceAnnotations:H,svgAnnotationRules:z,tickFormatTime:W,tickFormatValue:G,decay:Y,pulse:q,staleness:V,transition:X,linkedHover:U,selection:K,onObservation:Q,chartId:Z,loading:J,loadingContent:ee,emptyContent:te,emphasis:ne,legendPosition:oe,aggregate:ie,eventTime:re}=t,ae=b.showAxes,se=b.enableHover,le=null!=w?w:b.marginDefaults,ce=null!=x?x:[b.width,b.height],ue=null!==(u=null!=I?I:R)&&void 0!==u?u:zh({timeAccessor:_,valueAccessor:j}),de=i(null),{customHoverBehavior:he}=ys({selection:K,linkedHover:U,unwrapData:!0,onObservation:Q,chartType:"RealtimeLineChart",chartId:Z}),ge=l(e=>{F&&F(e),he(e)},[F,he]),fe=null!=ie,[pe,ye]=d([]),me=i(null),ve=i(ie);ve.current=ie;const be=i(fe);be.current=fe;const xe=i(pe);xe.current=pe;const we=i({timeAccessor:_,valueAccessor:j});we.current={timeAccessor:_,valueAccessor:j};const ke=fe?[null!==(h=ie.window)&&void 0!==h?h:"tumbling",ie.size,null!==(g=ie.hop)&&void 0!==g?g:"",null!==(f=ie.gap)&&void 0!==f?f:"",null!==(y=ie.retain)&&void 0!==y?y:""].join("|"):"";a(()=>{if(!fe)return void(me.current=null);const e=ve.current,t=function(e){var t,n;const o=null!==(t=e.window)&&void 0!==t?t:"tumbling",i=Uh("session"===o&&null!==(n=e.gap)&&void 0!==n?n:e.size);if(null==i)return null;const r=null!=e.hop?Uh(e.hop):void 0,a=null!=e.gap?Uh(e.gap):void 0;return new Yh({window:o,size:i,hop:null!=r?r:void 0,gap:null!=a?a:void 0,retain:e.retain})}(e);if(me.current=t,t&&O){const{timeAccessor:e,valueAccessor:n}=we.current;for(const o of O){const i=ag(o,e,"time"),r=ag(o,n,"value");null!=i&&null!=r&&t.push(i,r)}}ye(t?ig(t,e):[])},[ke,fe,O]),a(()=>{fe&&me.current&&ye(ig(me.current,ve.current))},[null==ie?void 0:ie.stat,null==ie?void 0:ie.band,null==ie?void 0:ie.sigma]);const Ae=l(e=>{const t=me.current,n=ve.current;if(!t||!n)return;const{timeAccessor:o,valueAccessor:i}=we.current;for(const n of e){const e=ag(n,o,"time"),r=ag(n,i,"value");null!=e&&null!=r&&t.push(e,r)}ye(ig(t,n))},[]),Se=null!=re,Ce=i(null),Oe=i(re);Oe.current=re;const _e=i(Se);_e.current=Se;const je=i(Q);je.current=Q;const Pe=i(Z);Pe.current=Z;const Me=Se?`${re.lateness}|${null!==(m=re.latePolicy)&&void 0!==m?m:"drop"}`:"";a(()=>{Ce.current=Se?function(e){var t;const n=Uh(e.lateness);return null==n?null:new rg({lateness:n,getTime:e=>{var t;return null!==(t=ag(e,we.current.timeAccessor,"time"))&&void 0!==t?t:NaN},latePolicy:null!==(t=e.latePolicy)&&void 0!==t?t:"drop"})}(Oe.current):null},[Me,Se]);const Le=l(e=>{var t;0!==e.length&&(be.current?Ae(e):null===(t=de.current)||void 0===t||t.pushMany(e))},[Ae]),Te=l(e=>{var t,n,o;const i=Ce.current;if(!_e.current||!i)return void Le(e);const r=[];for(const a of e){const e=i.push(a);if(e.released.length&&r.push(...e.released),e.late.length){const r=je.current;if(r){const{timeAccessor:a}=we.current,s=null!==(n=null===(t=Oe.current)||void 0===t?void 0:t.latePolicy)&&void 0!==n?n:"drop";for(const t of e.late)r({type:"late-data",datum:t,eventTime:null!==(o=ag(t,a,"time"))&&void 0!==o?o:NaN,watermark:i.watermark,policy:s,lateCount:i.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Pe.current})}}}Le(r)},[Le]);p(n,()=>({push:e=>Te([e]),pushMany:e=>Te(e),remove:e=>{var t,n;return be.current?[]:null!==(n=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return be.current?[]:null!==(o=null===(n=de.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e,t,n;null===(e=Ce.current)||void 0===e||e.clear(),be.current?(null===(t=me.current)||void 0===t||t.clear(),ye([])):null===(n=de.current)||void 0===n||n.clear()},getData:()=>{var e,t;return be.current?xe.current:null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[Te]);const $e=Rs(J,ce[0],ce[1],ee),Ne=$e?null:Is(fe?void 0:O,ce[0],ce[1],te),De={stroke:T,strokeWidth:$,strokeDasharray:N};null!=D&&(De.opacity=D);const Be=Wh(C,O),Ie=ne?`${k||""} semiotic-emphasis-${ne}`.trim():k,Re=fe?pe:O,Fe=fe?Kh:_,Ee=fe?Qh:j,He=fe?"growing":S,ze=null!==(v=null==ie?void 0:ie.retain)&&void 0!==v?v:Math.max(pe.length,600),We=fe?Math.max(1,ze):Be,Ge=fe&&ie&&function(e){var t;return"none"!==(null!==(t=e.band)&&void 0!==t?t:"none")}(ie)?{y0Accessor:Zh,y1Accessor:Jh,perSeries:!1}:void 0;return $e||Ne||e(ka,{ref:de,chartType:"line",runtimeMode:"streaming",size:ce,margin:le,className:Ie,arrowOfTime:A,windowMode:He,windowSize:We,data:Re,timeAccessor:Fe,valueAccessor:Ee,xExtent:P,yExtent:M,extentPadding:L,band:Ge,lineStyle:De,showAxes:ae,background:B,hoverAnnotation:se,tooltipContent:ue,customHoverBehavior:ge,annotations:E,autoPlaceAnnotations:H,svgAnnotationRules:z,tickFormatTime:W,tickFormatValue:G,decay:Y,pulse:q,staleness:V,transition:X,pointIdAccessor:t.pointIdAccessor,legendPosition:oe})});function lg(e,t,n){const o="function"==typeof t?t(e):e[null!=t?t:n];if(null==o)return null;if(o instanceof Date)return o.getTime();if("string"==typeof o&&""===o.trim())return null;const i=Number(o);return Number.isFinite(i)?i:null}sg.displayName="RealtimeLineChart";const cg=g(function(n,o){var a,s,c,u,d;const h=ws(n.mode,{width:null!==(s=null===(a=n.size)||void 0===a?void 0:a[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:g,size:f,margin:y,className:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x,data:w,timeAccessor:k,valueAccessor:A,direction:S="up",timeExtent:C,valueExtent:O,extentPadding:_,categoryAccessor:j,colors:P,fill:M,stroke:L,strokeWidth:T,opacity:$,gap:N,background:D,tooltipContent:B,tooltip:I,onHover:R,annotations:F,autoPlaceAnnotations:E,svgAnnotationRules:H,tickFormatTime:z,tickFormatValue:W,linkedHover:G,selection:Y,decay:q,pulse:V,staleness:X,transition:U,onObservation:K,chartId:Q,loading:Z,loadingContent:J,emptyContent:ee,emphasis:te,legendPosition:ne,brush:oe,onBrush:ie,linkedBrush:re}=n,ae=h.showAxes,se=h.enableHover,le=null!=y?y:h.marginDefaults,ce=null!=f?f:[h.width,h.height],ue=null!==(d=null!=B?B:I)&&void 0!==d?d:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r;const a=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==a?void 0:a.binStart)||null==(null==a?void 0:a.binEnd)){const n=Eh(a,o,"time"),r=Eh(a,i,"value");return t("div",{className:"semiotic-tooltip",style:Rh,children:[t("div",{children:[e("span",{style:Fh,children:"x:"}),Hh(n)]}),t("div",{children:[e("span",{style:Fh,children:"y:"}),Hh(r)]})]})}return t("div",{className:"semiotic-tooltip",style:Rh,children:[t("div",{children:[e("span",{style:Fh,children:"range:"}),Hh(a.binStart),"–",Hh(a.binEnd)]}),null!=a.total&&t("div",{children:[e("span",{style:Fh,children:"count:"}),Hh(a.total)]}),null!=a.category&&t("div",{children:[e("span",{style:Fh,children:"category:"}),Hh(a.category)]})]})}}({timeAccessor:k,valueAccessor:A}),de=i(null),{customHoverBehavior:he}=ys({selection:Y,linkedHover:G,unwrapData:!0,onObservation:K,chartType:"RealtimeHistogram",chartId:Q}),ge=l(e=>{R&&R(e),he(e)},[R,he]),fe=!0===oe?{dimension:"x",snap:"bin"}:"x"===oe?{dimension:"x"}:"object"==typeof oe?oe:void 0,pe=Qa(re),ye=Ia(Object.assign({name:(null==pe?void 0:pe.name)||"__unused_hist_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof k?k:"time")},(null==pe?void 0:pe.yField)?{yField:pe.yField}:{})),me=i(ye.brushInteraction);me.current=ye.brushInteraction;const ve=l(e=>{if(ie&&ie(e),K&&K(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Q}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Q}),pe){const t=me.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ie,K,Q,pe]);p(o,()=>({push:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=de.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const be=Rs(Z,ce[0],ce[1],J),xe=be?null:Is(w,ce[0],ce[1],ee),we={};null!=M&&(we.fill=M),null!=L&&(we.stroke=L),null!=T&&(we.strokeWidth=T),null!=$&&(we.opacity=$),null!=N&&(we.gap=N);const ke=te?`${m||""} semiotic-emphasis-${te}`.trim():m,Ae=Wh(x,w),Se=r(()=>"down"!==S?O:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:r}){var a;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const s=new Map;for(const i of e){const e=lg(i,n,"time"),r=lg(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/o)*o;s.set(l,(null!==(a=s.get(l))&&void 0!==a?a:0)+r)}let l=0;for(const e of s.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:w,valueAccessor:A,timeAccessor:k,binSize:g,valueExtent:O,extentPadding:_}),[S,w,A,k,g,O,_]);return be||xe||e(ka,{ref:de,chartType:"bar",runtimeMode:"streaming",size:ce,margin:le,className:ke,arrowOfTime:v,windowMode:b,windowSize:Ae,data:w,timeAccessor:k,valueAccessor:A,xExtent:C,yExtent:Se,extentPadding:_,binSize:g,categoryAccessor:j,barColors:P,barStyle:we,showAxes:ae,background:D,hoverAnnotation:se,tooltipContent:ue,customHoverBehavior:ge,annotations:F,autoPlaceAnnotations:E,svgAnnotationRules:H,tickFormatTime:z,tickFormatValue:W,decay:q,pulse:V,staleness:X,transition:U,pointIdAccessor:n.pointIdAccessor,legendPosition:ne,brush:fe||(re?{dimension:"x"}:void 0),onBrush:fe||re?ve:void 0})});function ug(t){return e(cg,Object.assign({},t,{windowMode:"growing"}))}cg.displayName="RealtimeHistogram",ug.displayName="TemporalHistogram";const dg=g(function(t,n){var o,r,a,s,c;const u=ws(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(s=null===(a=t.size)||void 0===a?void 0:a[1])&&void 0!==s?s:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:w,valueExtent:k,extentPadding:A,categoryAccessor:S,colors:C,radius:O,fill:_,opacity:j,stroke:P,strokeWidth:M,background:L,tooltipContent:T,tooltip:$,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:I,tickFormatTime:R,tickFormatValue:F,linkedHover:E,selection:H,onObservation:z,chartId:W,loading:G,loadingContent:Y,emptyContent:q,emphasis:V,legendPosition:X}=t,U=u.showAxes,K=u.enableHover,Q=null!=h?h:u.marginDefaults,Z=null!=d?d:[u.width,u.height],J=null!==(c=null!=T?T:$)&&void 0!==c?c:zh({timeAccessor:b,valueAccessor:x}),ee=i(null),{customHoverBehavior:te}=ys({selection:H,linkedHover:E,unwrapData:!0,onObservation:z,chartType:"RealtimeSwarmChart",chartId:W}),ne=l(e=>{N&&N(e),te(e)},[N,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ee.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Rs(G,Z[0],Z[1],Y),ie=oe?null:Is(v,Z[0],Z[1],q),re={};null!=O&&(re.radius=O),null!=_&&(re.fill=_),null!=j&&(re.opacity=j),null!=P&&(re.stroke=P),null!=M&&(re.strokeWidth=M);const ae=V?`${g||""} semiotic-emphasis-${V}`.trim():g,se=Wh(m,v);return oe||ie||e(ka,{ref:ee,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:Q,className:ae,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:w,yExtent:k,extentPadding:A,categoryAccessor:S,barColors:C,swarmStyle:re,showAxes:U,background:L,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:ne,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:I,tickFormatTime:R,tickFormatValue:F,legendPosition:X,pointIdAccessor:t.pointIdAccessor})});dg.displayName="RealtimeSwarmChart";const hg=g(function(n,o){var r,a,s,c,u;const d=ws(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a: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:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:w,timeExtent:k,valueExtent:A,extentPadding:S,positiveColor:C,negativeColor:O,connectorStroke:_,connectorWidth:j,gap:P,stroke:M,strokeWidth:L,opacity:T,background:$,tooltipContent:N,tooltip:D,onHover:B,annotations:I,autoPlaceAnnotations:R,svgAnnotationRules:F,tickFormatTime:E,tickFormatValue:H,linkedHover:z,selection:W,onObservation:G,chartId:Y,loading:q,loadingContent:V,emptyContent:X,emphasis:U,legendPosition:K}=n,Q=d.showAxes,Z=d.enableHover,J=null!=g?g:d.marginDefaults,ee=null!=h?h:[d.width,d.height],te=null!==(u=null!=N?N:D)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r,a;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,l=Eh(s,o,"time"),c=null!==(a=null==s?void 0:s.delta)&&void 0!==a?a:Eh(s,i,"value"),u=null==s?void 0:s.cumEnd,d="number"==typeof c?0>c?Hh(c):"+"+Hh(c):Hh(c);return t("div",{className:"semiotic-tooltip",style:Rh,children:[t("div",{children:[e("span",{style:Fh,children:"x:"}),Hh(l)]}),t("div",{children:[e("span",{style:Fh,children:"Δ:"}),d]}),null!=u&&t("div",{children:[e("span",{style:Fh,children:"total:"}),Hh(u)]})]})}}({timeAccessor:x,valueAccessor:w}),ne=i(null),{customHoverBehavior:oe}=ys({selection:W,linkedHover:z,unwrapData:!0,onObservation:G,chartType:"RealtimeWaterfallChart",chartId:Y}),ie=l(e=>{B&&B(e),oe(e)},[B,oe]);p(o,()=>({push:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ne.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ne.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ne.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const re=Rs(q,ee[0],ee[1],V),ae=re?null:Is(b,ee[0],ee[1],X),se={};null!=C&&(se.positiveColor=C),null!=O&&(se.negativeColor=O),null!=_&&(se.connectorStroke=_),null!=j&&(se.connectorWidth=j),null!=P&&(se.gap=P),null!=M&&(se.stroke=M),null!=L&&(se.strokeWidth=L),null!=T&&(se.opacity=T);const le=U?`${f||""} semiotic-emphasis-${U}`.trim():f,ce=Wh(v,b);return re||ae||e(ka,{ref:ne,chartType:"waterfall",runtimeMode:"streaming",size:ee,margin:J,className:le,arrowOfTime:y,windowMode:m,windowSize:ce,data:b,timeAccessor:x,valueAccessor:w,xExtent:k,yExtent:A,extentPadding:S,waterfallStyle:se,showAxes:Q,background:$,hoverAnnotation:Z,tooltipContent:te,customHoverBehavior:ie,annotations:I,autoPlaceAnnotations:R,svgAnnotationRules:F,tickFormatTime:E,tickFormatValue:H,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});hg.displayName="RealtimeWaterfallChart";const gg=g(function(n,o){var r,a,s,c,u;const d=ws(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a: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:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:w,categoryAccessor:k,timeExtent:A,valueExtent:S,extentPadding:C,heatmapXBins:O=20,heatmapYBins:_=20,aggregation:j="count",background:P,tooltipContent:M,tooltip:L,onHover:T,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:D,tickFormatTime:B,tickFormatValue:I,decay:R,pulse:F,staleness:E,linkedHover:H,selection:z,onObservation:W,chartId:G,loading:Y,loadingContent:q,emptyContent:V,emphasis:X,legendPosition:U}=n,K=d.showAxes,Q=d.enableHover,Z=null!=g?g:d.marginDefaults,J=null!=h?h:[d.width,d.height],ee=null!==(u=null!=M?M:L)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i,xLabel:r="x",yLabel:a="y"}=n;return n=>{var s,l,c,u;const d=null!==(s=null==n?void 0:n.data)&&void 0!==s?s:null,h=null!==(l=null==d?void 0:d.xCenter)&&void 0!==l?l:Eh(d,o,"time"),g=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:Eh(d,i,"value"),f=null==d?void 0:d.count,p=null==d?void 0:d.sum,y=null==d?void 0:d.value,m=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return t("div",{className:"semiotic-tooltip",style:Rh,children:[t("div",{children:[t("span",{style:Fh,children:[r,":"]}),Hh(h)]}),t("div",{children:[t("span",{style:Fh,children:[a,":"]}),Hh(g)]}),null!=f&&t("div",{children:[e("span",{style:Fh,children:"count:"}),Hh(f)]}),"sum"===m&&null!=p&&t("div",{children:[e("span",{style:Fh,children:"sum:"}),Hh(p)]}),"mean"===m&&null!=y&&t("div",{children:[e("span",{style:Fh,children:"mean:"}),Hh(y)]})]})}}({timeAccessor:x,valueAccessor:w}),te=i(null),{customHoverBehavior:ne}=ys({selection:z,linkedHover:H,unwrapData:!0,onObservation:W,chartType:"RealtimeHeatmap",chartId:G}),oe=l(e=>{T&&T(e),ne(e)},[T,ne]);p(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Rs(Y,J[0],J[1],q),re=ie?null:Is(b,J[0],J[1],V),ae=X?`${f||""} semiotic-emphasis-${X}`.trim():f,se=Wh(v,b);return ie||re||e(ka,{ref:te,chartType:"heatmap",runtimeMode:"streaming",size:J,margin:Z,className:ae,arrowOfTime:y,windowMode:m,windowSize:se,data:b,timeAccessor:x,valueAccessor:w,categoryAccessor:k,xExtent:A,yExtent:S,extentPadding:C,heatmapXBins:O,heatmapYBins:_,heatmapAggregation:j,showAxes:K,background:P,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:oe,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:D,tickFormatTime:B,tickFormatValue:I,decay:R,pulse:F,staleness:E,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});function fg(e,t={}){var n,o,i,r,a,s,l;if("function"==typeof e)return e;const c=null!==(n=t.locale)&&void 0!==n?n:"en-US",u=null!==(o=t.currency)&&void 0!==o?o:"USD";if("currency"===e){const e=null!==(i=t.precision)&&void 0!==i?i:2,n=new Intl.NumberFormat(c,{style:"currency",currency:u,maximumFractionDigits:e,minimumFractionDigits:e});return e=>n.format(e)}if("percent"===e){const e=null!==(r=t.precision)&&void 0!==r?r:1,n=new Intl.NumberFormat(c,{style:"percent",maximumFractionDigits:e,minimumFractionDigits:0});return e=>n.format(e)}if("compact"===e){const e=null!==(a=t.precision)&&void 0!==a?a:1,n=new Intl.NumberFormat(c,{notation:"compact",maximumFractionDigits:e,minimumFractionDigits:0});return e=>n.format(e)}if("duration"===e)return e=>function(e){if(!Number.isFinite(e))return e+"";const t=0>e?"-":"",n=Math.abs(e);if(1e3>n)return`${t}${Math.round(n)}ms`;const o=n/1e3;if(60>o)return`${t}${i=o,Math.round(100*i)/100+""}s`;var i;const r=o/60;if(60>r){const e=Math.floor(r),n=Math.round(o-60*e);return 0===n?`${t}${e}m`:`${t}${e}m ${n}s`}const a=r/60;if(24>a){const e=Math.floor(a),n=Math.round(r-60*e);return 0===n?`${t}${e}h`:`${t}${e}h ${n}m`}const s=Math.floor(a/24),l=Math.round(a-24*s);return 0===l?`${t}${s}d`:`${t}${s}d ${l}h`}(e);const d=null!==(s=t.precision)&&void 0!==s?s:0,h=new Intl.NumberFormat(c,{notation:null!==(l=t.notation)&&void 0!==l?l:"standard",maximumFractionDigits:d,minimumFractionDigits:0});return e=>h.format(e)}function pg(e,t,n){return`${null!=t?t:""}${e}${null!=n?n:""}`}gg.displayName="RealtimeHeatmap";const yg={tile:{width:280,height:184,align:"start",labelSize:13,captionSize:11,valueSize:40,deltaSize:13,padding:{top:14,right:16,bottom:14,left:16},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:44},presentation:{width:540,height:320,align:"center",labelSize:18,captionSize:14,valueSize:96,deltaSize:18,padding:{top:32,right:32,bottom:32,left:32},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:80},inline:{width:void 0,height:void 0,align:"inherit",labelSize:0,captionSize:0,valueSize:0,deltaSize:0,padding:{top:0,right:0,bottom:0,left:0},background:"transparent",border:!1,showHeader:!1,showDelta:!0,showTrend:!1,showChart:!1,chartSize:0},thumbnail:{width:96,height:56,align:"center",labelSize:0,captionSize:0,valueSize:22,deltaSize:0,padding:{top:4,right:6,bottom:4,left:6},background:"transparent",border:!1,showHeader:!1,showDelta:!1,showTrend:!1,showChart:!1,chartSize:0}};function mg(e,t,n){return void 0===e?n:"function"==typeof e?e(t):e}function vg(e){return"positive"===e?"var(--semiotic-success, currentColor)":"negative"===e?"var(--semiotic-danger, currentColor)":"var(--semiotic-text-secondary, currentColor)"}function bg(e){return"positive"===e?"▲":"negative"===e?"▼":"■"}const xg=g((o,s)=>{var c,u,h,g;const{value:f,label:y,caption:m,format:v,locale:b,currency:x,precision:w,prefix:k,suffix:A,unit:S,comparison:C,target:O,delta:_,deltaFormat:j,showDeltaPercent:P,direction:M,sentiment:L,thresholds:T,windowSize:$=60,mode:N="tile",align:D,width:B,height:I,padding:R,emphasis:F,color:E,background:H,borderColor:z,borderRadius:W,className:G,style:Y,animate:q,stalenessThreshold:V,staleLabel:X,headerSlot:U,valueSlot:K,deltaSlot:Q,trendSlot:Z,chartSlot:J,chartSize:ee,footerSlot:te,onClick:ne,onObservation:oe,chartId:ie,description:re,summary:ae,loading:se,loadingContent:le,emptyContent:ce}=o,ue=null!==(c=yg[N])&&void 0!==c?c:yg.tile,de=null!=D?D:ue.align,he=null!=B?B:ue.width,ge=null!=I?I:ue.height,fe=Br(),[pe,ye]=d([]),[me,ve]=d(null),[be,xe]=d(null),[we,ke]=d(null),Ae=i([]),Se=i(null),Ce=i(f);a(()=>{Ce.current=f},[f]);const Oe=i($);a(()=>{Oe.current=$},[$]);const _e=l(e=>{const t="number"==typeof e?{value:e,time:Date.now()}:Object.assign({time:Date.now()},e),n="number"==typeof t.time?t.time:t.time instanceof Date?t.time.getTime():Date.now();return Object.assign(Object.assign({},t),{time:n})},[]),je=l(e=>{if(0===e.length)return;const t=Oe.current,n=e.map(_e);let o=Ae.current.concat(n);o.length>t&&(o=o.slice(o.length-t)),Ae.current=o;const i=n[n.length-1];Se.current=i.value,ye(o),ve(i.value);for(let e=n.length-1;e>=0;e--){const t=n[e].comparison;if(null!=t){xe(t);break}}ke(i.time)},[_e]),Pe=l(e=>je([e]),[je]);p(s,()=>({push:e=>Pe(e),pushMany:e=>je(e),clear:()=>{Ae.current=[],Se.current=null,ye([]),ve(null),xe(null),ke(null)},getValue:()=>{var e;return null!==(e=Se.current)&&void 0!==e?e:Number.isFinite(Ce.current)?Ce.current:null},getData:()=>Ae.current.slice()}),[Pe,je]);const Me=null!=me?me:f,Le=null==Me||"number"!=typeof Me||!Number.isFinite(Me),Te=r(()=>fg(null!=v?v:"number",{locale:b,currency:x,precision:w}),[v,b,x,w]),$e=r(()=>{var e;return fg(null!==(e=null!=j?j:v)&&void 0!==e?e:"number",{locale:b,currency:x,precision:null==j&&null==v?0:w})},[j,v,b,x,w]),Ne=null!=q&&q,De=i(("object"==typeof Ne&&!1===Ne.intro||!Ne)&&Number.isFinite(f)?f:0),Be=function(e,t,n){const[o,r]=d(e),s=i(null),l=i(e),c=i(0),u=i(e);return a(()=>{if(!Number.isFinite(e))return void r(e);if(!t||n)return void r(e);const i="object"==typeof t&&t.duration?t.duration:300,a="object"==typeof t&&"linear"===t.easing?"linear":"ease-out";l.current=o,u.current=e,c.current="undefined"!=typeof performance?performance.now():Date.now();const d="linear"===a?e=>e:e=>1-Math.pow(1-e,3),h=e=>{const t=Math.min(1,(e-c.current)/i),n=d(t);r(l.current+(u.current-l.current)*n),1>t?s.current=requestAnimationFrame(h):(s.current=null,r(u.current))};return s.current=requestAnimationFrame(h),()=>{null!=s.current&&cancelAnimationFrame(s.current),s.current=null}},[e,t,n]),o}(Number.isFinite(Me)?Me:De.current,Ne,fe),Ie=Ne?Be:Number.isFinite(Me)?Me:0,Re=r(()=>function(e,t){if(!t||0===t.length)return null;if(!Number.isFinite(e))return null;const n=t.filter(e=>Number.isFinite(e.at)||e.at===-1/0).slice().sort((e,t)=>e.at-t.at);let o=null;for(const t of n){if(t.at>e)break;o=t}return o}(Number.isFinite(Me)?Me:NaN,T),[Me,T]),Fe=Re?Re.level:"neutral",Ee=null!=E?E:function(e,t){return t||("neutral"===e?"var(--semiotic-text, currentColor)":`var(--semiotic-${e}, currentColor)`)}(Fe,null==Re?void 0:Re.color),He=null!==(u=null!=be?be:null==C?void 0:C.value)&&void 0!==u?u:null,ze=null!=_?_:null!=He&&Number.isFinite(Me)?Me-He:null,We=function(e,t,n){if(n&&"auto"!==n)return n;if(null==e||0===e||!Number.isFinite(e))return"neutral";const o=null!=t?t:"higher-is-better";return"neutral"===o?"neutral":("higher-is-better"===o?e>0:0>e)?"positive":"negative"}(ze,null!==(g=null!==(h=null==C?void 0:C.direction)&&void 0!==h?h:null==O?void 0:O.direction)&&void 0!==g?g:M,L),Ge=null!=ze&&Number.isFinite(ze)?function(e,t){return Number.isFinite(e)?0===e?t(0):`${e>0?"+":"−"}${t(Math.abs(e))}`:""}(ze,$e):null,Ye=r(()=>new Intl.NumberFormat(null!=b?b:"en-US",{style:"percent",maximumFractionDigits:1,minimumFractionDigits:0,signDisplay:"exceptZero"}),[b]),qe=null!=He&&Number.isFinite(Me)&&(null==P||P)&&0!==He?Ye.format((Me-He)/Math.abs(He)):null,Ve=r(()=>new Intl.NumberFormat(null!=b?b:"en-US",{style:"percent",maximumFractionDigits:0}),[b]),Xe=r(()=>O&&Number.isFinite(Me)&&O.value?Ve.format(Me/O.value):null,[O,Me,Ve]),Ue=r(()=>{var e,t;return fg(null!==(t=null!==(e=null==O?void 0:O.format)&&void 0!==e?e:v)&&void 0!==t?t:"number",{locale:b,currency:x,precision:w})},[null==O?void 0:O.format,v,b,x,w]),Ke=r(()=>{var e,t;return fg(null!==(t=null!==(e=null==C?void 0:C.format)&&void 0!==e?e:v)&&void 0!==t?t:"number",{locale:b,currency:x,precision:w})},[null==C?void 0:C.format,v,b,x,w]),Qe=function(e,t){const[n,o]=d(!1);return a(()=>{if(!t||null==e)return void o(!1);const n=()=>{const n=Date.now()-e;o(n>=t)};n();const i=setInterval(n,Math.max(250,Math.floor(t/4)));return()=>clearInterval(i)},[e,t]),n}(we,V),Ze=Number.isFinite(Ie)?pg(Te(Ie),k,A):"",Je={value:Le?null:Me,formattedValue:Ze,level:Fe,color:Ee,delta:ze,deltaFormatted:Ge,deltaPercent:qe,sentiment:We,isStale:Qe,pushBuffer:pe},et=null!=re?re:function(e){var t;const n=[];if(e.label&&n.push(e.label+":"),n.push(e.unit?`${e.formattedValue} ${e.unit}`:e.formattedValue),e.deltaFormatted){const t=e.delta;n.push(`${null!=t&&Number.isFinite(t)&&0!==t?t>0?"up":"down":"change"} ${e.deltaFormatted}${e.deltaPercent?` (${e.deltaPercent})`:""}${e.comparisonLabel?" from "+e.comparisonLabel:""}`)}return e.targetPercent&&e.targetLabel&&n.push(`${e.targetPercent} of ${e.targetLabel}`),e.stale&&n.push(null!==(t=e.staleLabel)&&void 0!==t?t:"stale"),n.join(", ")}({label:y,formattedValue:Number.isFinite(Me)?pg(Te(Me),k,A):"",unit:S,comparisonLabel:null==C?void 0:C.label,delta:ze,deltaFormatted:Ge,deltaPercent:qe,targetLabel:null==O?void 0:O.label,targetPercent:Xe,stale:Qe,staleLabel:X}),tt="number"==typeof R?{top:R,right:R,bottom:R,left:R}:Object.assign(Object.assign({},ue.padding),null!=R?R:{}),nt="end"===de?"flex-end":"center"===de?"center":"start"===de?"flex-start":"inherit",ot=Object.assign({position:"relative",boxSizing:"border-box",width:he,height:ge,padding:`${tt.top}px ${tt.right}px ${tt.bottom}px ${tt.left}px`,background:null!=H?H:ue.background,border:ue.border?"1px solid "+(null!=z?z:"var(--semiotic-border, #e2e2e2)"):void 0,borderRadius:"number"==typeof W?W+"px":null!=W?W:"var(--semiotic-border-radius, 8px)",display:"inline"===N?"inline-flex":"flex",flexDirection:"column",alignItems:"inherit"===nt?void 0:nt,textAlign:de,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",color:"var(--semiotic-text, #111)",opacity:Qe?.55:1,transition:"opacity 240ms ease-out",gridColumn:"primary"===F?"span 2":void 0,cursor:ne?"pointer":void 0},Y),it=l(e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,o=e.clientY-t.top,i={value:Le?NaN:Me,level:Fe,delta:ze};ne&&ne(i,{x:n,y:o}),oe&&oe({type:"click",datum:i,x:n,y:o,chartType:"BigNumber",chartId:ie,timestamp:Date.now()})},[ne,oe,ie,Le,Me,Fe,ze]),rt="inline"===N?"span":"div",at=["semiotic-bignumber","semiotic-bignumber--mode-"+N,"semiotic-bignumber--level-"+Fe,"semiotic-bignumber--sentiment-"+We,Qe?"semiotic-bignumber--stale":null,G].filter(Boolean).join(" "),st="positive"===We?"up":"negative"===We?"down":"flat";if(se){const t="number"==typeof he?he:280,n="number"==typeof ge?ge:160;return e(rt,{role:"status","aria-live":"polite","aria-busy":"true",className:at+" semiotic-bignumber--loading",style:Object.assign(Object.assign({},ot),{opacity:1}),children:null!=le?le:e(kg,{width:t,height:n,mode:N})})}return Le?!1===ce?null:e(rt,{role:"status","aria-label":y?y+": no value":"no value",className:at+" semiotic-bignumber--empty",style:Object.assign(Object.assign({},ot),{color:"var(--semiotic-text-secondary, #666)",fontSize:13,alignItems:"center",justifyContent:"center"}),children:null!=ce?ce:"—"}):e(Ns,{componentName:"BigNumber",width:"number"==typeof he?he:280,height:"number"==typeof ge?ge:160,children:t(rt,{role:"group","aria-label":et,"data-chart":"BigNumber","data-mode":N,"data-level":Fe,"data-stale":Qe?"true":void 0,"data-sentiment":We,className:at,style:ot,onClick:ne||oe?it:void 0,children:[ue.showHeader&&(y||m||U)?e("div",{className:"semiotic-bignumber__header",style:{display:"flex",flexDirection:"column",gap:2,marginBottom:6,paddingRight:ue.showChart&&null!=J?(null!=ee?ee:ue.chartSize)+8:0},children:mg(U,Je,t(n,{children:[y?e("span",{className:"semiotic-bignumber__label",style:{fontSize:ue.labelSize,color:"var(--semiotic-text-secondary, #6b7280)",fontWeight:500,letterSpacing:.2},children:y}):null,m?e("span",{className:"semiotic-bignumber__caption",style:{fontSize:ue.captionSize,color:"var(--semiotic-text-secondary, #9ca3af)"},children:m}):null]}))}):null,mg(K,Je,t(rt,{className:"semiotic-bignumber__value semiotic-bignumber__value--"+Fe,style:{display:"inline"===N?"inline-flex":"flex",alignItems:"baseline",gap:6,fontVariantNumeric:"tabular-nums",fontWeight:600,color:Ee,fontSize:ue.valueSize||void 0,lineHeight:1.05},children:[e("span",{className:"semiotic-bignumber__value-text",children:Ze}),S?e("span",{className:"semiotic-bignumber__unit",style:{fontSize:ue.valueSize?Math.max(11,Math.round(.32*ue.valueSize)):"0.75em",color:"var(--semiotic-text-secondary, #9ca3af)",fontWeight:500},children:S}):null]})),ue.showDelta&&(Ge||O||C)?e(rt,{className:"semiotic-bignumber__delta semiotic-bignumber__delta--"+st,style:{display:"inline"===N?"inline-flex":"flex",flexWrap:"wrap",gap:8,alignItems:"baseline",marginTop:"inline"===N?0:6,fontSize:ue.deltaSize||void 0,color:"var(--semiotic-text-secondary, #6b7280)"},children:mg(Q,Je,t(n,{children:[Ge?t("span",{className:"semiotic-bignumber__delta-row semiotic-bignumber__delta-row--"+st,style:{display:"inline-flex",alignItems:"center",gap:4,color:vg(We),fontWeight:600},children:[e("span",{"aria-hidden":"true",className:"semiotic-bignumber__arrow semiotic-bignumber__arrow--"+st,children:bg(We)}),e("span",{className:"semiotic-bignumber__delta-amount",children:Ge}),qe?t("span",{className:"semiotic-bignumber__delta-percent",style:{fontWeight:500},children:["(",qe,")"]}):null]}):null,(null==C?void 0:C.label)?e("span",{className:"semiotic-bignumber__comparison-label",children:C.label}):null,O?t("span",{className:"semiotic-bignumber__target",style:{display:"inline-flex",alignItems:"baseline",gap:4},children:[Ge||(null==C?void 0:C.label)?e("span",{"aria-hidden":"true",className:"semiotic-bignumber__separator",children:"·"}):null,e("span",{className:"semiotic-bignumber__target-percent",style:{fontWeight:500,color:"var(--semiotic-text, #111)"},children:Xe}),t("span",{className:"semiotic-bignumber__target-value",children:["of ",Ue(O.value),O.label?" "+O.label:""]})]}):null]}))}):null,ue.showChart&&null!=J?e("div",{className:"semiotic-bignumber__chart",style:{position:"absolute",top:tt.top,right:tt.right,width:null!=ee?ee:ue.chartSize,height:null!=ee?ee:ue.chartSize,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e("div",{style:{pointerEvents:"auto",lineHeight:0},children:mg(J,Je,null)})}):null,ue.showTrend&&null!=Z?e("div",{className:"semiotic-bignumber__trend",style:{position:"absolute",left:tt.left,right:tt.right,bottom:tt.bottom+(null!=te?28:0)},children:mg(Z,Je,null)}):null,null!=te?e(rt,{className:"semiotic-bignumber__footer",style:{position:"absolute",left:tt.left,right:tt.right,bottom:tt.bottom,fontSize:ue.deltaSize||void 0,color:"var(--semiotic-text-secondary, #9ca3af)"},children:mg(te,Je,null)}):null,ae?e("span",{style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:ae}):null,e("span",{"aria-hidden":"true",style:{display:"none"},children:null!=He?Ke(He):null})]})})});xg.displayName="BigNumber";const wg=xg;function kg(n){const o=Math.floor(.45*n.width),i=Math.floor(.6*n.width),r=(t,n)=>e("div",{style:{width:t,height:n,background:"var(--semiotic-border, #e0e0e0)",borderRadius:4,opacity:.55}});return t("div",{style:{display:"flex",flexDirection:"column",gap:10,justifyContent:"center",width:"100%",height:"100%"},children:["thumbnail"!==n.mode&&"inline"!==n.mode?r(o,10):null,r(i,"presentation"===n.mode?48:28),"tile"===n.mode||"presentation"===n.mode?r(Math.floor(.35*n.width),8):null]})}const[Ag]=_e(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Sg(e,t){return Js(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:i=2,background:r="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Cg(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Og(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*i,n=l.height*i,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,n),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),a.toBlob(n=>{n?(Og(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Cg(e,t){var n;const o=e.children,i=t.children,r=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,i.length)>e;e++)Cg(o[e],i[e])}function Og(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const _g={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},jg={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"},xScaleType:{type:"string",enum:["linear","log","time"]},yScaleType:{type:"string",enum:["linear","log","time"]}},Pg={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Mg=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Lg=["vertical","horizontal"],Tg={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Mg},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Mg},gradientFill:{type:["boolean","object"]},semanticGradient:{type:"array"},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:Mg},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Mg},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},symbolBy:{type:["string","function"]},symbolMap:{type:"object"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),jg),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Lg},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},symbolBy:{type:["string","function"]},symbolMap:{type:"object"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Lg},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_g),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_g),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"none",dataAccessors:[],props:Object.assign(Object.assign({},_g),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},gradientFill:{type:"object"},arcWidth:{type:"number"},cornerRadius:{type:"number"},sweep:{type:"number"},fillZones:{type:"boolean"},showNeedle:{type:"boolean"},needleColor:{type:"string"},color:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_g),Pg),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_g),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_g),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Lg},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_g),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_g),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},nodeStyle:{type:"function"}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},TemporalHistogram:{required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],props:{data:{type:"array"},binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},_g),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},_g),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},_g),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},_g),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},_g),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})},BigNumber:{required:[],dataShape:"none",dataAccessors:[],props:{width:{type:["number","string"]},height:{type:["number","string"]},className:{type:"string"},onClick:{type:"function"},value:{type:"number"},label:{type:"string"},caption:{type:"string"},format:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},locale:{type:"string"},currency:{type:"string"},precision:{type:"number"},prefix:{type:"string"},suffix:{type:"string"},unit:{type:"string"},comparison:{type:"object"},target:{type:"object"},delta:{type:"number"},deltaFormat:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},showDeltaPercent:{type:"boolean"},direction:{type:"string",enum:["higher-is-better","lower-is-better","neutral"]},sentiment:{type:"string",enum:["auto","positive","negative","neutral"]},thresholds:{type:"array"},chartSlot:{type:["string","number","array","object","function"]},chartSize:{type:"number"},windowSize:{type:"number"},mode:{type:"string",enum:["tile","presentation","inline","thumbnail"]},align:{type:"string",enum:["start","center","end"]},padding:{type:["number","object"]},emphasis:{type:"string",enum:["primary","secondary"]},color:{type:"string"},background:{type:"string"},borderColor:{type:"string"},borderRadius:{type:["number","string"]},animate:{type:["boolean","object"]},stalenessThreshold:{type:"number"},staleLabel:{type:"string"},headerSlot:{type:["string","number","array","object","function"]},valueSlot:{type:["string","number","array","object","function"]},deltaSlot:{type:["string","number","array","object","function"]},trendSlot:{type:["string","number","array","object","function"]},footerSlot:{type:["string","number","array","object","function"]},onObservation:{type:"function"}}}};function $g(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Ng(e,t){const n=[];null!=t&&"object"==typeof t||(t={});const o=Tg[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Tg).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);"array"!==o.dataShape||o.required.includes("data")||null!=t.data||n.push(`"data" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!$g(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Hs(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const a=Gs({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=Ys({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=qs({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}const Dg=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Bg=new Set(["data","nodes","edges"]),Ig="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Rg(e,t,n){if(!Tg[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Tg).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),i={};for(const[e,n]of Object.entries(t))null!=n&&(Dg.has(e)||!o&&Bg.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(i[e]=Ig(n))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Fg(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Tg[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Ig(e.props)}}function Eg(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Hg(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function zg(e){return Js(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Wg(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Wg(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}const Gg=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Yg=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),qg=new Set(["PieChart","DonutChart","FunnelChart"]),Vg=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Xg(e,t){var n,o;return Yg.has(e)||qg.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:null!==(n=t.categoryAccessor)&&void 0!==n?n:t.stepAccessor,dimensionFallback:"category"}:{measure:null!==(o=t.yAccessor)&&void 0!==o?o:t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Ug(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function Kg(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Qg(e,t){const n=Object.assign({},e);return t.provenance&&(n.provenance=t.provenance),t.lifecycle&&(n.lifecycle=t.lifecycle),n}function Zg(){return(new Date).toISOString()}function Jg(e,t={}){var n,o;const i=e.provenance;return Object.assign(Object.assign({},e),{provenance:Object.assign(Object.assign(Object.assign({},i),t),{createdAt:null!==(o=null!==(n=t.createdAt)&&void 0!==n?n:null==i?void 0:i.createdAt)&&void 0!==o?o:Zg()})})}function ef(e){if(null==e)return null;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const t=Date.parse(e);return Number.isFinite(t)?t:null}function tf(e){const t=ef(null==e?void 0:e.now);if(null!=t)return t;const n=null==e?void 0:e.dataExtent;if(n)if(Array.isArray(n)){const e=ef(n[n.length-1]);if(null!=e)return e}else if("max"in n){const e=ef(n.max);if(null!=e)return e}return Date.now()}function nf(e,t,n={}){var o,i,r;const a=null===(o=null==e?void 0:e.lifecycle)||void 0===o?void 0:o.freshness,s=ef(null===(i=null==e?void 0:e.provenance)||void 0===i?void 0:i.createdAt),l=function(e){if(null==e)return null;if("number"==typeof e)return e;const t=function(e){const t=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(e);return t?1e3*(3600*(24*parseInt(t[1]||"0",10)+parseInt(t[2]||"0",10))+60*parseInt(t[3]||"0",10)+parseInt(t[4]||"0",10)):0}(e);return t>0?t:null}(null===(r=null==e?void 0:e.lifecycle)||void 0===r?void 0:r.ttlHint);return null==s||null==l?null!=a?a:"fresh":Xn(t-s,l,n)}function of(e,t={}){const n=tf(t);return e.map(e=>{const o=nf(e,n,t.thresholds);return Object.assign(Object.assign({},e),{lifecycle:Object.assign(Object.assign({},e.lifecycle),{freshness:o})})})}const rf={fresh:null,aging:.55,stale:.35,expired:.2},af={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function sf(e,t,n){return e&&n in e?e[n]:t[n]}function lf(e,t={}){var n,o;const i=tf(t),r=!0===t.showExpiredAnnotations,a=[];for(const s of e){const e=nf(s,i,t.thresholds);if("expired"===e&&!r)continue;const l=sf(t.opacity,rf,e),c=sf(t.strokeDasharray,af,e),u=null===(n=t.labelSuffix)||void 0===n?void 0:n[e],d=Object.assign(Object.assign({},s),{lifecycle:Object.assign(Object.assign({},s.lifecycle),{freshness:e})});null!=l&&null==d.opacity&&(d.opacity=l),null!=c&&null==d.strokeDasharray&&(d.strokeDasharray=c),u&&"string"==typeof d.label&&(d.label=d.label+u);const h=null===(o=s.lifecycle)||void 0===o?void 0:o.anchor;h&&null==d.anchor&&(d.anchor=h),a.push(d)}return a}const cf={proposed:.7,accepted:null,disputed:.7,retracted:.25},uf={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},df={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function hf(e,t,n){return e&&n in e?e[n]:t[n]}function gf(e,t={}){var n,o;const i=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,a=new Set;for(const t of e){const e=null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.supersedes;e&&"retracted"!==(null===(o=null==t?void 0:t.lifecycle)||void 0===o?void 0:o.status)&&a.add(e)}return e.filter(e=>{var t,n;if("retracted"===(null===(t=null==e?void 0:e.lifecycle)||void 0===t?void 0:t.status)&&!i)return!1;const o=null===(n=null==e?void 0:e.provenance)||void 0===n?void 0:n.stableId;return!(o&&a.has(o)&&!r)})}function ff(e,t={}){var n,o,i;const r=[];for(const a of gf(e,t)){const e=null===(n=null==a?void 0:a.lifecycle)||void 0===n?void 0:n.status;if(!e){r.push(a);continue}const s=hf(t.opacity,cf,e),l=hf(t.strokeDasharray,uf,e),c=null!==(i=null===(o=t.labelSuffix)||void 0===o?void 0:o[e])&&void 0!==i?i:df[e],u=Object.assign({},a);null!=s&&(u.opacity=("number"==typeof u.opacity?u.opacity:1)*s),null!=l&&null==u.strokeDasharray&&(u.strokeDasharray=l),c&&"string"==typeof u.label&&(u.label=u.label+c),r.push(u)}return r}const pf={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value"},yf=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]);function mf(e){return pf[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}const vf=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),bf={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},xf={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},wf=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],kf={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function Af(e){return bf[e]}function Sf(e,t){var n;const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,n={};for(const[e,o]of Object.entries(t.intentScores))"number"==typeof o&&Number.isFinite(o)&&(n[e]=o);return{family:t.family,intentScores:Object.keys(n).length?n:void 0}}return e}}(t);if(null==o?void 0:o.act)return o.act;if(null==o?void 0:o.intentScores){const e=function(e){let t,n=0;for(const[o,i]of Object.entries(e))if("number"==typeof i&&i>0)if(i>n)t=o,n=i;else if(i===n&&void 0!==t){const e=wf.indexOf(o),n=wf.indexOf(t);-1===e||-1!==n&&e>=n||(t=o)}return t}(o.intentScores);if(e&&bf[e]&&(null!==(n=o.intentScores[e])&&void 0!==n?n:0)>=3)return bf[e]}return(null==o?void 0:o.family)?xf[o.family]:function(e){return qg.has(e)||"StackedAreaChart"===e?"apportioning":vf.has(e)?"relating":Yg.has(e)?"comparing":Vg.has(e)?"characterizing":Gg.has(e)?"tracking":yf.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}const Cf=new Set(["y-threshold","x-threshold","band","callout","label"]),Of=new Set(["system","agent","watcher"]),_f=new Set(["ai","agent","system","computed","dbt","great-expectations"]),jf=new Set(["rule","statistical-test","llm-inference","computed"]);function Pf(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!Cf.has(t.type))return!1;const n=t.provenance;return!(!n||"object"!=typeof n)&&(Of.has(n.authorKind)||_f.has(n.source)||jf.has(n.basis))})}function Mf(e="en"){let t,n;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch(e){t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?n.format(e):t.format(e):e+""}const Lf={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Tf(e){const t=Lf["string"==typeof e.type?e.type:"annotation"]||"an annotation",n=function(e){var t,n;const o=e.provenance&&"object"==typeof e.provenance?e.provenance:null,i=null!==(n=null!==(t=null==o?void 0:o.authorKind)&&void 0!==t?t:null==o?void 0:o.source)&&void 0!==n?n:null==o?void 0:o.basis;return"watcher"===i?"a watcher-flagged ":"agent"===i||"ai"===i||"llm-inference"===i?"an AI-suggested ":""}(e),o=n?n+t.replace(/^an? /,""):t,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${o} labeled "${i}"`:o}function $f(e,t,n={}){var o,i;const r=void 0!==n.levels,a=new Set(null!==(o=n.levels)&&void 0!==o?o:["l1","l2","l3"]);r||!n.capability&&!Pf(t)||a.add("l4");const s=Mf(null!==(i=n.locale)&&void 0!==i?i:"en"),l=mf(e),c=Array.isArray(t.data)?t.data:null,u=Ug(t),{measure:d,measureFallback:h,dimension:g,dimensionFallback:f}=Xg(e,t),p="string"==typeof d&&d?d:h,y="string"==typeof g&&g?g:f,m={};if(a.has("l1"))if(Gg.has(e)||Yg.has(e))m.l1=`A ${l} of ${p} by ${y}`+(u?`, split by ${u}.`:".");else if(qg.has(e))m.l1=`A ${l} showing ${p} across ${y} categories.`;else if(Vg.has(e))m.l1=`A ${l} of the distribution of ${p}`+(u?` by ${u}.`:".");else if(yf.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,n=Array.isArray(t.edges)?t.edges.length:void 0,o=[null!=e?`${e} ${Df(e,"node")}`:null,null!=n?`${n} ${Df(n,"edge")}`:null].filter(Boolean);m.l1=`A ${l}${o.length?" with "+o.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:p;m.l1=`A single value${e?" for "+e:""}.`}else m.l1=`A ${l}.`;const v=Gg.has(e)||Yg.has(e)||qg.has(e)||Vg.has(e);let b=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&v&&c&&c.length>0&&(b=function(e,t,n,o){let i=0,r=0,a=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,g=null,f=NaN,p=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===i&&(f=e,h=n),p=e,g=n,a>e&&(a=e,l=n,u=i),e>s&&(s=e,c=n,d=i),i++,r+=e)}return 0===i?null:{count:i,min:a,max:s,mean:r/i,minLabel:Kg(null!=l?n(l):null,o),maxLabel:Kg(null!=c?n(c):null,o),first:f,last:p,firstLabel:Kg(null!=h?n(h):null,o),lastLabel:Kg(null!=g?n(g):null,o),minIndex:u,maxIndex:d}}(c,Ue(d,h),Ke(g,f),s)),a.has("l2")&&v&&(c&&0!==c.length?b&&(m.l2=qg.has(e)?`${b.count} segments totaling ${s(function(e){return e.mean*e.count}(b))}. Largest is ${b.maxLabel} at ${s(b.max)}; smallest is ${b.minLabel} at ${s(b.min)}.`:`${p} ranges from ${s(b.min)} (${b.minLabel}) to ${s(b.max)} (${b.maxLabel}), with a mean of ${s(b.mean)} across ${b.count} points.`):m.l2="No data is loaded yet."),a.has("l3")&&b&&Gg.has(e)?m.l3=function(e,t,n){const{first:o,last:i,min:r,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:g}=e,f=a-r,p=i-o;if(0===f)return`${Nf(t)} is constant at ${n(o)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Nf(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`;const y=h>0&&g-1>h,m=d>0&&g-1>d,v=(a-Math.max(o,i))/f,b=(Math.min(o,i)-r)/f;return y&&v>.15?`Overall ${t} climbs to a peak of ${n(a)} (${s}), then falls to ${n(i)} (${u}).`:m&&b>.15?`Overall ${t} drops to a low of ${n(r)} (${l}), then recovers to ${n(i)} (${u}).`:.05>Math.abs(p)/f?`${Nf(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`:p>0?h===g-1?`Overall ${t} rises from ${n(o)} (${c}) to a peak of ${n(i)} (${u}).`:`Overall ${t} rises from ${n(o)} (${c}) to ${n(i)} (${u}), after peaking at ${n(a)} (${s}).`:d===g-1?`Overall ${t} falls from ${n(o)} (${c}) to a low of ${n(i)} (${u}).`:`Overall ${t} falls from ${n(o)} (${c}) to ${n(i)} (${u}), after dipping to ${n(r)} (${l}).`}(b,p,s):a.has("l3")&&b&&Yg.has(e)&&(m.l3=`The highest ${y} is ${b.maxLabel} and the lowest is ${b.minLabel}.`),a.has("l4")){const o=Pf(t)?"alerting":Sf(e,n.capability);o&&(m.l4=function(e,t,n,o,i,r,a,s){const l=kf[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof n.label&&n.label?n.label:i} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${r} and ${i} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,n,o,i,r){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+n;case"comparing":return`compare ${n} across ${o}`;case"ranking":return"read it top to bottom by "+n;case"apportioning":return`read each ${o}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+n;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,n){if(Yg.has(n)||qg.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:o,last:i,min:r,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,g=a-r;if(g>0){const e=d>0&&h-1>d,n=u>0&&h-1>u,f=(a-Math.max(o,i))/g,p=(Math.min(o,i)-r)/g;if(e&&f>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(n&&p>.15)return`the dip to ${t(r)} at ${s} is the point to investigate`;if(i>=a)return`the climb to ${t(i)} at ${c} warrants a closer look`;if(r>=i)return`the drop to ${t(i)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(a)}) and ${s} (${t(r)}) — are the points to check`}(t,i,r);case"tracking":return`read it for the trajectory of ${n}, which ${function(e){const t=e.max-e.min,n=e.last-e.first;return 0===t||.05>Math.abs(n)/t?"holds roughly steady":n>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${n} across ${o}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${n}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,n=e>0?Math.round(t.max/e*100):null;return`read each ${o}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=n?` (${n}%)`:""}`}case"characterizing":return`read it for the spread of ${n}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,o,i,r,a,t)}return`${u}; ${d}.${function(e,t){var n;if(!t)return"";const o=null===(n=t.familiarity)||void 0===n?void 0:n[e];return"number"!=typeof o||o>2?"":` This ${mf(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(o,e,t,b,p,y,s,n.audience))}const x=["l1","l2","l3","l4"].filter(e=>a.has(e)&&m[e]).map(e=>m[e]).join(" "),w=function(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const n=gf(t.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return;const o=n.map(Tf),i=o.slice(0,5),r=o.length-i.length,a=function(e){var t;return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:null!==(t=e[0])&&void 0!==t?t:""}(i)+(r>0?`, and ${r} more`:""),s=n.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}(t);return Object.assign({text:w?`${w} ${x}`.trim():x,levels:m},w?{annotations:w}:{})}function Nf(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Df(e,t){return 1===e?t:t+"s"}function Bf(e,t,n={}){var o,i,r;const a=null!==(o=n.locale)&&void 0!==o?o:"en",s=Math.max(1,null!==(i=n.maxLeaves)&&void 0!==i?i:200),l=Mf(a),c={id:"root",role:"chart",label:$f(e,t,{locale:a}).text||"Chart.",level:1,children:[]},u=function(e,t){const n=Array.isArray(e.annotations)?e.annotations:null;if(!n)return null;const o=gf(n.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return null;let i=0;const r=o.slice(0,t).map(e=>{var t;const n=null===(t=e.lifecycle)||void 0===t?void 0:t.status,o=n&&"accepted"!==n?` (${n})`:"";return{id:"annotation-"+i++,role:"annotation",level:3,label:`${r=Tf(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${o}.`,datum:e};var r});o.length>t&&r.push({id:"annotation-"+i++,role:"annotation",level:3,label:`…and ${o.length-t} more annotations.`});const a=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:r}}(t,s),d=Array.isArray(t.data)?t.data:null,h=Gg.has(e)||Yg.has(e)||qg.has(e)||Vg.has(e);if(!d||0===d.length||!h)return u&&(c.children=[u]),c;const{measure:g,measureFallback:f,dimension:p,dimensionFallback:y}=Xg(e,t),m=Ue(g,f),v=Ke(p,y),b="string"==typeof g&&g?g:f,x="string"==typeof p&&p?p:y,w=Ug(t);let k=0;const A=e=>`${e}-${k++}`,S=(e,t)=>{const n=e.slice(0,s).map(e=>((e,t)=>{const n=m(e),o=Kg(v(e),l);return{id:A("datum"),role:"datum",level:t,label:`${o}: ${Number.isFinite(n)?l(n):"—"}`,value:Number.isFinite(n)?n:void 0,datum:e}})(e,t));return e.length>s&&n.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),n},C=[];if(Gg.has(e)||Yg.has(e)){let t=1/0,n=-1/0,o=1/0,i=-1/0;const r=[];let a=!0;for(const e of d){const s=m(e);Number.isFinite(s)&&(t>s&&(t=s),s>n&&(n=s));const l=v(e);r.push(l),"number"==typeof l&&Number.isFinite(l)?(o>l&&(o=l),l>i&&(i=l)):a=!1}const s=new Set,c=[];for(const e of r){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=a?`${l(o)} to ${l(i)}`:`${Kg(c[0],l)} to ${Kg(c[c.length-1],l)} (${Yg.has(e)?c.length+" categories":d.length+" points"})`;C.push({id:A("axis"),role:"axis",level:2,label:`${Yg.has(e)?"Category axis":"X axis"}: ${x}, ${u}.`}),t>n||C.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${b}, ${l(t)} to ${l(n)}.`})}if(w){const n=Ke(w,w),o=new Map;for(const e of d){const t=(null!==(r=n(e))&&void 0!==r?r:"—")+"",i=o.get(t);i?i.push(e):o.set(t,[e])}const i=[];for(const[n,r]of o){const o=$f(e,Object.assign(Object.assign({},t),{data:r}),{levels:["l2","l3"],locale:a}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${n}: ${o}`,children:S(r,3)})}c.children=[...C,...i]}else c.children=[...C,...S(d,2)];return u&&c.children.push(u),c}function If(e,t){const n=[],o=e=>{if(n.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)o(t)};return o(e),n}function Rf(e){let t=1;if(e.children)for(const n of e.children)t+=Rf(n);return t}let Ff=null;const Ef=new Set,Hf=new Set,zf=1e3;function Wf(e,t,n){const o=null!=e?e:t;if(!Number.isFinite(o)||0>=o)throw new RangeError(`${n} must be a positive number, got ${o+""}`);return Math.floor(o)}function Gf(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function Yf(e,t){try{const n=t();n&&"function"==typeof n.then&&Promise.resolve(n).catch(t=>Gf(e,t))}catch(t){Gf(e,t)}}function qf(e){if(e)return e;try{const e=globalThis.localStorage;return null!=e?e:null}catch(e){return null}}function Vf(e,t){if(!e)return[];try{return function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return Gf("localStorage load",e),[]}}(e.getItem(t))}catch(e){return Gf("localStorage read",e),[]}}const Xf=Object.freeze([]);let Uf=Xf,Kf=!1;function Qf(){return Kf?(Uf=Ff?Object.freeze(Ff.buffer.slice()):Xf,Kf=!1,Uf):Uf}function Zf(){Kf=!0}const Jf=new Set;function ep(){for(const e of Jf)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function tp(e){return Jf.add(e),()=>{Jf.delete(e)}}function np(e){if(!e||"object"!=typeof e)throw new TypeError("registerConversationArcSink: sink must be an object");return Hf.add(e),()=>{Hf.delete(e)}}function op(e={}){var t;const n=null!==(t=e.key)&&void 0!==t?t:"semiotic:conversation-arc",o=Wf(e.maxEvents,zf,"createLocalStorageConversationArcSink: maxEvents");return{record(t){const i=qf(e.storage),r=Vf(i,n);r.push(t),function(e,t,n,o){if(e)try{e.setItem(t,JSON.stringify(n.slice(-o)))}catch(e){Gf("localStorage write",e)}}(i,n,r,o)},clear(){const t=qf(e.storage);if(t)try{t.removeItem(n)}catch(e){Gf("localStorage clear",e)}},load:()=>Vf(qf(e.storage),n)}}function ip(e={}){var t,n;const o=null!==(t=e.dbName)&&void 0!==t?t:"semiotic-conversation-arc",i=null!==(n=e.storeName)&&void 0!==n?n:"events",r=Wf(e.maxEvents,zf,"createIndexedDBConversationArcSink: maxEvents");let a=null;const s=()=>(null!=a||(a=function(e,t,n){const o=function(e){var t;if(e)return e;try{return null!==(t=globalThis.indexedDB)&&void 0!==t?t:null}catch(e){return null}}(n);return o?new Promise(n=>{let i;try{i=o.open(e,1)}catch(e){return Gf("IndexedDB open",e),void n(null)}i.onupgradeneeded=()=>{const e=i.result;e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:"id",autoIncrement:!0})},i.onsuccess=()=>n(i.result),i.onerror=()=>{Gf("IndexedDB open",i.error),n(null)},i.onblocked=()=>{Gf("IndexedDB open",Error("upgrade blocked")),n(null)}}):Promise.resolve(null)}(o,i,e.indexedDB)),a);return{record(e){return Js(this,void 0,void 0,function*(){const t=yield s();t&&(yield new Promise(n=>{try{const o=t.transaction(i,"readwrite");o.objectStore(i).add({event:e}),o.oncomplete=()=>n(),o.onerror=()=>{Gf("IndexedDB record",o.error),n()}}catch(e){Gf("IndexedDB record",e),n()}}),yield function(e,t,n){return e?new Promise(o=>{try{const i=e.transaction(t,"readwrite"),r=i.objectStore(t),a=r.getAll();a.onsuccess=()=>{const e=Array.isArray(a.result)?a.result:[],t=e.length-n;if(t>0)for(const n of e.slice(0,t))null!=n.id&&r.delete(n.id)},a.onerror=()=>Gf("IndexedDB trim",a.error),i.oncomplete=()=>o(),i.onerror=()=>{Gf("IndexedDB trim",i.error),o()}}catch(e){Gf("IndexedDB trim",e),o()}}):Promise.resolve()}(t,i,r))})},clear(){return Js(this,void 0,void 0,function*(){const e=yield s();e&&(yield new Promise(t=>{try{const n=e.transaction(i,"readwrite");n.objectStore(i).clear(),n.oncomplete=()=>t(),n.onerror=()=>{Gf("IndexedDB clear",n.error),t()}}catch(e){Gf("IndexedDB clear",e),t()}}))})},load(){return Js(this,void 0,void 0,function*(){return function(e,t){return e?new Promise(n=>{try{const o=e.transaction(t,"readonly").objectStore(t).getAll();o.onsuccess=()=>{n((Array.isArray(o.result)?o.result:[]).map(e=>e.event).filter(Boolean))},o.onerror=()=>{Gf("IndexedDB load",o.error),n([])}}catch(e){Gf("IndexedDB load",e),n([])}}):Promise.resolve([])}(yield s(),i)})}}}function rp(e){var t;if(!e.url)throw new TypeError("createWebhookConversationArcSink: url is required");const n=null!==(t=e.method)&&void 0!==t?t:"POST";return{record(t){var o;const i=null!==(o=e.fetch)&&void 0!==o?o:globalThis.fetch;if(!i)return;const r=e.mapEvent?e.mapEvent(t):t;return i(e.url,{method:n,headers:Object.assign({"Content-Type":"application/json"},e.headers),body:JSON.stringify(r)}).then(()=>{})}}}function ap(e,t={}){var n,o,i,r,a,s,l;const c=Array.isArray(e)?e.slice():[],u=Wf(t.capacity,Math.max(null!==(n=null==Ff?void 0:Ff.capacity)&&void 0!==n?n:zf,c.length,1),"loadConversationArc: capacity"),d=null!==(a=null!==(r=null!==(o=t.sessionId)&&void 0!==o?o:null===(i=c[0])||void 0===i?void 0:i.sessionId)&&void 0!==r?r:null==Ff?void 0:Ff.sessionId)&&void 0!==a?a:up();for(Ff?(Ff.enabled=null!==(l=t.enabled)&&void 0!==l&&l,Ff.sessionId=d,Ff.capacity=u):Ff={enabled:null!==(s=t.enabled)&&void 0!==s&&s,sessionId:d,capacity:u,buffer:[]},t.append||(Ff.buffer=[]),Ff.buffer.push(...c);Ff.buffer.length>Ff.capacity;)Ff.buffer.shift();return Zf(),ep(),Qf()}function sp(e,t={}){return ap(e,t)}function lp(e,t,n){return pp.record(Object.assign({type:"audience-set",audience:e,previous:null!=t?t:void 0},n))}function cp(e,t){return pp.record({type:"annotation-status-changed",toStatus:e,annotationId:null==t?void 0:t.annotationId,fromStatus:null==t?void 0:t.fromStatus,chartId:null==t?void 0:t.chartId,arcId:null==t?void 0:t.arcId,meta:null==t?void 0:t.meta})}function up(){return`arc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function dp(){return Ff}function hp(e={}){var t,n;const o=null!==(t=e.capacity)&&void 0!==t?t:1e3;if(!Number.isFinite(o)||0>=o)throw new RangeError("enableConversationArc: capacity must be a positive number, got "+o);if(Ff){if(Ff.enabled=!0,e.sessionId&&(Ff.sessionId=e.sessionId),null!=e.capacity){for(Ff.capacity=o;Ff.buffer.length>Ff.capacity;)Ff.buffer.shift();Zf()}}else Ff={enabled:!0,sessionId:null!==(n=e.sessionId)&&void 0!==n?n:up(),capacity:o,buffer:[]},Zf();return ep(),pp}function gp(){Ff&&(Ff.enabled=!1,ep())}function fp(){return pp}const pp={get enabled(){var e;return null!==(e=null==Ff?void 0:Ff.enabled)&&void 0!==e&&e},get sessionId(){var e;return null!==(e=null==Ff?void 0:Ff.sessionId)&&void 0!==e?e:null},get capacity(){var e;return null!==(e=null==Ff?void 0:Ff.capacity)&&void 0!==e?e:0},record(e){var t,n;const o=dp();if(!o||!o.enabled)return null;const i=Object.assign(Object.assign({},e),{timestamp:null!==(t=e.timestamp)&&void 0!==t?t:Date.now(),sessionId:null!==(n=e.sessionId)&&void 0!==n?n:o.sessionId});for(o.buffer.push(i);o.buffer.length>o.capacity;)o.buffer.shift();Zf(),ep();for(const e of Ef)try{e(i)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of Hf)t.record&&Yf("sink record",()=>{var n;return null===(n=t.record)||void 0===n?void 0:n.call(t,e)})}(i),i},flush(){const e=dp();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],Zf(),ep(),function(e){for(const t of Hf)t.flush&&Yf("sink flush",()=>{var n;return null===(n=t.flush)||void 0===n?void 0:n.call(t,e)})}(t),t},getEvents:()=>Qf(),subscribe:e=>(Ef.add(e),()=>{Ef.delete(e)}),clear(){const e=dp();e&&(e.buffer=[],Zf(),ep()),function(){for(const e of Hf)e.clear&&Yf("sink clear",()=>{var t;return null===(t=e.clear)||void 0===t?void 0:t.call(e)})}()},reset(){if(Ef.clear(),Hf.clear(),Uf=Xf,Kf=!1,!Ff)return ep(),void Jf.clear();Ff.buffer=[],Ff.enabled=!1,Ff=null,ep(),Jf.clear()}},yp={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function mp({tree:n,label:i,visible:r=!1,className:a,onActiveChange:s,activeId:l,chartId:c}){const[u,d]=o.useState(()=>new Set([n.id])),[h,g]=o.useState(n.id),f=void 0!==l,p=f?l:h,y=o.useRef(null),m=o.useRef(new Map),v=o.useMemo(()=>function(e){const t=new Map,n=e=>{var o;for(const i of null!==(o=e.children)&&void 0!==o?o:[])t.set(i.id,e),n(i)};return n(e),t}(n),[n]),b=o.useMemo(()=>If(n,u),[n,u]);o.useEffect(()=>{f||b.some(e=>e.id===h)||g(n.id)},[b,h,n.id,f]),o.useEffect(()=>{const e=[];let t=v.get(p);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&d(t=>{if(e.every(e=>t.has(e)))return t;const n=new Set(t);for(const t of e)n.add(t);return n})},[p,v]),o.useEffect(()=>{var e,t;(null===(e=y.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=m.current.get(p))||void 0===t||t.focus())},[p]);const x=o.useCallback((e,t,n)=>{const o=fp();o.enabled&&o.record("focus"===t?{type:"nav-node-focused",chartId:c,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:c,nodeId:e.id,role:e.role,level:e.level,expanded:!!n})},[c]),w=o.useCallback(e=>{e.id!==p&&(f||g(e.id),null==s||s(e),x(e,"focus"))},[s,f,x,p]),k=e=>{d(t=>new Set(t).add(e.id)),x(e,"toggle",!0)},A=e=>{d(t=>{const n=new Set(t);return n.delete(e.id),n}),x(e,"toggle",!1)},S=(n,o,i)=>{const a=!!n.children&&n.children.length>0,s=u.has(n.id);return t("li",{role:"treeitem","aria-label":n.label,"aria-level":n.level,"aria-posinset":o,"aria-setsize":i,"aria-expanded":a?s:void 0,"aria-selected":n.id===p,tabIndex:n.id===p?0:-1,ref:e=>{m.current.set(n.id,e)},onClick:e=>{e.stopPropagation(),w(n),a&&(s?A:k)(n)},style:r?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(n.level-1),cursor:a?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:n.id===p?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[t("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+n.role,children:[r&&a?s?"▾ ":"▸ ":"",n.label]}),a&&s&&e("ul",{role:"group",style:r?{margin:0,padding:0}:void 0,children:n.children.map((e,t)=>S(e,t+1,n.children.length))})]},n.id)};return e("div",{ref:y,className:"semiotic-nav-tree"+(a?" "+a:""),style:r?void 0:yp,onKeyDown:e=>{const t=b.findIndex(e=>e.id===p);if(-1===t)return;const n=b[t],o=!!n.children&&n.children.length>0,i=u.has(n.id);let r=!0;switch(e.key){case"ArrowDown":w(b[Math.min(t+1,b.length-1)]);break;case"ArrowUp":w(b[Math.max(t-1,0)]);break;case"Home":w(b[0]);break;case"End":w(b[b.length-1]);break;case"ArrowRight":o&&!i?k(n):o&&i?w(n.children[0]):r=!1;break;case"ArrowLeft":if(o&&i)A(n);else{const e=v.get(n.id);e?w(e):r=!1}break;case"Enter":case" ":o?(i?A:k)(n):r=!1;break;default:r=!1}r&&(e.preventDefault(),e.stopPropagation())},children:e("ul",{role:"tree","aria-label":i||"Chart navigation",style:r?{margin:0,padding:0}:void 0,children:S(n,1,1)})})}const vp={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function bp(){const n=function(){const e=o.useContext(qi);return e?e.toggle:null}();return n?e("button",{className:"semiotic-chart-action",onClick:n,title:"Data summary","aria-label":"Toggle data summary",style:Sp,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const xp={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function wp({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function kp({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const Ap=o.forwardRef(function({title:i,subtitle:r,children:a,width:s="100%",height:l=400,actions:c,chartConfig:u,describe:d,navigable:h,controls:g,loading:f=!1,error:p,errorBoundary:y=!1,status:m,detailsPanel:v,className:b,style:x},w){var k;const A=o.useRef(null),S=o.useRef(null),[C,O]=o.useState(!1),_=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),j=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),P=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,M=!0===(null==c?void 0:c.dataSummary),L=o.useMemo(()=>{if(!d||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return"";const e="object"==typeof d?d.levels:void 0;try{return $f(u.component,u.props,e?{levels:e}:{}).text}catch(e){return""}},[d,u]),T="object"==typeof d&&!0===d.visible,$=o.useMemo(()=>{if(!h||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return null;const e="object"==typeof h?h.maxLeaves:void 0;try{return Bf(u.component,u.props,e?{maxLeaves:e}:{})}catch(e){return null}},[h,u]),N="object"==typeof h&&!0===h.visible,D=o.useMemo(()=>"object"==typeof(null==c?void 0:c.export)?c.export:{},[null==c?void 0:c.export]),B="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",I=o.useCallback(e=>Js(this,void 0,void 0,function*(){S.current&&(yield Sg(S.current,Object.assign(Object.assign({},D),e)))}),[D]),R=o.useCallback(()=>{A.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):A.current.requestFullscreen().catch(()=>{}))},[]),F=o.useCallback(e=>Js(this,void 0,void 0,function*(){var t,n;u&&(yield zg(Object.assign(Object.assign({},u),{version:null!==(t=u.version)&&void 0!==t?t:"1",createdAt:null!==(n=u.createdAt)&&void 0!==n?n:(new Date).toISOString()}),e||B||"json"))}),[u,B]);o.useEffect(()=>{const e=()=>{O(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),o.useImperativeHandle(w,()=>({export:I,toggleFullscreen:R,copyConfig:F,element:A.current}),[I,R,F]);const E=i||r||g||_||j||P||M||m,H=f?e(wp,{height:l}):p?e(kp,{error:p}):y?e(Ls,{children:a}):a;return z=t(n,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:A,className:"semiotic-chart-container"+(b?" "+b:""),style:Object.assign(Object.assign({width:s,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},C?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),x),children:[E&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[g,_&&e("button",{className:"semiotic-chart-action",onClick:()=>I(),title:"Export chart","aria-label":"Export chart",style:Sp,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),M&&e(bp,{}),j&&e("button",{className:"semiotic-chart-action",onClick:R,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:Sp,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(n,C?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),P&&e("button",{className:"semiotic-chart-action",onClick:()=>F(),title:"Copy config","aria-label":"Copy chart configuration",style:Sp,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),m&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:xp[m].bg,color:xp[m].color,lineHeight:"18px"},children:m})]})]}),L&&e("div",{className:"semiotic-chart-description",role:"note",style:T?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:vp,children:L}),$&&e("div",{className:"semiotic-chart-nav",style:N?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:e(mp,{tree:$,label:"string"==typeof i&&i?i+" — navigable structure":"Chart navigable structure",visible:N,chartId:"string"==typeof(null===(k=null==u?void 0:u.props)||void 0===k?void 0:k.chartId)?u.props.chartId:void 0})}),t("div",{className:"semiotic-chart-body",ref:S,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},C?{flex:1}:{height:l}),children:[H,v]})]})]}),M?e(Vi,{children:z}):z;var z}),Sp={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Cp({children:t,columns:n="auto",minCellWidth:i=300,gap:r=16,className:a,style:s}){const l="number"==typeof n?n:void 0;return e("div",{className:"semiotic-chart-grid"+(a?" "+a:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},s),children:o.Children.map(t,t=>o.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function Op({children:n,context:o,position:i="right",contextSize:r=250,gap:a=12,className:s,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:a,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:n}),e("div",{style:h,children:o})]})}Cp.displayName="ChartGrid",Op.displayName="ContextLayout";function _p({children:n,position:o="right",size:r=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[m,v]=d(null),[b,x]=d(null),[w,k]=d(!1),[A,S]=d(!1),C=i(null),O=i(void 0),_="click"===s?["click","click-end"]:["hover","hover-end"],{latest:j}=Ea({types:_,chartId:c,limit:1}),P=void 0!==u?u:j,M=l(()=>{S(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{S(!1),v(null),x(null)},200)},[]);if(a(()=>{if(P)if("click"===P.type||"hover"===P.type){const e=P;v(e.datum),x(e),k(e=>(e||(S(!0),clearTimeout(O.current),O.current=setTimeout(()=>S(!1),200)),!0))}else!h||"click-end"!==P.type&&"hover-end"!==P.type||M()},[h,M,P]),a(()=>{null==f||f(w)},[w,f]),a(()=>()=>clearTimeout(O.current),[]),!m&&!A)return null;const L=m&&b?n(m,b):null;if(null===L&&!A)return null;const T=function(e,t,n,o){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(o,r,w,A);return t("div",{ref:C,className:`semiotic-details-panel semiotic-details-${o}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:M,"aria-label":"Close details",style:jp,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const jp={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};_p.displayName="DetailsPanel";const Pp=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Mp=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Lp=new Set(["category10","tableau10","set3","blues","reds","greens","oranges","purples","greys","viridis","plasma","inferno","magma","cividis","turbo"]),Tp=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),$p=new Set(["LineChart","AreaChart","StackedAreaChart"]),Np=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Dp(e){let t=e.replace(/^#/,"");/^[a-f\d]{3}$/i.test(t)&&(t=t.split("").map(e=>e+e).join(""));const n=t.match(/^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!n)return null;const[o,i,r]=[parseInt(n[1],16)/255,parseInt(n[2],16)/255,parseInt(n[3],16)/255],a=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*a(o)+.7152*a(i)+.0722*a(r)}function Bp(e,t){const n=Dp(e),o=Dp(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Ip=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"],Rp=["xExtent","yExtent","rExtent"],Fp=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ep={PieChart:"valueAccessor",DonutChart:"valueAccessor",FunnelChart:"valueAccessor"},Hp={StackedBarChart:"valueAccessor",StackedAreaChart:"yAccessor"},zp=new Set(["LineChart","AreaChart","StackedAreaChart","ConnectedScatterplot"]),Wp=new Set(["PieChart","DonutChart"]);function Gp(e,t){const n=[],o=Ng(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Tg[e]?(function(e,t,n){const o=Tg[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Tg[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const a=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Pp.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Mp.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Tg[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const a=t.xAccessor;"string"==typeof a&&r[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Tp.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!$p.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(i=t.height)&&void 0!==i?i:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=Tg[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(r.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Np.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Bp(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=Bp(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){var o,i;const r=t.colorScheme;if("string"!=typeof r)return;const a=Tg[e];(null===(i=null===(o=null==a?void 0:a.props)||void 0===o?void 0:o.colorScheme)||void 0===i?void 0:i.enum)||Lp.has(r)||n.push({severity:"warning",code:"UNKNOWN_COLOR_SCHEME",message:`colorScheme "${r}" is not a recognized named scheme — the chart will fall back to the default palette.`,fix:`Use a known scheme name (${[...Lp].join(", ")}) or pass an explicit color array, e.g. colorScheme={["#1f77b4", "#ff7f0e"]}.`})}(e,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:"No title, description, or summary provided. Screen readers will fall back to a generic chart-type label.",fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Ip)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),function(e,t,n){const o=Array.isArray(t.annotations)?t.annotations:null;if(o)for(const e of o){if(!e||"object"!=typeof e)continue;const t=Eo(e);if(!Ho(e)||"widget"===t)continue;const o=Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0),i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:t,r=zo(e);!r&&o>120?n.push({severity:"warning",code:"ANNOTATION_FAR_NO_CONNECTOR",message:`Annotation "${i}" sits ~${Math.round(o)}px from its anchor with no connector — a reader can't tell what it refers to.`,fix:'Add a connector (connector: { end: "arrow" }, the label/callout default) or place the note adjacent to its target (smaller dx/dy).'}):r&&o>250&&n.push({severity:"warning",code:"ANNOTATION_LONG_CONNECTOR",message:`Annotation "${i}" uses a very long connector (~${Math.round(o)}px); prefer placing the note adjacent to its target when space allows.`,fix:"Reduce dx/dy so the note sits near its target, or keep the long connector only if proximity is genuinely infeasible."})}}(0,t,n),function(e,t,n){const o=Array.isArray(t.annotations)?t.annotations:null;if(!o)return;const i=o.filter(Ho).length;if(0===i)return;const r="number"==typeof t.width?t.width:600,a="number"==typeof t.height?t.height:400,s=Go(r,a);Number.isFinite(s)&&i>s&&n.push({severity:"warning",code:"ANNOTATION_DENSITY",message:`${i} note annotations on a ${r}×${a} chart exceed the ~${s} notes the plot area carries comfortably — the chart may read as cluttered.`,fix:'Mark the essential notes emphasis: "primary" and let density management shed the rest (autoPlaceAnnotations: { density: true }), enable progressive disclosure to reveal secondary notes on hover, or give the chart more room.'})}(0,t,n),function(e,t,n){for(const e of Rp){const o=t[e];if(!Array.isArray(o)||2>o.length)continue;const[i,r]=o;"number"==typeof i&&"number"==typeof r&&i>r&&n.push({severity:"warning",code:"INVERTED_AXIS",message:`${e}=[${i}, ${r}] is descending — the axis renders inverted, so "up" reads as less. Inverted axes are a classic misleading-design pattern unless the inversion is the point.`,fix:`Order the extent ascending (${e}={[${r}, ${i}]}). If the inversion is deliberate (e.g. rank #1 at top), say so in the title or an annotation so readers aren't misled.`})}}(0,t,n),function(e,t,n){if("MultiAxisLineChart"!==e)return;const o=t.series;if(!Array.isArray(o)||2!==o.length)return;const i=o.filter(e=>!e||"object"!=typeof e||"string"!=typeof e.label||0===e.label.trim().length);i.length>0&&n.push({severity:"warning",code:"DUAL_AXIS_UNLABELED",message:`Dual-axis chart with ${i.length} unlabeled series. Two y-scales invite false equivalence between the lines; without per-series labels a reader can't tell which scale is whose.`,fix:'Give every series a label: series={[{ yAccessor: "a", label: "Revenue ($)" }, { yAccessor: "b", label: "Users" }]} — and consider whether two separate charts read more honestly.'})}(e,t,n),function(e,t,n){var o;if(!Fp.has(e))return;const i=t.xExtent;if(!Array.isArray(i)||2>i.length)return;const[r,a]=i;if("number"!=typeof r||"number"!=typeof a||r>=a)return;const s=t.data;if(!s||!Array.isArray(s)||4>s.length)return;const l=null!==(o=t.xAccessor)&&void 0!==o?o:"x";if("string"!=typeof l)return;let c=1/0,u=-1/0;for(const e of s){const t=null==e?void 0:e[l];"number"==typeof t&&Number.isFinite(t)&&(c>t&&(c=t),t>u&&(u=t))}if(!Number.isFinite(c)||!Number.isFinite(u)||c>=u)return;const d=u-c,h=Math.max(0,Math.min(a,u)-Math.max(r,c))/d;.7>h&&n.push({severity:"warning",code:"CHERRY_PICKED_WINDOW",message:`xExtent=[${r}, ${a}] shows only ~${Math.round(100*h)}% of the data's x range [${c}, ${u}] — a trend cropped to a favorable window is a classic misleading-design pattern.`,fix:'Widen xExtent to cover the data, filter the data itself so the chart shows what it has, or annotate the visible window ("Q4 only") so the cropping is explicit.'})}(e,t,n),function(e,t,n){const o=Ep[e],i=Hp[e];if(!o&&!i)return;if(i&&!t.normalize)return;const r=null!=o?o:i,a=t[r],s="string"==typeof a?a:"yAccessor"===r?"y":"value",l=t.data;if(!l||!Array.isArray(l)||0===l.length)return;const c=l.filter(e=>{const t=null==e?void 0:e[s];return"number"==typeof t&&0>t});c.length>0&&n.push({severity:o?"error":"warning",code:"PART_TO_WHOLE_NEGATIVE",message:`${c.length} negative value(s) in "${s}" — a part-to-whole encoding cannot represent negative parts${o?"; slice angles/areas for negatives are meaningless":"; normalized shares distort when parts are negative"}.`,fix:o?"Filter or transform negative values first, or switch to a BarChart/WaterfallChart, which encode signed values honestly.":"Drop normalize for signed data, or use a diverging BarChart so negative contributions read as negative."})}(e,t,n),function(e,t,n){zp.has(e)&&"basis"===t.curve&&n.push({severity:"warning",code:"NON_PASSING_CURVE",message:'curve="basis" draws a B-spline that does NOT pass through your data points — rendered values differ from actual values everywhere except the endpoints.',fix:'Use curve="monotoneX" or curve="catmullRom" (both interpolate through every point), or keep "basis" only for deliberately schematic, clearly-labeled smoothing.'})}(e,t,n),function(e,t,n){if("LineChart"!==e&&"AreaChart"!==e)return;if("sparkline"===t.mode)return;if(t.responsiveWidth||t.responsiveHeight)return;const o="number"==typeof t.width?t.width:600,i="number"==typeof t.height?t.height:400;if(0>=o||0>=i)return;const r=o/i;if(r>8||.25>r){const e=r>8?"flattens":"exaggerates";n.push({severity:"warning",code:"EXTREME_ASPECT_RATIO",message:`${o}×${i} (${r.toFixed(1)}:1) is an extreme aspect ratio that ${e} the slopes a reader perceives — aspect-ratio distortion is a documented misleading-design pattern.`,fix:r>8?'Use a more balanced aspect (e.g. width/height between 1 and 3), or set mode="sparkline" if this is genuinely a sparkline strip.':"Use a more balanced aspect (e.g. width/height between 1 and 3); very tall trend charts overstate every change."})}}(e,t,n),function(e,t,n){if(!Wp.has(e))return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.categoryAccessor,r="string"==typeof i?i:"category",a=new Set;for(const e of o){const t=null==e?void 0:e[r];null!=t&&a.add(t)}a.size>8&&n.push({severity:"warning",code:"PIE_TOO_MANY_SLICES",message:a.size+" slices — angle judgments degrade rapidly past ~8 categories (Cleveland & McGill), and thin slices become unreadable and unlabelable.",fix:`Use a BarChart or DotPlot for ${a.size} categories, or group the long tail into an "Other" slice before charting.`})}(e,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}const Yp=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),qp=new Set(["PieChart","DonutChart","FunnelChart"]),Vp=new Set(["BigNumber"]),Xp=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart"]),Up=new Set(["OrbitDiagram"]),Kp=new Set(["RealtimeLineChart","RealtimeHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","ProcessSankey"]),Qp=new Set(["MultiAxisLineChart"]),Zp=new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),Jp={Scatterplot:"pointRadius",BubbleChart:"pointRadius",ConnectedScatterplot:"pointRadius",QuadrantChart:"pointRadius",SwarmPlot:"pointRadius",DotPlot:"dotRadius"},ey=new Set(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#f0e442","#000000"]);function ty(e){return"string"==typeof e&&e.trim().length>0}function ny(e){return"primary"===(null==e?void 0:e.emphasis)||"secondary"===(null==e?void 0:e.emphasis)||null!=function(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?n:null}(e)}function oy(e){const t=e.toLowerCase().replace(/[^a-z]/g,"");if(!t)return 0;if(3>=t.length)return 1;const n=t.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"").replace(/^y/,"").match(/[aeiouy]{1,2}/g);return n?n.length:1}function iy(e,t,n={}){const o=[],i=!!Tg[e],r=!0===n.inChartContainer,a=!0===n.describe,s=!0===n.navigable,l=Vp.has(e),c=Yp.has(e),u=!1!==t.accessibleTable&&!l,d=ty(t.title),h=ty(t.description),g=ty(t.summary),f=d||h||g,p=function(e){return!1!==e.tooltip||null!=e.onClick||null!=e.brush||null!=e.onBrush||null!=e.selection||null!=e.linkedHover||null!=e.linkedBrush}(t),y=Array.isArray(t.annotations)?t.annotations.filter(e=>!!e&&"object"==typeof e):[],m=i?"pass":"manual",v=i?"":` (unrecognized component "${e}" — verify manually that the built-in applies)`;if(o.push(function(e){const t={id:"perceivable.low-contrast",principle:"perceivable",heuristic:"Low contrast",critical:!0},n=e.colorScheme,o="string"==typeof e.background?e.background:null;if(o&&!o.startsWith("#"))return Object.assign(Object.assign({},t),{status:"manual",message:`Background "${o}" isn't a hex literal (theme/CSS variable) — contrast can't be verified statically.`,fix:'Pass a hex `background` (e.g. "#ffffff"/"#000000"), or verify contrast manually once the theme resolves.'});const i=null!=o?o:"#ffffff";if(!Array.isArray(n))return Object.assign(Object.assign({},t),{status:"manual",message:"Mark colors come from the theme/CSS variables — contrast can't be verified statically.",fix:"Confirm geometries/large text have ≥ 3:1 and regular text ≥ 4.5:1 contrast against the background."});const r=[];let a=0;for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Bp(e,i);null!=t&&(a++,3>t&&r.push(`${e} (${t.toFixed(1)}:1)`))}return Object.assign(Object.assign({},t),0===a?{status:"manual",message:"colorScheme has no parseable hex colors to check.",fix:"Verify contrast manually for non-hex colors."}:r.length>0?{status:"fail",message:`${r.length} color(s) fall below 3:1 contrast vs ${i}: ${r.join(", ")}.`,fix:"Darken (light background) or lighten (dark background) those colors, or use COLOR_BLIND_SAFE_CATEGORICAL."}:{status:"pass",message:`All ${a} checked colorScheme color(s) meet ≥ 3:1 contrast vs ${i}.`})}(t)),o.push(Object.assign({id:"perceivable.content-only-visual",principle:"perceivable",heuristic:"Content is only visual",critical:!0},l?{status:"pass",message:"BigNumber renders its value as real text with an ARIA label — available without vision."}:u?{status:"pass",message:"A screen-reader data table + live region expose the data non-visually (accessibleTable is on)."}:h&&g?{status:"manual",message:"accessibleTable is off; a description + summary are present. Verify they convey everything the chart shows.",fix:"Re-enable accessibleTable, or confirm via screen reader that the text alternative is complete."}:{status:"fail",message:"accessibleTable is disabled and there's no full text alternative — the data is only available visually.",fix:"Remove accessibleTable={false}, or provide a complete description/summary plus a data table."})),o.push({id:"perceivable.small-text",principle:"perceivable",heuristic:"Small text size",critical:!0,status:"pass",message:"Semiotic's default tick and axis-label fonts are 12px, meeting Chartability's 9pt/12px floor.",fix:"If a theme or override lowers --semiotic-tick-font-size below 12px, raise it back for low-vision audiences."}),o.push(Object.assign({id:"perceivable.seizure-risk",principle:"perceivable",heuristic:"Visual presents seizure risk",critical:!0},null!=t.pulse||Up.has(e)?{status:"manual",message:"Pulse/continuous animation is in use. Confirm nothing flashes more than 3×/sec, especially saturated red.",fix:"Avoid red flashes and rapid (>3 Hz) flicker; reduced-motion is auto-honored, but verify the default presentation."}:{status:"manual",message:"No flashing detected statically. Confirm no element flashes more than 3×/sec.",fix:"Manual check — most static charts pass trivially."})),null!=t.colorBy){o.push(Object.assign({id:"perceivable.color-alone",principle:"perceivable",heuristic:"Color is used alone to communicate meaning",critical:!1},!0===t.directLabel||!0===t.showLabels?{status:"pass",message:"Categories are encoded by color (colorBy) and also directly labeled, so color isn't the only channel."}:{status:"warn",message:"Categories are encoded by color (colorBy) with no redundant channel — Semiotic does not yet ship texture/pattern fills.",fix:"Add direct labels (directLabel on LineChart/AreaChart, showLabels on network/hierarchy), keep categories ≤ ~7, and use a CVD-safe palette."}));const e=Array.isArray(t.colorScheme)?t.colorScheme:null,n=e?e.filter(e=>"string"==typeof e&&e.startsWith("#")).map(e=>e.toLowerCase()):[],i=n.length>0&&n.every(e=>ey.has(e));o.push(Object.assign({id:"perceivable.cvd-safe",principle:"perceivable",heuristic:"Not CVD-friendly",critical:!1},i?{status:"pass",message:"colorScheme uses Semiotic's Wong colorblind-safe palette."}:{status:"manual",message:"Color encodes meaning; statically we can't confirm the palette is colorblind-safe.",fix:'Use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic", or test your scheme with Viz Palette / Chroma.'})),o.push({id:"flexible.textures-adjustable",principle:"flexible",heuristic:"Contrast and textures cannot be adjusted",critical:!1,status:"warn",message:"There's no per-category texture/pattern channel to toggle as an alternative to color.",fix:"Until texture fills land, ensure the encoding survives color removal: direct labels + a CVD-safe palette. Contrast itself is themeable via CSS variables."})}{const e=y.filter(Ho);if(e.length>0){const n=t.autoPlaceAnnotations,i="object"==typeof n&&null!==n&&!0===n.redundantCues,r=e.filter(e=>{if("string"!=typeof e.color)return!1;const t=Eo(e),n=i&&"text"===t;return!(zo(e)||n)});o.push(Object.assign({id:"perceivable.annotation-association",principle:"perceivable",heuristic:"Color is used alone to communicate meaning",critical:!1},0===r.length?{status:"pass",message:"No annotation relies on color alone to indicate its target — wherever color is used, a connector, enclosure, or reference-line cue is present too."}:{status:"warn",message:`${r.length} of ${e.length} annotation(s) carry a color but no connector, enclosure, or reference-line cue, so a color-blind or non-visual reader can't tie them to their target (the correspondence problem).`,fix:"Add a connector (the label/callout default), place the note adjacent to its target, enclose the target, or enable autoPlaceAnnotations: { redundantCues: true } to give colored text notes a leader line — don't rely on color matching alone."}))}}o.push(Object.assign({id:"operable.single-input-modality",principle:"operable",heuristic:"Interaction modality only has one input type",critical:!0},i?{status:"pass",message:"Built-in keyboard navigation (arrows/Home/End/PageUp-Down/Enter) mirrors mouse hover."}:{status:"manual",message:`Can't confirm keyboard support for "${e}".`,fix:"Verify Tab + arrow-key operation."}));{const e=[];null==t.brush&&null==t.onBrush||e.push("brushing"),!0===t.zoomable&&e.push("zoom/pan"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||e.push("legend filtering"),e.length>0&&o.push({id:"operable.complex-action-alternatives",principle:"operable",heuristic:"Complex actions have no alternatives",critical:!1,status:"warn",message:`Mouse-driven ${e.join(", ")} ${e.length>1?"have":"has"} no built-in keyboard/standard-UI equivalent.`,fix:"Pair the complex interaction with a standard control (range inputs for a brush, buttons for zoom, a checkbox list for legend filtering) operable by keyboard and screen reader."})}{const n=Jp[e];if(n&&p){const e=t[n];"number"==typeof e&&e>0&&24>2*e&&o.push({id:"operable.target-size",principle:"operable",heuristic:"Target pointer interaction size is too small",critical:!1,status:"warn",message:`${n}=${e} gives a ~${2*e}px hit target, below the 24×24px minimum for pointer interaction.`,fix:"Increase the radius, or rely on the chart's hoverRadius / keyboard navigation as the alternative for precise selection."})}}o.push({id:"operable.tab-stops",principle:"operable",heuristic:"Inappropriate tab stops",critical:!1,status:m,message:`The chart takes a single tab stop and navigates data with arrow keys${v} — the recommended pattern for dense charts (no per-datum tab stops to wade through).`}),o.push(Object.assign({id:"operable.interaction-cues",principle:"operable",heuristic:"No interaction cues or instructions",critical:!0},p?g||h?{status:"manual",message:"Chart is interactive and has descriptive text. Confirm that text explains how to interact (keyboard + pointer).",fix:'State the interaction model in summary, e.g. "Use arrow keys to move between points."'}:{status:"warn",message:"Chart is interactive but nothing explains how to use it.",fix:"Describe the interaction in a summary or nearby text (keyboard navigation, what hover/click reveals)."}:{status:"not-applicable",message:"No interactive behavior detected."})),o.push({id:"operable.controls-override-at",principle:"operable",heuristic:"Controls override AT controls",critical:!0,status:m,message:`Keyboard handlers fire only while the chart has focus, so they don't hijack page/app screen-reader shortcuts${v}.`}),o.push({id:"operable.focus-indicator",principle:"operable",heuristic:"Keyboard focus indicator missing, obscured, or low contrast",critical:!1,status:m,message:`A shape-adaptive focus ring (var(--semiotic-focus)) marks the focused element${v}.`,fix:i?"Ensure --semiotic-focus keeps ≥ 3:1 contrast against your background.":void 0}),o.push(Object.assign({id:"understandable.title-summary-caption",principle:"understandable",heuristic:"No title, summary, or caption",critical:!0},f?{status:"pass",message:`Provided: ${[d&&"title",h&&"description",g&&"summary"].filter(Boolean).join(", ")}.`}:r?{status:"manual",message:"No title/description/summary on the chart. If the wrapping ChartContainer supplies a title/subtitle, this is covered at that layer — verify it does.",fix:"Give the ChartContainer a title (and optionally enable describe), or set title/description/summary on the chart."}:{status:"fail",message:"No title, description, or summary — the screen reader falls back to a generic label.",fix:"Add title/description/summary on the chart, or wrap it in a ChartContainer (the opt-in layer for title/caption/description chrome)."})),o.push(Object.assign({id:"understandable.explain-purpose",principle:"understandable",heuristic:"No explanation for purpose or for how to read",critical:!0},h||g?{status:"pass",message:"A description/summary is available to explain purpose and how to read the chart."}:a?{status:"manual",message:"ChartContainer's describe option explains how to read the chart (type, stats, trend). Confirm the domain purpose — why this chart exists — is also conveyed (title/subtitle).",fix:"Give the ChartContainer a title/subtitle stating the purpose; describe() covers the how-to-read half."}:d?{status:"warn",message:"Only a title is set — a label, not an explanation of purpose or how to read the chart.",fix:"Add a summary, or enable ChartContainer's describe option for an auto-generated how-to-read description."}:{status:"fail",message:"Nothing explains the chart's purpose or how to read it.",fix:"Add a summary/description, or wrap in a ChartContainer with a title and the describe option (the opt-in full-accessibility layer)."}));{const e=[t.description,t.summary].filter(ty).join(". "),n=e?function(e){const t=e.split(/[.!?]+/).map(e=>e.trim()).filter(Boolean),n=e.trim().split(/\s+/).filter(Boolean);if(0===n.length||0===t.length)return null;let o=0;for(const e of n)o+=oy(e);return n.length/t.length*.39+o/n.length*11.8-15.59}(e):null;o.push(Object.assign({id:"understandable.reading-level",principle:"understandable",heuristic:"Reading level inappropriate",critical:!0},null==n?{status:"not-applicable",message:"No description/summary text to grade."}:n>9?{status:"warn",message:`Description/summary reads at ~grade ${n.toFixed(0)}; Chartability targets grade 9 or lower.`,fix:"Shorten sentences and prefer common words."}:{status:"pass",message:`Description/summary reads at ~grade ${Math.max(0,Math.round(n))} (≤ 9).`}))}if(Xp.has(e)){const e=ty(t.xLabel),n=ty(t.yLabel);o.push(Object.assign({id:"understandable.axis-labels",principle:"understandable",heuristic:"Axis labels are unclear or missing",critical:!1},e&&n?{status:"pass",message:"Both axes are labeled (xLabel, yLabel)."}:{status:"warn",message:`Missing axis label: ${[!e&&"xLabel",!n&&"yLabel"].filter(Boolean).join(", ")}. Ticks alone may not name the variable.`,fix:"Set xLabel and yLabel to name each axis's variable and units."}))}if(Qp.has(e)&&o.push({id:"understandable.information-complexity",principle:"understandable",heuristic:"Information complexity is inappropriate",critical:!1,status:"warn",message:"Dual-axis chart: two y-scales are hard to read accurately and notoriously easy to misinterpret (the crossover point is arbitrary).",fix:"Confirm the second axis is necessary; consider two aligned charts (small multiples) or indexing both series to a common baseline. Label each axis and its series unambiguously."}),y.length>1){const e=y.filter(ny).length;o.push(Object.assign({id:"understandable.annotation-hierarchy",principle:"understandable",heuristic:"Information complexity is inappropriate",critical:!1},e===y.length?{status:"pass",message:`All ${y.length} annotation(s) declare hierarchy through emphasis or provenance confidence, so the renderer can resolve reading order and visual priority.`}:0===e?{status:"warn",message:y.length+" annotations are present with no emphasis or provenance confidence; readers may not know which note is primary.",fix:'Mark the main annotation with emphasis="primary", set supporting notes to emphasis="secondary", or provide provenance.confidence so Semiotic can infer order.'}:{status:"warn",message:`${y.length-e} of ${y.length} annotation(s) have no emphasis or provenance confidence; readers may not know which note is primary among the unordered notes.`,fix:"Set emphasis on each annotation (primary/secondary), or provide provenance.confidence on all annotations so Semiotic can infer order."}))}(null!=t.forecast||null!=t.anomaly||null!=t.band||null!=t.regression)&&o.push({id:"understandable.uncertainty",principle:"understandable",heuristic:"Statistical uncertainty isn't clearly communicated",critical:!1,status:"manual",message:"The chart shows a forecast/regression/band/anomaly overlay. Confirm the uncertainty it represents is explained in text, not just drawn.",fix:"State the confidence interval / method in the summary, and label the band so it isn't mistaken for data."}),null!=t.animate&&!1!==t.animate&&o.push({id:"understandable.changes-followable",principle:"understandable",heuristic:"Changes are not easy to follow",critical:!1,status:m,message:`Transitions animate with object constancy and data changes are mirrored to the live region${v}.`,fix:i?"Keep transition durations in the 250ms–2s range so changes are followable but not slow.":void 0}),o.push({id:"robust.conforms-to-standards",principle:"robust",heuristic:"Does not conform to standards",critical:!1,status:"manual",message:"WCAG 2.1 / Section 508 conformance can't be settled from config alone.",fix:"Run an automated checker (axe) on the rendered output and test with real assistive tech."}),o.push({id:"robust.semantically-valid",principle:"robust",heuristic:"Semantically invalid",critical:!1,status:"manual",message:"Whether interactive elements expose correct roles/names is a render-time, screen-reader question.",fix:"Verify with a screen reader that buttons read as buttons, the chart as an image/group, etc."}),o.push({id:"robust.fragile-technology-support",principle:"robust",heuristic:"Fragile technology support",critical:!1,status:m,message:`Charts render on canvas with an SVG overlay and render to SVG in SSR, so access isn't tied to one rendering path${v}.`,fix:i?"Still test across NVDA+Firefox, JAWS+Chrome, and VoiceOver+Safari — AT support varies.":void 0}),o.push(Object.assign({id:"compromising.table",principle:"compromising",heuristic:"No table",critical:!0},l?{status:"not-applicable",message:"Single-value display — a table isn't meaningful."}:u?{status:"pass",message:"A human-readable data table is provided (accessibleTable)."}:{status:"fail",message:"accessibleTable is disabled — no human-readable table of the underlying data.",fix:"Remove accessibleTable={false} (unless title/summary/annotations already convey all the data)."})),l||o.push(Object.assign({id:"compromising.table-static",principle:"compromising",heuristic:"Table/data is static",critical:!1},r?{status:"manual",message:"Rendered in a ChartContainer. If a data-download action is enabled, the data is exportable.",fix:"Enable the ChartContainer data-download action so users can save the underlying data (keep it opt-in)."}:{status:"warn",message:"The data table is read-only — not downloadable, sortable, or filterable.",fix:"Wrap the chart in a ChartContainer and enable its data-download action (opt-in, so deployments can withhold it where export isn't allowed)."})),o.push({id:"compromising.shareable-state",principle:"compromising",heuristic:"State is not easy to share and reproduce",critical:!1,status:i?"pass":"manual",message:`Chart state serializes via toConfig/toURL/copyConfig${i?"":v}.`,fix:i?"Expose it to users via the ChartContainer copyConfig action or a shareable URL.":void 0}),o.push(Object.assign({id:"compromising.navigable-structure",principle:"compromising",heuristic:"Information cannot be navigated according to narrative or structure",critical:!1},s?{status:"pass",message:"ChartContainer's navigable option mounts a structured tree (chart → axes/series → data points) that screen readers can traverse."}:c?{status:"warn",message:"Hierarchical chart: built-in keyboard navigation is largely flat — it doesn't descend the tree structure.",fix:"Enable ChartContainer's navigable option for a structured navigation tree, or lean on the data table and a summary that conveys the hierarchy."}:{status:m,message:`Keyboard navigation steps through points and switches series/groups${v}.`,fix:i?"For deeper structure (axis → series → datum), enable ChartContainer's navigable option.":void 0}));{const n=Array.isArray(t.data)?t.data:null,i=Array.isArray(t.nodes)?t.nodes:null,r={id:"assistive.data-density",principle:"assistive",heuristic:"Data density is inappropriate",critical:!0};let a;a=qp.has(e)&&n&&n.length>7?Object.assign(Object.assign({},r),{status:"warn",message:n.length+" slices in a part-to-whole chart. Chartability suggests ≤ 5 categories; many thin slices are hard to perceive and to describe.",fix:'Group small slices into an "Other" category, or switch to a ranked bar chart.'}):Object.assign(Object.assign({},r),i&&i.length>200?{status:"warn",message:i.length+" nodes. A network this size is hard to navigate non-visually node by node.",fix:"Provide a summary of structure (clusters, hubs, components) and consider filtering or aggregating the graph."}:n&&n.length>5e3?{status:"warn",message:n.length+" data points. Canvas renders this fine, but the non-visual table/navigation become unwieldy.",fix:"Aggregate or bin for the accessible representation, or expose summary statistics rather than every row."}:n?{status:"pass",message:n.length+" data points — a reasonable density for non-visual consumption."}:i?{status:"pass",message:i.length+" nodes — a reasonable density for non-visual consumption."}:{status:"manual",message:"Data not provided inline (push mode); verify density at runtime."}),o.push(a)}{const e=Array.isArray(t.data)?t.data:null,n=["valueFormat","yFormat","xFormat","tickFormat","format"].some(e=>"function"==typeof t[e]||"string"==typeof t[e]);let i=!1;if(e&&!n)for(const t of e.slice(0,50))if(t&&"object"==typeof t){for(const e of Object.values(t))if("number"==typeof e&&Number.isFinite(e)&&Math.abs(e)>=1e5){i=!0;break}if(i)break}i&&o.push({id:"assistive.human-readable-numbers",principle:"assistive",heuristic:"Data in text is not human-readable",critical:!1,status:"warn",message:'Data includes large numbers (≥ 100,000) and no value/tick formatter — screen readers will read every digit (e.g. "six hundred fifty thousand…").',fix:'Pass valueFormat / yFormat (e.g. a compact formatter so 6,500,000 reads as "6.5M"); the formatter flows to ticks, tooltips, and the data table.'})}o.push(Object.assign({id:"assistive.features-described",principle:"assistive",heuristic:"Visually apparent features and relationships are not described",critical:!1},a?{status:"pass",message:"ChartContainer's describe option auto-generates an L1–L3 description (chart type, statistics, and trend) via describeChart()."}:g?{status:"manual",message:"A summary is present. Confirm it describes trends, extrema, clusters, and outliers — not just what the chart is.",fix:"Cover the L2/L3 content blind readers value most: direction of trend, peak/trough, notable outliers."}:{status:"warn",message:"No text describes the visually apparent trends, extrema, or outliers.",fix:"Enable ChartContainer's describe option (auto-generates via describeChart()), or write a summary covering the key trend and notable points."})),o.push(Object.assign({id:"assistive.skippable-navigation",principle:"assistive",heuristic:"Navigation and interaction is tedious",critical:!0},l?{status:"not-applicable",message:"Single value — nothing to skip."}:u?{status:"pass",message:'A "Skip to data table" link lets screen-reader users bypass point-by-point navigation.'}:{status:"warn",message:"accessibleTable is off, removing the skip-to-table affordance.",fix:"Keep accessibleTable enabled so users can skip past dense point navigation."})),o.push({id:"flexible.user-style-respected",principle:"flexible",heuristic:"User style change not respected",critical:!0,status:m,message:`Styling flows through CSS custom properties and honors forced-colors mode, so user/user-agent style changes cascade in${v}.`,fix:i?"Avoid hardcoding colors via frameProps style fns that bypass theme variables.":void 0}),o.push(Object.assign({id:"flexible.reduced-motion",principle:"flexible",heuristic:"Long animations cannot be controlled",critical:!1},Up.has(e)||Kp.has(e)?{status:"warn",message:e+" animates continuously. prefers-reduced-motion is auto-honored, but there's no in-chart pause/stop control for users who don't set that preference.",fix:"Offer a pause/stop control for looping/streaming motion (Chartability requires it for animation > 2s)."}:{status:m,message:`prefers-reduced-motion is auto-detected; transitions fast-forward and looping animation stops${v}.`}));{const n=!0===t.responsiveWidth||!0===t.responsiveHeight,i=Zp.has(e)&&!0===t.zoomable;o.push(Object.assign({id:"flexible.zoom-reflow",principle:"flexible",heuristic:"Zoom and reflow are not supported",critical:!1},n?{status:"pass",message:`Chart reflows to its container (${[!0===t.responsiveWidth&&"responsiveWidth",!0===t.responsiveHeight&&"responsiveHeight"].filter(Boolean).join(", ")}), so page zoom doesn't clip it.`}:i?{status:"pass",message:"Geo chart is zoomable/pannable."}:{status:"manual",message:"Fixed width/height — verify the chart survives browser zoom and reflow without clipping or loss of function.",fix:"Use responsiveWidth/responsiveHeight so the chart reflows to its container."}))}const b=o.filter(e=>"not-applicable"!==e.status).filter(e=>e.critical),x={criticalsPassed:b.filter(e=>"pass"===e.status).length,criticalsEvaluated:b.length,fails:o.filter(e=>"fail"===e.status).length,warnings:o.filter(e=>"warn"===e.status).length,manual:o.filter(e=>"manual"===e.status).length,passes:o.filter(e=>"pass"===e.status).length};return{component:e,ok:!b.some(e=>"fail"===e.status),summary:x,findings:o,reference:"Chartability (POUR-CAF) — https://chartability.github.io/POUR-CAF/. Not a pass/fail cert; pair with manual screen-reader testing (NVDA+Firefox, JAWS+Chrome, VoiceOver+Safari)."}}function ry(e,{onlyCritical:t=!1}={}){const n=[];for(const o of e.findings)"fail"!==o.status&&"warn"!==o.status||t&&!o.critical||n.push(o.message);return n}const ay={pass:"✓",fail:"✗",warn:"⚠",manual:"○","not-applicable":"·"},sy=["perceivable","operable","understandable","robust","compromising","assistive","flexible"];function ly(e){const t=[],n=e.summary,o=e.ok?`${n.criticalsPassed}/${n.criticalsEvaluated} critical heuristics pass`:`${n.fails} blocking failure(s) — ${n.criticalsPassed}/${n.criticalsEvaluated} critical heuristics pass`;t.push(`${e.ok?"✓":"✗"} ${e.component}: accessibility audit (Chartability POUR-CAF)`),t.push(` ${o} · ${n.warnings} warning(s) · ${n.manual} to verify manually`);for(const n of sy){const o=e.findings.filter(e=>e.principle===n&&"not-applicable"!==e.status);if(0!==o.length){t.push(""),t.push(" "+n.toUpperCase());for(const e of o)t.push(` ${ay[e.status]} ${e.id}${e.critical?" [critical]":""}: ${e.message}`),!e.fix||"fail"!==e.status&&"warn"!==e.status&&"manual"!==e.status||t.push(" → "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function cy(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function uy(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function dy(e){return"nominal"===e||"ordinal"===e}function hy(e){return"quantitative"===e||"temporal"===e}const gy={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},fy={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},py={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function yy(e){var t,n,o,i,r,a,s,l,c,u,d,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:Zs(e,["type"])}}(e.mark),y=e.encoding||{},m=y.x,v=y.y,b=y.color,x=y.size,w=y.theta,k=y.opacity;let A;(null===(t=e.data)||void 0===t?void 0:t.values)?A=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&g.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&g.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&g.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&g.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||y.facet||y.row||y.column)&&g.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&g.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&g.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const S={};e.width&&(S.width=e.width),e.height&&(S.height=e.height);const C=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(C&&(S.title=C),(null==b?void 0:b.field)&&(S.colorBy=b.field,null===(o=b.scale)||void 0===o?void 0:o.scheme)){const e=gy[b.scale.scheme];e&&(S.colorScheme=e)}void 0!==(null==k?void 0:k.value)&&(S.pointOpacity=k.value);const O=null==m?void 0:m.aggregate,_=null==v?void 0:v.aggregate;if(A&&(O||_)){const e=_?v:m,t=_?m:v,n=py[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:n,value:o,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[n]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of r){let o;switch(i){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=uo(t)[0];break;case"max":o=uo(t)[1];break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(A,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const n of A){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}A=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(S.data=A),(null==m?void 0:m.bin)?(S.valueAccessor=m.field,(null==v?void 0:v.field)&&(S.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(S.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(S.valueAccessor=v.field,(null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(S.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),n="object"==typeof t?t.maxbins:void 0;return n&&(S.bins=n),vy(e,S,g)}let j;switch(f){case"bar":j=function(e,t,n,o,i,r,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",dy(null==e?void 0:e.type)&&hy(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):hy(null==e?void 0:e.type)&&dy(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=r?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),i&&(o.data=i),g}(m,v,b,S,A,O,_);break;case"line":if(j="LineChart",my(m,v,S,O,_),(null==b?void 0:b.field)&&(S.lineBy=b.field),p.interpolate){const e=fy[p.interpolate];e&&(S.curve=e)}!0===p.point&&(S.showPoints=!0),A&&(S.data=A);break;case"area":if((null==b?void 0:b.field)?(j="StackedAreaChart",S.areaBy=b.field):j="AreaChart",my(m,v,S,O,_),p.interpolate){const e=fy[p.interpolate];e&&(S.curve=e)}void 0!==p.opacity&&(S.areaOpacity=p.opacity),A&&(S.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(j="BubbleChart",S.sizeBy=x.field,(null===(a=x.scale)||void 0===a?void 0:a.range)&&(S.sizeRange=x.scale.range)):j="Scatterplot",my(m,v,S,O,_),A&&(S.data=A);break;case"rect":j="Heatmap",(null==m?void 0:m.field)&&(S.xAccessor=m.field),(null==v?void 0:v.field)&&(S.yAccessor=v.field),(null==b?void 0:b.field)&&(S.valueAccessor=b.field,delete S.colorBy),(null===(s=null==m?void 0:m.axis)||void 0===s?void 0:s.title)&&(S.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(S.yLabel=v.axis.title),A&&(S.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(j="DonutChart",S.innerRadius=p.innerRadius):j="PieChart",(null==w?void 0:w.field)?S.valueAccessor=w.field:(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field),(null==b?void 0:b.field)&&(S.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==w?void 0:w.field)&&(S.categoryAccessor=m.field),A&&(S.data=A);break;case"tick":j="DotPlot",dy(null==m?void 0:m.type)?(S.categoryAccessor=m.field,(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(S.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(S.valueLabel=v.axis.title)):dy(null==v?void 0:v.type)?(S.categoryAccessor=v.field,(null==m?void 0:m.field)&&(S.valueAccessor=O?"value":m.field),S.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(S.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(S.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field)),A&&(S.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),j="Scatterplot",my(m,v,S,O,_),A&&(S.data=A)}return vy(j,S,g)}function my(e,t,n,o,i){var r,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function vy(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}const by=/^\d{4}[-/]\d{2}/,xy=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function wy(e){return"number"==typeof e?Number.isFinite(e)?"numeric":"unknown":e instanceof Date?"date":"string"==typeof e?by.test(e)&&!Number.isNaN(Date.parse(e))?"date":xy.test(e)&&Number.isFinite(Number(e))?"numeric":"categorical":"boolean"==typeof e?"categorical":"unknown"}function ky(e){let t=1/0,n=-1/0;for(let o=0;e.length>o;o++){const i=e[o];t>i&&(t=i),i>n&&(n=i)}return{min:t,max:n}}function Ay(e){const t=e.length;if(0===t)return NaN;const n=t>>1;return t%2==0?(e[n-1]+e[n])/2:e[n]}function Sy(e,t={}){var n,o;const{maxDistinct:i=10,sampleSize:r=5,keyScanRows:a=100}=t;if(!Array.isArray(e)||0===e.length)return{rowCount:0,fields:{},sample:[]};const s=new Set,l=Math.min(e.length,a);for(let t=0;l>t;t++){const n=e[t];if(n&&"object"==typeof n)for(const e of Object.keys(n))s.add(e)}const c={};for(const t of s){const r=[];for(let o=0;e.length>o;o++){const i=null===(n=e[o])||void 0===n?void 0:n[t];null!=i&&r.push(i)}if(0===r.length){c[t]={type:"unknown"};continue}const a=wy(r[0]);if("numeric"===a){const e=[];for(let t=0;r.length>t;t++){const n=Number(r[t]);Number.isFinite(n)&&e.push(n)}if(0===e.length){c[t]={type:"unknown"};continue}const{min:n,max:o}=ky(e);let i=0;for(let t=0;e.length>t;t++)i+=e[t];const a=[...e].sort((e,t)=>e-t);c[t]={type:"numeric",min:n,max:o,mean:i/e.length,median:Ay(a)}}else if("date"===a){const e=[];for(let t=0;r.length>t;t++){const n=r[t],o=n instanceof Date?n.getTime():Date.parse(n);Number.isFinite(o)&&e.push(o)}if(0===e.length){c[t]={type:"unknown"};continue}const{min:n,max:o}=ky(e);c[t]={type:"date",min:new Date(n).toISOString(),max:new Date(o).toISOString()}}else if("categorical"===a){const e=new Map;for(let t=0;r.length>t;t++){const n=r[t]+"";e.set(n,(null!==(o=e.get(n))&&void 0!==o?o:0)+1)}const n=[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,i).map(([e,t])=>({value:e,count:t}));c[t]={type:"categorical",distinctCount:e.size,topValues:n,distinctValues:e.size>i?void 0:n.map(e=>e.value)}}else c[t]={type:"unknown"}}return{rowCount:e.length,fields:c,sample:e.slice(0,r)}}const Cy=/^(x|index|rank|order|step|sequence|year|quarter|qtr|fiscal|month|week|day|date|time|timestamp)$/i,Oy=/^(y|value|amount|total|count|revenue|sales|price|score|rate|population|measure)$/i,_y=/(size|magnitude|volume|weight|count|amount)/i,jy=/^(category|label|name|type|group|region|segment|kind|class)$/i,Py=/^(series|group|type|category|segment|cohort|product)$/i,My=new Set(["numeric"]),Ly=new Set(["numeric","date"]),Ty=new Set(["numeric"]),$y=new Set(["date"]),Ny=new Set(["categorical","boolean"]);function Dy(e){return"numeric"===e.type?"numeric":"date"===e.type?"date":"categorical"===e.type?"categorical":"unknown"}function By(e,t){return t.test(e)?.2:0}function Iy(e,t){var n;let o=null;for(let i=0;e.length>i;i++){const r=null===(n=e[i])||void 0===n?void 0:n[t];if(null==r)continue;const a=r instanceof Date?r.getTime():Number(r);if(!Number.isFinite(a))return!1;if(null!==o&&o>a)return!1;o=a}return null!==o}function Ry(e,t,n,o,i={}){const r=[];for(const[a,s]of Object.entries(e)){const e=Dy(s);if(!n.has(e))continue;let l,c=.5;c+=By(a,o),"categorical"===s.type&&(l=s.distinctCount,!l||2>l||l>12||(c+=.2),l&&l>50&&(c-=.2)),"numeric"===s.type&&Number.isFinite(s.min)&&Number.isFinite(s.max)&&s.max>s.min&&(c+=.1);const u={field:a,kind:e,quality:Math.max(0,Math.min(1,c)),distinctCount:l};!i.computeMonotonic||"numeric"!==e&&"date"!==e||(u.monotonic=Iy(t,a),u.monotonic&&(u.quality=Math.min(1,u.quality+.2))),r.push(u)}return r.sort((e,t)=>t.quality-e.quality),r}function Fy(e,t){var n;const o=new Set;for(let i=0;e.length>i;i++){const r=null===(n=e[i])||void 0===n?void 0:n[t];null!=r&&o.add(r+"")}return o.size}const Ey=/^(source|from|origin|stage|currentstage|sourcestage|fromstage)$/i,Hy=/^(target|to|destination|nextstage|next|targetstage|tostage|destinationstage|status)$/i,zy=/^(starttime|startedat|enteredat|startdate|start|timestamp|date|time)$/i,Wy=/^(endtime|endedat|exitedat|completedat|finishtime|enddate|end)$/i,Gy=/^(value|weight|amount|count|magnitude|volume)$/i;function Yy(e,t){return e.find(e=>t.test(e))}function qy(e,t={}){var n,o,i,r,a,s,l;const c=Sy(null!=e?e:[]),u=Array.isArray(e)?e:[],d=function(e){var t;if(e&&"object"==typeof e&&!Array.isArray(e)){const n=e;if("FeatureCollection"===n.type&&Array.isArray(n.features))return{hasHierarchy:!1,hasNetwork:!1,hasGeo:!0,geo:{features:n.features,points:Array.isArray(n.points)?n.points:void 0,flows:Array.isArray(n.flows)?n.flows:void 0}};if(Array.isArray(n.children))return{hasHierarchy:!0,hasNetwork:!1,hasGeo:!1,hierarchy:n};if(Array.isArray(n.nodes)&&(Array.isArray(n.edges)||Array.isArray(n.links))){const e=null!==(t=n.edges)&&void 0!==t?t:n.links;return{hasHierarchy:!1,hasNetwork:!0,hasGeo:!1,network:{nodes:n.nodes,edges:e}}}}return{hasHierarchy:!1,hasNetwork:!1,hasGeo:!1}}(t.rawInput);if(!d.hasNetwork&&!d.hasHierarchy&&!d.hasGeo){const e=function(e){var t,n;if(3>e.length)return null;const o=e[0];if(!o||"object"!=typeof o)return null;const i=Object.keys(o),r=Yy(i,Ey),a=Yy(i,Hy);if(!r||!a||r===a)return null;const s=Yy(i,zy),l=Yy(i,Wy),c=Yy(i,Gy),u=[];for(const t of e){if(!t)continue;const e=t[r],n=t[a];if(null==e||null==n)continue;const o=(e+"").trim(),i=(n+"").trim();o&&i&&o!==i&&u.push(t)}if(3>u.length)return null;const d=new Map,h=new Map,g=new Map;for(const e of u){const n=(e[r]+"").trim(),o=(e[a]+"").trim();d.has(n)||d.set(n,{id:n,label:n}),d.has(o)||d.set(o,{id:o,label:o});const i=`${n}->${o}`,u=c?Number(e[c]):1,f=Number.isFinite(u)?u:1;h.set(i,(null!==(t=h.get(i))&&void 0!==t?t:0)+f),g.has(i)||g.set(i,Object.assign(Object.assign({source:n,target:o},s?{startTime:e[s]}:{}),l?{endTime:e[l]}:{}))}const f=[];for(const[e,t]of g)f.push(Object.assign(Object.assign({},t),{value:null!==(n=h.get(e))&&void 0!==n?n:1}));return{nodes:Array.from(d.values()),edges:f}}(u);e&&(d.hasNetwork=!0,d.network=e)}const h=Ry(c.fields,u,Ly,Cy,{computeMonotonic:!0}),g=Ry(c.fields,u,Ty,Oy),f=Ry(c.fields,u,My,_y),p=Ry(c.fields,u,Ny,jy),y=Ry(c.fields,u,Ny,Py),m=Ry(c.fields,u,$y,/(date|time|timestamp)/i,{computeMonotonic:!0}),v=null===(n=m[0])||void 0===n?void 0:n.field;let b=v,x=v?"time":"none";if(!b){const e=h.find(e=>Cy.test(e.field)&&"numeric"===e.kind);e&&(b=e.field,x="named")}const w=null===(o=g.find(e=>e.field!==b))||void 0===o?void 0:o.field;if(!b&&w){const e=Object.entries(c.fields).filter(([e,t])=>"numeric"===t.type).map(([e])=>e);2>e.length||(b=e.find(e=>e!==w),b&&(x="scatter"))}const k=null===(i=f.find(e=>e.field!==b&&e.field!==w))||void 0===i?void 0:i.field,A="time"===x||"named"===x,S=p.map(e=>e.field);let C,O;A?(O=null!==(r=t.seriesField)&&void 0!==r?r:S[0],C=S.find(e=>e!==O)):(C=S[0],O=null!==(a=t.seriesField)&&void 0!==a?a:S.find(e=>e!==C));const _=C?Fy(u,C):void 0,j=O?Fy(u,O):void 0,P=b?Fy(u,b):void 0,M=!!b&&function(e,t){var n;const o=new Set;for(let i=0;e.length>i;i++){const r=null===(n=e[i])||void 0===n?void 0:n[t];if(null==r)continue;const a=r+"";if(o.has(a))return!0;o.add(a)}return!1}(u,b),L=null!==(l=null===(s=h.find(e=>e.field===b))||void 0===s?void 0:s.monotonic)&&void 0!==l&&l,T=m.length>0;return Object.assign(Object.assign({},c),{data:u,candidates:{x:h,y:g,size:f,category:p,series:y,time:m},primary:{x:b,y:w,size:k,category:C,series:O,time:v},categoryCount:_,seriesCount:j,uniqueXCount:P,hasRepeatedX:M,monotonicX:L,hasTimeAxis:T,hasHierarchy:d.hasHierarchy,hasNetwork:d.hasNetwork,hasGeo:d.hasGeo,xProvenance:x,network:d.network,hierarchy:d.hierarchy,geo:d.geo})}const Vy={rows:{tiny:3,small:25,medium:250,large:5e3},cardinality:{low:7,medium:25},fields:{narrow:3,typical:10}},Xy=["tiny","small","medium","large","huge"];function Uy(e){var t,n,o;return{rows:Object.assign(Object.assign({},Vy.rows),null!==(t=null==e?void 0:e.rows)&&void 0!==t?t:{}),cardinality:Object.assign(Object.assign({},Vy.cardinality),null!==(n=null==e?void 0:e.cardinality)&&void 0!==n?n:{}),fields:Object.assign(Object.assign({},Vy.fields),null!==(o=null==e?void 0:e.fields)&&void 0!==o?o:{})}}function Ky(e,t){if(!Number.isFinite(e)||0>e)return"tiny";const n=Uy(null==t?void 0:t.thresholds).rows;return e>n.tiny?e>n.small?e>n.medium?e>n.large?"huge":"large":"medium":"small":"tiny"}function Qy(e,t){if(!Number.isFinite(e)||0>e)return"low";const n=Uy(null==t?void 0:t.thresholds).cardinality;return e>n.low?e>n.medium?"high":"medium":"low"}function Zy(e,t){if(!Number.isFinite(e)||0>e)return"narrow";const n=Uy(null==t?void 0:t.thresholds).fields;return e>n.narrow?e>n.typical?"wide":"typical":"narrow"}function Jy(e,t){return Xy.indexOf(e)-Xy.indexOf(t)}function em(e,t,n){if("number"==typeof e&&Number.isFinite(e))return e;if(void 0!==e){const t=Uy(null==n?void 0:n.thresholds).rows;switch(e){case"tiny":return Math.max(1,Math.floor(t.tiny/2));case"small":return Math.floor((t.tiny+t.small)/2);case"medium":return Math.floor((t.small+t.medium)/2);case"large":return Math.floor((t.medium+t.large)/2);case"huge":return Math.floor(2*t.large)}}return t}function tm(e,t,n){if("number"==typeof e&&Number.isFinite(e))return e;if(void 0!==e){const t=Uy(null==n?void 0:n.thresholds).cardinality;switch(e){case"low":return Math.max(1,Math.floor(t.low/2));case"medium":return Math.floor((t.low+t.medium)/2);case"high":return Math.floor(2*t.medium)}}return t}function nm(e,t){var n,o,i,r;const a=null!==(n=e.rowCount)&&void 0!==n?n:0,s=null==t?void 0:t.rows,l=em(s,a,t),c=Ky(l,t),u=Object.keys(null!==(o=e.fields)&&void 0!==o?o:{}).length,d=null==t?void 0:t.fields,h="number"==typeof d?d:"string"==typeof d?function(e,t){const n=Uy(null==t?void 0:t.thresholds).fields;switch(e){case"narrow":return Math.max(1,Math.floor(n.narrow/2));case"typical":return Math.floor((n.narrow+n.typical)/2);case"wide":return Math.floor(2*n.typical)}}(d,t):u,g=Zy(h,t),f=e.primary.category,p=f?null===(i=null==t?void 0:t.cardinality)||void 0===i?void 0:i[f]:void 0,y=tm(null!=p?p:null==t?void 0:t.typicalCardinality,e.categoryCount,t);return{rows:l,rowBand:c,fields:h,fieldBand:g,typicalCardinality:y,cardinalityBand:void 0!==y?Qy(y,t):void 0,growth:null!==(r=null==t?void 0:t.growth)&&void 0!==r?r:"static",rowsSource:void 0!==s?"declared":"measured"}}const om=2.5;function im(e,t,n,o,i){var r,a,s;const l=[],c=[];let u=0,d=!1;if(e.scaleFit){const i=e.scaleFit(t,n,o);if(i&&(u+=Math.max(-2.5,Math.min(om,null!==(r=i.delta)&&void 0!==r?r:0)),i.reason&&l.push(i.reason),i.caveats))for(const e of i.caveats)c.push(e)}const h=null===(a=null==o?void 0:o.charts)||void 0===a?void 0:a[e.component];if(h&&(h.minBand&&0>Jy(n.rowBand,h.minBand)||h.maxBand&&Jy(n.rowBand,h.maxBand)>0?d=!0:"number"==typeof h.bias?(u+=Math.max(-3,Math.min(3,h.bias)),h.reason&&l.push(`${(null==o?void 0:o.name)?o.name+": ":""}${h.reason}`)):h.reason&&l.push(`${(null==o?void 0:o.name)?o.name+": ":""}${h.reason}`)),i&&e.qualityFit){const n=e.qualityFit(t,i);if(n&&(u+=Math.max(-1,Math.min(1,null!==(s=n.delta)&&void 0!==s?s:0)),n.reason&&l.push(n.reason),n.caveats))for(const e of n.caveats)c.push(e)}else if(i){const e=t.primary.y;if(e){const t=function(e,t){if(void 0===e)return;if("number"==typeof e)return e;const n=e[t];return"number"==typeof n?n:void 0}(i.completeness,e);void 0!==t&&.85>t&&c.push(`${e} is only ${Math.round(100*t)}% complete — expect gaps`)}}return{delta:u,reasons:l,caveats:c,excluded:d}}function rm(e){return(t,n)=>{let o=0;const i=[];let r;if(e.rows){const[t,a]=e.rows.sweetSpot;t>n.rows||n.rows>a?t>n.rows?(o-=Math.min(om,.8*(0===t?1:(t-n.rows)/t)),void 0===e.rows.caveatBelow||n.rows>e.rows.caveatBelow||i.push(`only ${n.rows} rows — chart may feel sparse`)):(o-=Math.min(om,.4*(0===a?1:(n.rows-a)/a)),void 0===e.rows.caveatAbove||e.rows.caveatAbove>n.rows||i.push(n.rows+" rows is past this chart's comfortable density")):(o+=.6,r=n.rows+" rows is in the sweet spot for this chart")}if(e.cardinality&&void 0!==n.typicalCardinality){const t=n.typicalCardinality,[r,a]=e.cardinality.sweetSpot;r>t||t>a?t>a&&(o-=Math.min(om,.5*(0===a?1:(t-a)/a)),void 0===e.cardinality.caveatAbove||e.cardinality.caveatAbove>t||i.push(t+" distinct categories may overwhelm this chart")):o+=.4}return 0!==o||0!==i.length||r?{delta:o,reason:r,caveats:i}:null}}const am={component:"LineChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:5,accuracy:4,precision:4},fits:e=>{var t;if(2>e.rowCount)return"needs at least 2 rows";if(!e.primary.x)return"needs a numeric or time x field";if(!e.primary.y)return"needs a numeric y field";const n=null===(t=e.candidates.x.find(t=>t.field===e.primary.x))||void 0===t?void 0:t.kind;return n&&"numeric"!==n&&"date"!==n?`x field "${e.primary.x}" is ${n}, LineChart needs numeric or time`:"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — given x looks like a scatter pattern, not a sequence"},intentScores:{trend:e=>"scatter"!==e.xProvenance||e.monotonicX?!e.uniqueXCount||4>e.uniqueXCount?3:!e.seriesCount||2>e.seriesCount?4:5:1,"compare-series":e=>"scatter"!==e.xProvenance||e.monotonicX?!e.seriesCount||2>e.seriesCount?1:e.seriesCount>8?2:4:1,"change-detection":e=>"scatter"!==e.xProvenance||e.monotonicX?4:1,"outlier-detection":2,correlation:2},caveats:e=>{const t=[];return!e.hasRepeatedX||e.seriesCount&&e.seriesCount>=2||t.push("x values repeat — consider aggregating or adding a series field"),e.seriesCount&&e.seriesCount>8&&t.push(e.seriesCount+" series may produce a spaghetti chart"),t},variants:[{key:"linear",label:"Linear trend",props:{curve:"linear",showPoints:!1},tags:["linear"]},{key:"smooth",label:"Smooth trend",description:"Monotone smoothing — emphasizes the shape over individual points.",props:{curve:"monotoneX",showPoints:!1},tags:["smooth","narrative"],intentDeltas:{trend:1,"outlier-detection":-2},rubricDeltas:{precision:-1},caveats:["smoothing hides individual outliers"]},{key:"stepped-with-points",label:"Discrete steps",description:"Step curve plus visible points — for state changes or discrete events.",props:{curve:"step",showPoints:!0,pointRadius:3},tags:["step","discrete"],intentDeltas:{"change-detection":1,trend:-1},rubricDeltas:{precision:1}},{key:"annotated-threshold",label:"With alert threshold",description:'A reference threshold or band turns the chart from a report into an alert — read it for breaches of the expected range. Pair with a provenanced annotation (e.g. from the data-quality bridge) and the chart\'s communicative act becomes "alerting".',props:{showGrid:!0,showPoints:!0},tags:["alert","annotated-threshold","monitoring"],intentDeltas:{"outlier-detection":2,"change-detection":1}}],buildProps:(e,t)=>{var n;const o={data:e.data,xAccessor:e.primary.x,yAccessor:e.primary.y};return e.seriesCount&&e.seriesCount>=2&&e.primary.series&&(o.lineBy=e.primary.series,o.colorBy=e.primary.series),e.hasTimeAxis&&e.primary.x===e.primary.time&&(o.xScaleType="time"),Object.assign(Object.assign({},o),null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})},scaleFit:rm({rows:{sweetSpot:[25,2e3],caveatBelow:4,caveatAbove:1e4}})},sm={component:"AreaChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:4,accuracy:3,precision:3},fits:e=>3>e.rowCount?"needs at least 3 rows":e.primary.x?e.primary.y?"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — given x looks like a scatter pattern, not a sequence":"needs a numeric y field":"needs a numeric or time x field",intentScores:{trend:e=>"scatter"!==e.xProvenance||e.monotonicX?e.seriesCount&&e.seriesCount>=2||!e.uniqueXCount||4>e.uniqueXCount?3:5:1,"change-detection":e=>"scatter"!==e.xProvenance||e.monotonicX?3:1},caveats:e=>{const t=[];return e.seriesCount&&e.seriesCount>=2&&e.primary.series&&t.push(`showing only the leading "${e.primary.series}" series — for multi-series comparison use LineChart or DifferenceChart`),t},variants:[{key:"smooth",label:"Smooth gradient",props:{curve:"monotoneX"},tags:["smooth","gradient","narrative"]},{key:"linear",label:"Linear",props:{curve:"linear",gradientFill:!1,areaOpacity:.5},tags:["linear"]},{key:"stepped",label:"Stepped",props:{curve:"stepAfter"},tags:["step"],intentDeltas:{"change-detection":1}},{key:"annotated-threshold",label:"With alert threshold",description:'A reference threshold or expected band turns the area into an alert — read for breaches. Pair with a provenanced annotation (e.g. from the data-quality bridge) and the communicative act becomes "alerting".',props:{showGrid:!0},tags:["alert","annotated-threshold","monitoring"],intentDeltas:{"outlier-detection":2,"change-detection":1}}],buildProps:(e,t)=>{var n,o;let i=e.data;if(e.seriesCount&&e.seriesCount>=2&&e.primary.series){const t=e.primary.series,o=e.primary.y,r=new Map;for(const i of e.data){const e=i[t];if(null==e||""===e)continue;const a=Number(i[o]);r.set(e,(null!==(n=r.get(e))&&void 0!==n?n:0)+(Number.isFinite(a)?a:0))}let a,s=-1/0;for(const[e,t]of r)t>s&&(s=t,a=e);null!=a&&r.size>0&&(i=e.data.filter(e=>e[t]===a))}const r={data:i,xAccessor:e.primary.x,yAccessor:e.primary.y,gradientFill:!0,areaOpacity:.55};return e.hasTimeAxis&&e.primary.x===e.primary.time&&(r.xScaleType="time"),Object.assign(Object.assign({},r),null!==(o=null==t?void 0:t.props)&&void 0!==o?o:{})},scaleFit:rm({rows:{sweetSpot:[6,200],caveatAbove:2e3}})},lm={component:"StackedAreaChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:4,accuracy:3,precision:3},fits:e=>4>e.rowCount?"needs at least 4 rows":e.primary.x?e.primary.y?!e.seriesCount||2>e.seriesCount?"needs 2+ stack groups (series field)":e.seriesCount>10?e.seriesCount+" series is too many to stack legibly":"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — stacking only makes sense across a sequence":"needs a numeric y field":"needs an ordered x field",intentScores:{"composition-over-time":5,"part-to-whole":e=>e.hasTimeAxis?4:3,trend:3,"compare-series":2},caveats:()=>["readability of individual layers degrades below the baseline"],variants:[{key:"baseline-zero",label:"Zero baseline",props:{baseline:"zero",stackOrder:"key"},tags:["zero-baseline"]},{key:"streamgraph",label:"Streamgraph",description:"Wiggle baseline + inside-out ordering — emphasizes momentum over precise totals.",props:{baseline:"wiggle",stackOrder:"insideOut",showLine:!1},tags:["streamgraph","narrative"],intentDeltas:{"composition-over-time":0,trend:1,"part-to-whole":-2},rubricDeltas:{accuracy:-1,precision:-1},caveats:["streamgraph hides absolute totals; precise reads not possible"]},{key:"centered",label:"Centered baseline",props:{baseline:"silhouette",stackOrder:"insideOut"},tags:["silhouette"],intentDeltas:{"part-to-whole":-1}}],buildProps:(e,t)=>{var n;const o={data:e.data,xAccessor:e.primary.x,yAccessor:e.primary.y,areaBy:e.primary.series,colorBy:e.primary.series};return e.hasTimeAxis&&e.primary.x===e.primary.time&&(o.xScaleType="time"),Object.assign(Object.assign({},o),null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})},scaleFit:rm({rows:{sweetSpot:[30,1500],caveatBelow:12,caveatAbove:1e4}})},cm={component:"Scatterplot",family:"relationship",importPath:"semiotic/xy",rubric:{familiarity:4,accuracy:5,precision:5},fits:e=>{var t;if(3>e.rowCount)return"needs at least 3 rows";if(!e.primary.x)return"needs a numeric x field";if(!e.primary.y)return"needs a numeric y field";const n=null===(t=e.candidates.x.find(t=>t.field===e.primary.x))||void 0===t?void 0:t.kind;return"date"===n?null:n&&"numeric"!==n?`x field "${e.primary.x}" is ${n}, Scatterplot needs numeric`:null},intentScores:{correlation:e=>{const t="time"===e.xProvenance||"named"===e.xProvenance?e.primary.x:e.primary.time,n=t?e.candidates.y.filter(e=>e.field!==t).map(e=>e.field):[];return t&&n.length>=2||e.primary.size?4:5},"outlier-detection":5,distribution:3,"compare-series":e=>!e.seriesCount||2>e.seriesCount||e.seriesCount>6?1:3,rank:1},variants:[{key:"points",label:"Points only",props:{},tags:["points"]},{key:"with-trend",label:"Points with regression line",props:{regression:"linear"},tags:["regression","trend"],intentDeltas:{correlation:0,trend:1}}],buildProps:(e,t)=>{var n;const o={data:e.data},i="time"===e.xProvenance||"named"===e.xProvenance?e.primary.x:void 0,r=i?e.candidates.y.filter(e=>e.field!==i).map(e=>e.field):[];return i&&r.length>=2?(o.xAccessor=r[0],o.yAccessor=r[1]):(o.xAccessor=e.primary.x,o.yAccessor=e.primary.y,e.primary.size&&(o.sizeBy=e.primary.size)),e.primary.series&&e.seriesCount&&6>=e.seriesCount&&(o.colorBy=e.primary.series),Object.assign(Object.assign({},o),null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})},scaleFit:rm({rows:{sweetSpot:[50,5e3],caveatBelow:20,caveatAbove:1e4}})},um={component:"ConnectedScatterplot",family:"relationship",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>4>e.rowCount?"needs at least 4 ordered points":e.primary.x?e.primary.y?e.monotonicX||e.hasTimeAxis?null:"needs an ordered x sequence":"needs a y field":"needs an x field",intentScores:{trend:3,correlation:e=>{const t="time"===e.xProvenance||"named"===e.xProvenance?e.primary.x:e.primary.time,n=t?e.candidates.y.filter(e=>e.field!==t).map(e=>e.field):[];return t&&n.length>=2?5:4},"change-detection":3},caveats:()=>["readers can confuse path direction without explicit start/end markers"],buildProps:e=>{var t,n;const o={data:e.data},i="time"===e.xProvenance||"named"===e.xProvenance?e.primary.x:e.primary.time,r=i?e.candidates.y.filter(e=>e.field!==i).map(e=>e.field):[];return i&&r.length>=2?(o.xAccessor=r[0],o.yAccessor=r[1],o.orderAccessor=i):(o.xAccessor=e.primary.x,o.yAccessor=e.primary.y,o.orderAccessor=null!==(t=e.primary.time)&&void 0!==t?t:e.primary.x),e.primary.series&&6>=(null!==(n=e.seriesCount)&&void 0!==n?n:0)&&(o.colorBy=e.primary.series),o}},dm={component:"BubbleChart",family:"relationship",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>4>e.rowCount?"needs at least 4 points":e.primary.x?e.primary.y?e.primary.size?null:"needs a third numeric measure for bubble size":"needs a numeric y field":"needs a numeric x field",intentScores:{correlation:5,"compare-categories":3,"outlier-detection":4},caveats:()=>["bubble area is harder to compare than length — large dynamic ranges distort"],buildProps:e=>{var t;return Object.assign({data:e.data,xAccessor:e.primary.x,yAccessor:e.primary.y,sizeBy:e.primary.size},e.primary.series&&6>=(null!==(t=e.seriesCount)&&void 0!==t?t:0)?{colorBy:e.primary.series}:{})},scaleFit:rm({rows:{sweetSpot:[10,500],caveatAbove:1500}})},hm={component:"QuadrantChart",family:"relationship",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>4>e.rowCount?"needs at least 4 points":e.primary.x?e.primary.y?null:"needs a numeric y field":"needs a numeric x field",intentScores:{"compare-categories":2,correlation:3,"outlier-detection":3},buildProps:e=>{var t;const n=e.primary.x,o=e.primary.y,i=e.fields[n],r=e.fields[o],a="numeric"===(null==i?void 0:i.type)?i.median:void 0,s="numeric"===(null==r?void 0:r.type)?r.median:void 0;return Object.assign(Object.assign(Object.assign(Object.assign({data:e.data,xAccessor:n,yAccessor:o},void 0!==a?{xCenter:a}:{}),void 0!==s?{yCenter:s}:{}),e.primary.series&&6>=(null!==(t=e.seriesCount)&&void 0!==t?t:0)?{colorBy:e.primary.series}:{}),{quadrants:{topLeft:Object.assign({},Nl),topRight:Object.assign({},Dl),bottomLeft:Object.assign({},Bl),bottomRight:Object.assign({},Il)}})}},gm={component:"MultiAxisLineChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:3,precision:3},fits:e=>4>e.rowCount?"needs at least 4 rows":e.primary.x?2>Object.entries(e.fields).filter(([t,n])=>"numeric"===n.type&&t!==e.primary.x).map(([e])=>e).length?"needs at least 2 numeric measures":"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — multi-axis lines need a shared sequence":"needs an x field",intentScores:{"compare-series":4,trend:3,correlation:3},caveats:()=>["dual axes can mislead — only use when measures share interpretation"],buildProps:e=>{const t=Object.entries(e.fields).filter(([t,n])=>"numeric"===n.type&&t!==e.primary.x).slice(0,2).map(([e])=>({yAccessor:e,label:e}));return{data:e.data,xAccessor:e.primary.x,series:t}}},fm={component:"MinimapChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:4,accuracy:4,precision:4},fits:e=>30>e.rowCount?"minimap pays off only on long sequences (30+ rows)":e.primary.x?e.primary.y?"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — minimap previews a sequence":"needs a numeric y field":"needs an ordered x field",intentScores:{trend:4,"change-detection":4,"outlier-detection":3},buildProps:e=>Object.assign({data:e.data,xAccessor:e.primary.x,yAccessor:e.primary.y},e.hasTimeAxis&&e.primary.x===e.primary.time?{xScaleType:"time"}:{})},pm={component:"DifferenceChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>{var t;return 4>e.rowCount?"needs at least 4 rows":e.primary.x?e.primary.series?!e.seriesCount||2>e.seriesCount?`needs 2+ series (got ${null!==(t=e.seriesCount)&&void 0!==t?t:0})`:e.primary.y?"scatter"!==e.xProvenance||e.monotonicX?null:"needs an ordered/temporal x — given x looks like a scatter pattern, not a sequence":"needs a numeric y field":"needs a series field with at least two groups":"needs an x field (numeric or time)"},intentScores:{"compare-series":e=>2===e.seriesCount?5:3,"change-detection":4,trend:3},caveats:e=>{const t=[];return e.seriesCount&&e.seriesCount>2&&t.push(`showing the top 2 of ${e.seriesCount} series — for full multi-series comparison use LineChart`),t},buildProps:e=>{var t,n,o;const i=e.primary.x,r=e.primary.y,a=e.primary.series,s=e=>null!=e&&(e+"").length>0,l=new Map;for(const n of e.data){const e=n[a];if(!s(e))continue;const o=e+"",i=Number(n[r]);l.set(o,(null!==(t=l.get(o))&&void 0!==t?t:0)+(Number.isFinite(i)?i:0))}const c=[...l.entries()].sort((e,t)=>t[1]-e[1]),u=null===(n=c[0])||void 0===n?void 0:n[0],d=null===(o=c[1])||void 0===o?void 0:o[0],h=e=>e instanceof Date?e.getTime():e,g=new Map;for(const t of e.data){const e=t[a];if(!s(e))continue;const n=e+"";if(n!==u&&n!==d)continue;const o=t[i],l=t[r],c=h(o);let f=g.get(c);f||(f={[i]:o},g.set(c,f)),n===u?f.a=l:n===d&&(f.b=l)}return{data:Array.from(g.values()).filter(e=>null!=e.a&&null!=e.b),xAccessor:i,seriesAAccessor:"a",seriesBAccessor:"b",seriesALabel:u,seriesBLabel:d}}},ym={component:"CandlestickChart",family:"time-series",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>{if(4>e.rowCount)return"needs at least 4 rows";if(!e.primary.x)return"needs an x field (typically date)";const t=new Set(Object.keys(e.fields).map(e=>e.toLowerCase())),n=t.has("high"),o=t.has("low");return n&&o?null:"needs at minimum high/low fields (open/close optional)"},intentScores:{"change-detection":4,trend:3,"outlier-detection":3},buildProps:e=>{const t=Object.keys(e.fields),n=e=>t.find(t=>t.toLowerCase()===e);return{data:e.data,xAccessor:e.primary.x,highAccessor:n("high"),lowAccessor:n("low"),openAccessor:n("open"),closeAccessor:n("close")}}},mm={component:"Heatmap",family:"relationship",importPath:"semiotic/xy",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>{var t;if(4>e.rowCount)return"needs at least 4 cells";if(!e.primary.y)return"needs a numeric value to encode in cell color";const n=e.candidates.category.length;return n>=2||n>=1&&e.hasTimeAxis?(null!==(t=e.uniqueXCount)&&void 0!==t?t:0)>50?"too many x cells for a legible heatmap":null:"needs two categorical-or-time dimensions for the axes"},intentScores:{correlation:3,distribution:2,"compare-categories":e=>2>e.candidates.category.length?1:4,"composition-over-time":e=>e.hasTimeAxis&&e.candidates.category.length>=1?4:1},caveats:e=>{var t;const n=[];return(null!==(t=e.uniqueXCount)&&void 0!==t?t:0)>30&&n.push("many x values — cells will be narrow"),n},variants:[{key:"default",label:"Sequential color",props:{},tags:["sequential"]},{key:"show-values",label:"With cell labels",props:{showValues:!0},tags:["labeled"],intentDeltas:{"compare-categories":1},rubricDeltas:{precision:1},caveats:["cell labels crowd dense matrices"]}],buildProps:(e,t)=>{var n,o,i,r;const a=e.candidates.category.map(e=>e.field),s=null!==(n=e.primary.time)&&void 0!==n?n:a[0],l=null!==(i=null!==(o=a.find(e=>e!==s))&&void 0!==o?o:a[0])&&void 0!==i?i:e.primary.series;return Object.assign({data:e.data,xAccessor:s,yAccessor:l,valueAccessor:e.primary.y},null!==(r=null==t?void 0:t.props)&&void 0!==r?r:{})},scaleFit:rm({rows:{sweetSpot:[100,1e4],caveatBelow:25,caveatAbove:5e4}})},vm=/(^|[^a-z])(date|time|timestamp|month|week|day|year|quarter|qtr|hour|minute)(?=[^a-z]|$)/i,bm=/^(jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec|january|february|march|april|june|july|august|september|october|november|december|mon|tue|wed|thu|fri|sat|sun|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i,xm=/^(\d{4}(-\d{1,2}(-\d{1,2})?)?|q[1-4]|week\s*\d+|wk\s*\d+|\d{1,2}:\d{2})$/i,wm={component:"BarChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:5,accuracy:5,precision:4},fits:e=>{var t,n;return e.primary.category?e.primary.y?1>(null!==(t=e.categoryCount)&&void 0!==t?t:0)?"needs at least 1 category":(null!==(n=e.categoryCount)&&void 0!==n?n:0)>50?"too many categories — consider aggregating or use a different chart":null:"needs a numeric value field":"needs a category field"},intentScores:{"compare-categories":e=>e.categoryCount?2>e.candidates.category.length?10>e.rowCount/e.categoryCount?5:2:3:0,rank:5,"part-to-whole":e=>{var t;return(null!==(t=e.categoryCount)&&void 0!==t?t:0)>8?2:3},distribution:1},caveats:e=>{const t=[];return function(e){const t=e.primary.category;if(!t)return!1;const n=t.replace(/([a-z])([A-Z])/g,"$1 $2");if(vm.test(n))return!0;const o=e.data;if(!o||0===o.length)return!1;let i=0,r=0;for(const e of o){const n=e[t];if(null==n)continue;r++;const o=(n+"").trim();(bm.test(o)||xm.test(o))&&i++}return r>0&&i/r>=.6}(e)&&t.push("category axis looks like time bins — for a time series, supply real dates and use LineChart/AreaChart (reads trend, scales the time axis); for streaming counts use a temporal histogram"),t},variants:[{key:"sorted-desc",label:"Ranked",props:{sort:"desc"},tags:["sorted","ranked"],intentDeltas:{rank:0,"compare-categories":0}},{key:"source-order",label:"Source order",props:{sort:!1},tags:["source-order"],intentDeltas:{rank:-2}},{key:"horizontal",label:"Horizontal bars",props:{orientation:"horizontal",sort:"desc"},tags:["horizontal","ranked"],intentDeltas:{rank:1},rubricDeltas:{precision:1}},{key:"annotated-threshold",label:"With alert threshold",description:'A target/threshold reference turns the bars into an alert — read for which categories breach. Pair with a provenanced annotation (e.g. from the data-quality bridge) and the communicative act becomes "alerting".',props:{showGrid:!0},tags:["alert","annotated-threshold","monitoring"],intentDeltas:{"outlier-detection":2}}],buildProps:(e,t)=>{var n;return Object.assign({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y},null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})},scaleFit:rm({cardinality:{sweetSpot:[3,15],caveatAbove:25},rows:{sweetSpot:[3,200]}})},km={component:"GroupedBarChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:5,precision:4},fits:e=>{var t,n,o;return e.primary.category?e.primary.y?e.primary.series?2>(null!==(t=e.seriesCount)&&void 0!==t?t:0)?"needs 2+ groups":(null!==(n=e.seriesCount)&&void 0!==n?n:0)>6?e.seriesCount+" groups is too many for grouped bars":(null!==(o=e.categoryCount)&&void 0!==o?o:0)>25?"too many categories for grouped bars":null:"needs a series field to group by":"needs a numeric value field":"needs a category field"},intentScores:{"compare-categories":5,"compare-series":4,rank:3},buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y,groupBy:e.primary.series,colorBy:e.primary.series})},Am={component:"StackedBarChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:4,precision:3},fits:e=>{var t,n;return e.primary.category?e.primary.y?e.primary.series?2>(null!==(t=e.seriesCount)&&void 0!==t?t:0)?"needs 2+ stack groups":(null!==(n=e.seriesCount)&&void 0!==n?n:0)>8?e.seriesCount+" stacked groups is too many":null:"needs a series field to stack by":"needs a numeric value field":"needs a category field"},intentScores:{"part-to-whole":4,"compare-categories":4,"composition-over-time":e=>e.hasTimeAxis?3:1,"compare-series":2},caveats:()=>["only the bottom segment shares a baseline; others are harder to compare across categories"],variants:[{key:"absolute",label:"Absolute stacks",props:{normalize:!1},tags:["absolute"]},{key:"normalized",label:"100% stacked",description:"Each bar normalized to 1 — emphasizes composition, hides totals.",props:{normalize:!0},tags:["normalized","part-to-whole"],intentDeltas:{"part-to-whole":1,"compare-categories":-1},caveats:["absolute magnitudes are no longer comparable across bars"]}],buildProps:(e,t)=>{var n;return Object.assign({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y,stackBy:e.primary.series,colorBy:e.primary.series},null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})}},Sm={component:"DotPlot",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:3,accuracy:5,precision:5},fits:e=>{var t;return e.primary.category?e.primary.y?(null!==(t=e.categoryCount)&&void 0!==t?t:0)>30?"too many categories for a dot plot":null:"needs a numeric value field":"needs a category field"},intentScores:{"compare-categories":e=>e.categoryCount?10>e.rowCount/e.categoryCount?5:3:0,rank:5,"outlier-detection":3},buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y}),scaleFit:rm({cardinality:{sweetSpot:[10,30],caveatAbove:40},rows:{sweetSpot:[5,300]}})},Cm={component:"PieChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:5,accuracy:3,precision:2},fits:e=>{var t;if(!e.primary.category)return"needs a category field";if(!e.primary.y)return"needs a numeric value field";const n=null!==(t=e.categoryCount)&&void 0!==t?t:0;return 2>n?"needs 2+ categories":n>8?n+" slices is too many for a pie chart":null},intentScores:{"part-to-whole":4,"compare-categories":2,rank:1},caveats:()=>["angle comparisons are less accurate than length — prefer a bar chart unless part-to-whole is the explicit message"],variants:[{key:"pie",label:"Pie",props:{},tags:["pie"]},{key:"donut",label:"Donut",description:"Hollow center — easier to fit a label or KPI inside.",props:{innerRadius:60},tags:["donut"]}],buildProps:(e,t)=>{var n;return Object.assign({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y},null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})},scaleFit:rm({cardinality:{sweetSpot:[2,5],caveatAbove:6}})},Om={component:"DonutChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:3,precision:2},fits:e=>{var t;if(!e.primary.category)return"needs a category field";if(!e.primary.y)return"needs a numeric value field";const n=null!==(t=e.categoryCount)&&void 0!==t?t:0;return 2>n?"needs 2+ categories":n>8?n+" slices is too many for a donut":null},intentScores:{"part-to-whole":4,"compare-categories":2},buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y,innerRadius:40})},_m=/(stage|step|funnel|status|outcome|phase)/i,jm={component:"FunnelChart",family:"flow",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:3,precision:3},fits:e=>e.primary.y?Object.keys(e.fields).find(e=>_m.test(e))?null:"needs a stage/step/funnel-named field":"needs a numeric value field",intentScores:{flow:4,rank:3,"part-to-whole":2},caveats:()=>["readers infer conversion drop-off — make sure rows actually represent sequential stages"],buildProps:e=>{const t=Object.keys(e.fields).find(e=>_m.test(e));return Object.assign({data:e.data,stepAccessor:t,valueAccessor:e.primary.y},e.primary.category&&e.primary.category!==t?{categoryAccessor:e.primary.category}:{})}},Pm={component:"GaugeChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:2,precision:2},fits:e=>e.rowCount>1?"GaugeChart shows a single value — provide a 1-row dataset or use BarChart":e.primary.y?null:"needs a numeric value",intentScores:{"compare-categories":1,rank:1,"part-to-whole":e=>1===e.rowCount?5:1},caveats:()=>["gauges only show a single value; consider a stat card or bar instead for comparison"],buildProps:e=>{const t=e.primary.y,n=e.data[0],o=n?Number(n[t]):0,i=e.fields[t],r="numeric"===(null==i?void 0:i.type)?i.max:100;return{value:Number.isFinite(o)?o:0,min:0,max:r}},scaleFit:(e,t)=>"tiny"===t.rowBand?{delta:.6,reason:"designed for single-value displays"}:null},Mm=/(rating|score|likert|satisfaction|nps|agree|sentiment|level)/i,Lm={component:"LikertChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>e.primary.category?e.primary.y?Object.keys(e.fields).find(e=>Mm.test(e))?null:"needs an ordinal rating/level field (rating, score, level...)":"needs a numeric rating/count field":"needs a category (question) field",intentScores:{"compare-categories":4,distribution:3,"part-to-whole":3},buildProps:e=>{const t=Object.keys(e.fields).find(e=>Mm.test(e));return{data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y,levelAccessor:t,levels:["Very Low","Low","Neutral","High","Very High"]}}},Tm={component:"SwimlaneChart",family:"categorical",importPath:"semiotic/ordinal",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>{var t;return e.primary.category?e.primary.series?e.primary.y?2>(null!==(t=e.categoryCount)&&void 0!==t?t:0)?"needs 2+ categories":null:"needs a numeric value field":"needs a sub-category (lane) field":"needs a category field"},intentScores:{"compare-categories":4,"composition-over-time":e=>e.hasTimeAxis?3:1,"compare-series":3},buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,subcategoryAccessor:e.primary.series,valueAccessor:e.primary.y,colorBy:e.primary.series})},$m={component:"Histogram",family:"distribution",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:4,precision:3},fits:e=>{if(10>e.rowCount)return"histograms need at least ~10 observations";if(!e.primary.y)return"needs a numeric field to bin";const t=e.primary.y,n=e.candidates.y.find(e=>e.field===t);return void 0!==(null==n?void 0:n.distinctCount)&&6>n.distinctCount?"too few distinct numeric values; a bar chart of counts is a better fit":null},intentScores:{distribution:5,"outlier-detection":3,"compare-categories":1},variants:[{key:"count-bins",label:"Count bins",props:{bins:10,relative:!1},tags:["count"]},{key:"share-bins",label:"Share bins (relative)",props:{bins:10,relative:!0},tags:["share"],intentDeltas:{distribution:0}}],buildProps:(e,t)=>{var n;return Object.assign({data:e.data,valueAccessor:e.primary.y},null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})}},Nm={component:"BoxPlot",family:"distribution",importPath:"semiotic/ordinal",rubric:{familiarity:4,accuracy:4,precision:3},fits:e=>{var t;return e.primary.y?e.primary.category?3>e.rowCount/Math.max(null!==(t=e.categoryCount)&&void 0!==t?t:1,1)?"needs 3+ observations per category":null:"needs a category to split distributions":"needs a numeric field"},intentScores:{distribution:5,"compare-categories":4,"outlier-detection":4},buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y})},Dm={component:"SwarmPlot",family:"distribution",importPath:"semiotic/ordinal",rubric:{familiarity:3,accuracy:4,precision:4},fits:e=>{var t;return e.primary.y?e.primary.category?4>e.rowCount/Math.max(null!==(t=e.categoryCount)&&void 0!==t?t:1,1)?"needs 4+ observations per category":e.rowCount>2e3?"too many points for a swarm — consider a violin or box":null:"needs a category":"needs a numeric field"},intentScores:{distribution:4,"outlier-detection":5,"compare-categories":3},buildProps:e=>Object.assign({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y},e.primary.series&&e.primary.series!==e.primary.category?{colorBy:e.primary.series}:{})},Bm={component:"ViolinPlot",family:"distribution",importPath:"semiotic/ordinal",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>{var t;return e.primary.y?e.primary.category?6>e.rowCount/Math.max(null!==(t=e.categoryCount)&&void 0!==t?t:1,1)?"needs 6+ observations per category":null:"needs a category to split distributions":"needs a numeric field"},intentScores:{distribution:5,"compare-categories":4},variants:[{key:"density",label:"Density only",props:{showIQR:!1},tags:["density"]},{key:"density-iqr",label:"Density with IQR",props:{showIQR:!0},tags:["density","iqr"],intentDeltas:{distribution:0},rubricDeltas:{precision:1}}],buildProps:(e,t)=>{var n;return Object.assign({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y},null!==(n=null==t?void 0:t.props)&&void 0!==n?n:{})}},Im={component:"RidgelinePlot",family:"distribution",importPath:"semiotic/ordinal",rubric:{familiarity:2,accuracy:3,precision:3},fits:e=>{var t,n;return e.primary.y?e.primary.category?3>(null!==(t=e.categoryCount)&&void 0!==t?t:0)?"needs 3+ categories to make a ridgeline meaningful":6>e.rowCount/Math.max(null!==(n=e.categoryCount)&&void 0!==n?n:1,1)?"needs 6+ observations per category":null:"needs a category dimension to stack distributions":"needs a numeric field"},intentScores:{distribution:4,"compare-categories":3,"composition-over-time":2},caveats:()=>["readers can confuse overlapping ridges — limit categories or use small multiples"],buildProps:e=>({data:e.data,categoryAccessor:e.primary.category,valueAccessor:e.primary.y})},Rm={component:"ForceDirectedGraph",family:"network",importPath:"semiotic/network",rubric:{familiarity:3,accuracy:3,precision:3},fits:e=>e.hasNetwork&&e.network?2>e.network.nodes.length?"needs at least 2 nodes":1>e.network.edges.length?"needs at least 1 edge":null:"needs a {nodes, edges} network passed via rawInput",intentScores:{flow:3,correlation:2},caveats:e=>{var t,n;return(null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes.length)&&void 0!==n?n:0)>500?["large graphs become hairballs — consider filtering or aggregating"]:[]},buildProps:e=>{var t,n,o,i;return{nodes:null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes)&&void 0!==n?n:[],edges:null!==(i=null===(o=e.network)||void 0===o?void 0:o.edges)&&void 0!==i?i:[],nodeIdAccessor:"id",sourceAccessor:"source",targetAccessor:"target"}},scaleFit:e=>{var t,n;const o=null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes.length)&&void 0!==n?n:0;return 5>o?{delta:-.4,caveats:[`only ${o} nodes — force layout is overkill for this size`]}:o>100?o>300?{delta:-.8,caveats:[o+" nodes — expect a hairball; filter or aggregate before rendering"]}:{delta:0}:{delta:.5,reason:o+" nodes is in the readable range for force layout"}}},Fm={component:"SankeyDiagram",family:"flow",importPath:"semiotic/network",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>e.hasNetwork&&e.network?2>e.network.edges.length?"needs 2+ weighted edges":null:"needs a {nodes, edges} network with edge weights",intentScores:{flow:5,"part-to-whole":3},buildProps:e=>{var t,n,o,i;return{nodes:null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes)&&void 0!==n?n:[],edges:null!==(i=null===(o=e.network)||void 0===o?void 0:o.edges)&&void 0!==i?i:[],sourceAccessor:"source",targetAccessor:"target",valueAccessor:"value",nodeIdAccessor:"id"}}},Em={component:"ChordDiagram",family:"flow",importPath:"semiotic/network",rubric:{familiarity:2,accuracy:3,precision:2},fits:e=>e.hasNetwork&&e.network?3>e.network.nodes.length?"needs 3+ nodes":3>e.network.edges.length?"needs 3+ edges":null:"needs a {nodes, edges} network",intentScores:{flow:4},caveats:()=>["chord diagrams trade accuracy for symmetry; use Sankey if direction matters"],buildProps:e=>{var t,n,o,i;return{nodes:null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes)&&void 0!==n?n:[],edges:null!==(i=null===(o=e.network)||void 0===o?void 0:o.edges)&&void 0!==i?i:[],valueAccessor:"value"}}},Hm={component:"ProcessSankey",family:"flow",importPath:"semiotic/network",rubric:{familiarity:2,accuracy:4,precision:3},fits:e=>{if(!e.hasNetwork||!e.network)return"needs a {nodes, edges} network";const t=e.network.edges[0];return t?void 0===t.startTime&&void 0===t.start||void 0===t.endTime&&void 0===t.end?"edges need both startTime and endTime (or start/end) for a temporal sankey":null:"needs at least one edge with start/end times"},intentScores:{flow:5,"composition-over-time":4,"change-detection":3},buildProps:e=>{var t,n,o,i,r;const a={nodes:null!==(n=null===(t=e.network)||void 0===t?void 0:t.nodes)&&void 0!==n?n:[],edges:null!==(i=null===(o=e.network)||void 0===o?void 0:o.edges)&&void 0!==i?i:[],pairing:"temporal",laneOrder:"crossing-min"},s=null===(r=e.network)||void 0===r?void 0:r.edges[0];return s&&(void 0===s.startTime&&void 0!==s.start&&(a.startTimeAccessor="start"),void 0===s.endTime&&void 0!==s.end&&(a.endTimeAccessor="end")),a}},zm={component:"TreeDiagram",family:"hierarchy",importPath:"semiotic/network",rubric:{familiarity:4,accuracy:4,precision:3},fits:e=>e.hasHierarchy&&e.hierarchy?null:"needs a hierarchical root (object with children) via rawInput",intentScores:{hierarchy:5},variants:[{key:"vertical-tree",label:"Vertical tree",props:{layout:"tree",orientation:"vertical"},tags:["vertical"]},{key:"horizontal-cluster",label:"Horizontal cluster",props:{layout:"cluster",orientation:"horizontal"},tags:["horizontal"]}],buildProps:(e,t)=>{var n,o;return Object.assign({data:null!==(n=e.hierarchy)&&void 0!==n?n:{name:"root",children:[]}},null!==(o=null==t?void 0:t.props)&&void 0!==o?o:{})}};function Wm(e){if(!e||"object"!=typeof e)return 0;const t=e.children;return Array.isArray(t)&&t.length>0?t.reduce((e,t)=>e+Wm(t),0):1}const Gm={component:"Treemap",family:"hierarchy",importPath:"semiotic/network",rubric:{familiarity:4,accuracy:3,precision:3},fits:e=>e.hasHierarchy&&e.hierarchy?4>e.rowCount?"declared scale is too small to render a hierarchy meaningfully":null:"needs a hierarchical root with values",intentScores:{hierarchy:4,"part-to-whole":e=>e.hasHierarchy?5:4,"compare-categories":3},caveats:()=>["rectangle area comparisons are less precise than length — prefer a bar chart for ranking"],buildProps:e=>{var t;return{data:null!==(t=e.hierarchy)&&void 0!==t?t:{name:"root",children:[]},valueAccessor:"value"}},scaleFit:(e,t)=>{const n=Wm(e.hierarchy);let o=0;const i=[];let r;return 5>n?(o-=.5,i.push(`only ${n} leaves — treemap needs more cells to show structure`)):n>100?n>500&&(o-=.7,i.push(n+" leaves — most tiles will be sub-pixel; prefer aggregation or zoomable treatment")):(o+=.4,r=n+" leaves is in the legible band for treemap"),"huge"===t.rowBand&&(o-=.5,i.push("at huge declared scale a stacked or matrix view aggregates better than hierarchical browsing")),{delta:o,reason:r,caveats:i}}},Ym={component:"CirclePack",family:"hierarchy",importPath:"semiotic/network",rubric:{familiarity:3,accuracy:3,precision:2},fits:e=>e.hasHierarchy&&e.hierarchy?null:"needs a hierarchical root with values",intentScores:{hierarchy:4,"part-to-whole":3},caveats:()=>["circle area is harder to compare than rectangle area"],buildProps:e=>{var t;return{data:null!==(t=e.hierarchy)&&void 0!==t?t:{name:"root",children:[]},valueAccessor:"value"}}},qm={component:"OrbitDiagram",family:"hierarchy",importPath:"semiotic/network",rubric:{familiarity:1,accuracy:2,precision:2},fits:e=>e.hasHierarchy&&e.hierarchy?null:"needs a hierarchical root",intentScores:{hierarchy:3},caveats:()=>["decorative — readers without context will not infer hierarchy easily"],buildProps:e=>{var t;return{data:null!==(t=e.hierarchy)&&void 0!==t?t:{name:"root",children:[]},orbitMode:"solar"}}},Vm={component:"ChoroplethMap",family:"geo",importPath:"semiotic/geo",rubric:{familiarity:4,accuracy:3,precision:2},fits:e=>e.hasGeo&&e.geo?2>e.geo.features.length?"needs at least 2 area features to compare":null:"needs a GeoJSON FeatureCollection via rawInput",intentScores:{geo:5,"compare-categories":3},caveats:()=>["large areas dominate visual weight regardless of measurement"],buildProps:e=>{var t,n,o;return{areas:null!==(n=null===(t=e.geo)||void 0===t?void 0:t.features)&&void 0!==n?n:[],valueAccessor:null!==(o=e.primary.y)&&void 0!==o?o:"value"}}},Xm={component:"ProportionalSymbolMap",family:"geo",importPath:"semiotic/geo",rubric:{familiarity:3,accuracy:3,precision:3},fits:e=>{var t,n,o;return e.hasGeo&&e.geo?(null!==(n=null===(t=e.geo.points)||void 0===t?void 0:t.length)&&void 0!==n?n:0)>0||0!==(null!==(o=e.geo.features.length)&&void 0!==o?o:0)?null:"needs points or area features":"needs a GeoJSON FeatureCollection (with points or area centroids)"},intentScores:{geo:4,rank:3,"compare-categories":3},buildProps:e=>{var t,n,o,i,r;return{points:null!==(n=null===(t=e.geo)||void 0===t?void 0:t.points)&&void 0!==n?n:[],areas:null!==(i=null===(o=e.geo)||void 0===o?void 0:o.features)&&void 0!==i?i:void 0,xAccessor:"lon",yAccessor:"lat",sizeBy:null!==(r=e.primary.size)&&void 0!==r?r:"value"}}},Um={component:"FlowMap",family:"geo",importPath:"semiotic/geo",rubric:{familiarity:2,accuracy:3,precision:2},fits:e=>{var t,n;return e.hasGeo&&e.geo?(null===(t=e.geo.flows)||void 0===t?void 0:t.length)?(null===(n=e.geo.points)||void 0===n?void 0:n.length)?null:"needs point nodes with lat/lon":"needs flow records (source/target/value)":"needs a geo dataset"},intentScores:{geo:4,flow:5},buildProps:e=>{var t,n,o,i;return{flows:null!==(n=null===(t=e.geo)||void 0===t?void 0:t.flows)&&void 0!==n?n:[],nodes:null!==(i=null===(o=e.geo)||void 0===o?void 0:o.points)&&void 0!==i?i:[],valueAccessor:"value"}}},Km={component:"DistanceCartogram",family:"geo",importPath:"semiotic/geo",rubric:{familiarity:1,accuracy:3,precision:3},fits:e=>{var t;return e.hasGeo&&e.geo?(null===(t=e.geo.points)||void 0===t?void 0:t.length)?null:"needs point nodes with lat/lon and a cost field":"needs a geo dataset"},intentScores:{geo:3,rank:3,"compare-categories":2},caveats:()=>["non-standard projection — requires explanation for most readers"],buildProps:e=>{var t,n;return{points:null!==(n=null===(t=e.geo)||void 0===t?void 0:t.points)&&void 0!==n?n:[],costAccessor:"cost"}}},Qm={component:"BigNumber",family:"value",importPath:"semiotic/value",rubric:{familiarity:5,accuracy:5,precision:5},fits:e=>e.primary.y||e.primary.size||0!==e.candidates.y.length?e.rowCount>50?"BigNumber shows a single focal value — pass scalar data, or use a chart family for >50 rows":null:"needs a numeric value to display",intentScores:{trend:e=>e.hasTimeAxis||"named"===e.xProvenance||e.monotonicX?e.rowCount>8?1:3:0,"compare-categories":1,rank:1,"part-to-whole":e=>1===e.rowCount?5:1,"change-detection":e=>e.hasTimeAxis||"named"===e.xProvenance||e.monotonicX?e.rowCount>8?1:4:0},caveats:e=>{const t=[];return e.rowCount>1&&t.push("BigNumber renders the latest row's value as the focal number; earlier rows feed an optional sparkline"),t},buildProps:e=>{var t,n,o;const i=null!==(n=null!==(t=e.primary.y)&&void 0!==t?t:e.primary.size)&&void 0!==n?n:null===(o=e.candidates.y[0])||void 0===o?void 0:o.field;if(!i)return{value:0};const r=e.data,a=r.length>0?r[r.length-1]:null,s=a?Number(a[i]):0,l={value:Number.isFinite(s)?s:0,label:i};if(r.length>=2){const e=Number(r[r.length-2][i]);Number.isFinite(e)&&(l.comparison={value:e,label:"vs previous"})}return l},scaleFit:(e,t)=>"tiny"===t.rowBand?{delta:.8,reason:"single-value displays beat charts when there is one number to show"}:"small"===t.rowBand?{delta:.2,reason:"the latest value with a trend spark is often more legible than a chart at small scale"}:null},Zm=[am,sm,lm,cm,um,dm,hm,gm,fm,pm,ym,mm,wm,km,Am,Sm,Cm,Om,jm,Pm,Lm,Tm,$m,Nm,Dm,Bm,Im,Rm,Fm,Em,Hm,zm,Gm,Ym,qm,Vm,Xm,Um,Km,Qm],Jm=new Map;function ev(e){Jm.set(e.component,e)}function tv(e){Jm.delete(e)}function nv(){if(0===Jm.size)return Zm;const e=new Map;for(const t of Zm)e.set(t.component,t);for(const[t,n]of Jm)e.set(t,n);return Array.from(e.values())}function ov(e){return nv().find(t=>t.component===e)}const iv=new Set(["perceivable.content-only-visual","perceivable.color-alone","assistive.data-density","assistive.human-readable-numbers","assistive.skippable-navigation","compromising.table","compromising.navigable-structure"]),rv={"screen-reader":"a screen reader",sonified:"sonification",agent:"an AI reader"};function av(e,t){if("visual"===t)return{delta:0,caveats:[]};let n=0;const o=[],i=[];for(const t of e.findings){if(!iv.has(t.id))continue;let e=0;"fail"===t.status?e=t.critical?1.2:.8:"warn"===t.status&&(e=.4),e>0&&(n-=e,o.push(t.heuristic.charAt(0).toLowerCase()+t.heuristic.slice(1)),i.push(t.message))}return 0===o.length?{delta:0,caveats:[]}:{delta:Math.max(-3,n),reason:`Harder to receive via ${rv[t]}: ${o.slice(0,3).join("; ")}`,caveats:i}}function sv(e,t,n,o,i){var r,a,s;if(!o)return{score:e,rubric:t};const l=null===(r=o.familiarity)||void 0===r?void 0:r[n],c=null!=l?l:t.familiarity,u=null===(a=o.targets)||void 0===a?void 0:a[n];let d,h,g=0;if(void 0!==l&&(g+=.5*(l-3)),u){const e=Math.max(1,Math.min(3,null!==(s=u.weight)&&void 0!==s?s:1));g+=1*("increase"===u.direction?1:-1)*e,d=u.reason?`${o.name?o.name+": ":""}${u.reason}`:`${o.name?o.name+" ":""}target: ${u.direction} ${n}`}const f=o.receptionModality;return i&&f&&"visual"!==f&&(g+=i.delta,h=i.reason),{score:e+g,rubric:Object.assign(Object.assign({},t),{familiarity:c}),appliedReason:d,receivabilityReason:h}}function lv(e,t,n){var o,i;return n&&null!==(i=null===(o=n.familiarity)||void 0===o?void 0:o[e])&&void 0!==i?i:t}function cv(e){return e&&2===e.exposureLevel?4:3}function uv(e,t){if(void 0===e)return 0;const n="function"==typeof e?e(t):e;return Number.isFinite(n)?Math.max(0,Math.min(5,n)):0}function dv(e,t){var n;if(!(null==t?void 0:t.intentDeltas))return e;const o=Object.assign({},e);for(const[e,i]of Object.entries(t.intentDeltas)){const t=null!==(n=o[e])&&void 0!==n?n:0;o[e]=Math.max(0,Math.min(5,t+i))}return o}function hv(e,t){var n,o,i;return(null==t?void 0:t.rubricDeltas)?function(e){const t=e=>Math.max(1,Math.min(5,Math.round(e)));return{familiarity:t(e.familiarity),accuracy:t(e.accuracy),precision:t(e.precision)}}({familiarity:e.familiarity+(null!==(n=t.rubricDeltas.familiarity)&&void 0!==n?n:0),accuracy:e.accuracy+(null!==(o=t.rubricDeltas.accuracy)&&void 0!==o?o:0),precision:e.precision+(null!==(i=t.rubricDeltas.precision)&&void 0!==i?i:0)}):e}function gv(e,t,n,o){var i;const r=[],a=o.map(e=>{var t;return{intent:e,score:null!==(t=n[e])&&void 0!==t?t:0}}).filter(e=>e.score>=3).sort((e,t)=>t.score-e.score).slice(0,2);for(const{intent:e,score:t}of a)r.push(`Strong fit for ${e} (${t}/5)`);return t.primary.x&&t.primary.y&&r.push(`x = ${t.primary.x}, y = ${t.primary.y}`),t.seriesCount&&t.seriesCount>1&&r.push(`${t.seriesCount} series detected on field "${null!==(i=t.primary.series)&&void 0!==i?i:"series"}"`),r}function fv(e,t){var n;if(0===t.length){const t=Object.values(e).filter(e=>"number"==typeof e&&e>0);return 0===t.length?0:t.reduce((e,t)=>e+t,0)/t.length}let o=0;for(const i of t)o+=null!==(n=e[i])&&void 0!==n?n:0;return o/t.length}function pv(e,t={}){var n,o,i,r,a,s,l;const c=null!==(n=t.profile)&&void 0!==n?n:qy(null!=e?e:[],{rawInput:t.rawInput,seriesField:t.seriesField}),u=null!==(o=t.capabilities)&&void 0!==o?o:nv(),d=t.intent?Array.isArray(t.intent)?t.intent:[t.intent]:[],h=!1!==t.includeVariants,g=null!==(i=t.minScore)&&void 0!==i?i:0,f=null!==(r=t.maxResults)&&void 0!==r?r:10,p=t.allow?new Set(t.allow):null,y=t.deny?new Set(t.deny):null,m=null===(a=t.audience)||void 0===a?void 0:a.receptionModality,v=void 0!==m&&"visual"!==m,b=nm(c,t.scale),x=void 0!==t.scale&&b.rows!==c.rowCount?Object.assign(Object.assign({},c),{rowCount:b.rows}):c,w=[];for(const e of u){if(p&&!p.has(e.component))continue;if(y&&y.has(e.component))continue;if(null!==e.fits(x))continue;const n={};for(const[t,o]of Object.entries(e.intentScores))n[t]=uv(o,x);const o=e.caveats?Array.from(e.caveats(x)):[],i=h&&e.variants&&e.variants.length>0?e.variants:[void 0];for(const r of i){const i=dv(n,r),a=fv(i,d),u=hv(e.rubric,r),h=e.buildProps(c,r);let f;v&&(f=av(iy(e.component,h),m));const p=sv(a,u,e.component,t.audience,f),y=im(e,x,b,t.scale,t.quality);if(y.excluded)continue;const k=p.score+y.delta;if(g>k)continue;const A=gv(0,x,i,d);p.appliedReason&&A.push(p.appliedReason),p.receivabilityReason&&A.push(p.receivabilityReason);for(const e of y.reasons)A.push(e);const S=[...o,...null!==(s=null==r?void 0:r.caveats)&&void 0!==s?s:[],...y.caveats,...null!==(l=null==f?void 0:f.caveats.slice(0,3))&&void 0!==l?l:[]];w.push({component:e.component,family:e.family,importPath:e.importPath,variant:r,score:k,intentScores:i,rubric:p.rubric,reasons:A,caveats:S,props:h,scaleRange:{band:b.rowBand,cardinalityBand:b.cardinalityBand,rows:b.rows,rowsSource:b.rowsSource}})}}w.sort((e,t)=>t.score!==e.score?t.score-e.score:t.rubric.accuracy!==e.rubric.accuracy?t.rubric.accuracy-e.rubric.accuracy:t.rubric.familiarity-e.rubric.familiarity);const k=new Set;return w.filter(e=>{const t=`${e.component}:${e.score.toFixed(4)}`;return!k.has(t)&&(k.add(t),!0)}).slice(0,f)}function yv(e,t={}){var n,o;const i=null!==(n=t.profile)&&void 0!==n?n:qy(null!=e?e:[],{rawInput:t.rawInput,seriesField:t.seriesField}),r=null!==(o=t.capabilities)&&void 0!==o?o:nv(),a=t.allow?new Set(t.allow):null,s=t.deny?new Set(t.deny):null,l=nm(i,t.scale),c=void 0!==t.scale&&l.rows!==i.rowCount?Object.assign(Object.assign({},i),{rowCount:l.rows}):i,u=[];for(const e of r){if(a&&!a.has(e.component))continue;if(s&&s.has(e.component))continue;const t=e.fits(c);null!==t&&u.push({component:e.component,family:e.family,importPath:e.importPath,reason:t})}return{fitting:pv(e,Object.assign(Object.assign({},t),{profile:i})),rejected:u,profile:i}}function mv(e,t,n={}){var o,i,r;const a=nv().find(t=>t.component===e);if(!a)return{reason:`No capability registered for "${e}"`};const s=null!==(o=n.profile)&&void 0!==o?o:qy(null!=t?t:[]),l=a.fits(s);if(null!==l)return{reason:l};const c=n.variantKey?null===(i=a.variants)||void 0===i?void 0:i.find(e=>e.key===n.variantKey):void 0,u=n.intent?Array.isArray(n.intent)?n.intent:[n.intent]:[],d={};for(const[e,t]of Object.entries(a.intentScores))d[e]=uv(t,s);const h=dv(d,c),g=fv(h,u),f=hv(a.rubric,c),p=gv(0,s,h,u),y=[...a.caveats?a.caveats(s):[],...null!==(r=null==c?void 0:c.caveats)&&void 0!==r?r:[]];return{component:a.component,family:a.family,importPath:a.importPath,variant:c,score:g,intentScores:h,rubric:f,reasons:p,caveats:y,props:a.buildProps(s,c)}}function vv(e,t={}){var n,o,i,r,a,s,l,c,u;const d=null!==(n=t.profile)&&void 0!==n?n:qy(null!=e?e:[],{rawInput:t.rawInput,seriesField:t.seriesField}),h=nm(d,t.scale),g=null!==(i=null!==(o=t.maxPerBand)&&void 0!==o?o:t.maxResults)&&void 0!==i?i:5,f=["tiny","small","medium","large","huge"],p={};for(const n of f){const o=Object.assign(Object.assign({},null!==(r=t.scale)&&void 0!==r?r:{}),{rows:n});p[n]=pv(e,Object.assign(Object.assign({},t),{profile:d,scale:o,maxResults:g}))}return{tiny:null!==(a=p.tiny)&&void 0!==a?a:[],small:null!==(s=p.small)&&void 0!==s?s:[],medium:null!==(l=p.medium)&&void 0!==l?l:[],large:null!==(c=p.large)&&void 0!==c?c:[],huge:null!==(u=p.huge)&&void 0!==u?u:[],effective:h}}function bv(e,t){return null==e?e:e.length>t?e.slice(0,t-1)+"…":e}function xv(e){const{data:t,onQuery:n,initialAnnotations:o,componentName:a,props:s,includeProfile:c,includeSuggestions:u,suggestionsIntent:h,suggestionsMax:g,focus:f}=e,[p,y]=d([]),[m,v]=d([]),[b,x]=d(!1),[w,k]=d(null),A=r(()=>Sy(null!=t?t:[]),[t]),S=c||u,C=r(()=>S?qy(null!=t?t:[]):void 0,[S,t]),O=r(()=>u&&C?pv(t,{profile:C,intent:h,maxResults:null!=g?g:5}):void 0,[u,C,t,h,g]),_=i(n);_.current=n;const j=i(a);j.current=a;const P=i(s);P.current=s;const M=i(t);M.current=t;const L=i(A);L.current=A;const T=i(C);T.current=C;const $=i(O);$.current=O;const N=i(f);N.current=f;const D=l(e=>Js(this,void 0,void 0,function*(){var t,n,o;const i=e.trim();if(!i)return;x(!0),k(null),y(e=>[...e,{role:"user",text:i}]);const r="undefined"!=typeof performance?performance.now():Date.now();fp().record({type:"interrogation-asked",component:j.current,query:bv(i,500)});try{const e=yield _.current(i,{data:null!==(t=M.current)&&void 0!==t?t:[],summary:L.current,profile:T.current,suggestions:$.current,componentName:j.current,props:P.current,focus:null!==(n=N.current)&&void 0!==n?n:void 0});y(t=>[...t,{role:"assistant",text:e.answer}]),e.annotations&&v(e.annotations);const a="undefined"!=typeof performance?performance.now():Date.now();fp().record({type:"interrogation-answered",component:j.current,answer:bv(e.answer,2e3),annotationCount:null===(o=e.annotations)||void 0===o?void 0:o.length,latencyMs:Math.max(0,Math.round(a-r))})}catch(e){k(e instanceof Error?e:Error(e+"")),y(e=>[...e,{role:"assistant",text:"Sorry, I couldn't process that query."}]);const t="undefined"!=typeof performance?performance.now():Date.now();fp().record({type:"interrogation-answered",component:j.current,error:!0,latencyMs:Math.max(0,Math.round(t-r))})}finally{x(!1)}}),[]),B=l(({text:e,annotations:t})=>{const n=e.trim();n&&(y(e=>[...e,{role:"assistant",text:n}]),t&&t.length>0&&v(e=>[...e,...t]))},[]),I=l(()=>{y([]),v([]),k(null)},[]);return{ask:D,announce:B,history:p,summary:A,annotations:r(()=>{const e=null!=o?o:[];return 0===e.length?m:0===m.length?e:[...e,...m]},[o,m]),loading:b,error:w,reset:I}}const wv=["hover","hover-end","click","click-end","selection","selection-end","brush-end"];function kv(e={}){const{chartId:t,types:n=wv}=e,{latest:o}=Ea({chartId:t,types:n,limit:1});return r(()=>{if(!o)return null;if("hover-end"===o.type||"selection-end"===o.type||"brush-end"===o.type||"click-end"===o.type)return null;let e;if("selection"===o.type)e=o.selection.fields;else{if("hover"!==o.type&&"click"!==o.type)return null;e=o.datum}return e&&"object"==typeof e?{datum:e,x:o.x,y:o.y,source:o.type}:null},[o])}function Av(e,t,n={}){var o;const{capability:i,audience:r,locale:a}=n,s=null!==(o=n.levels)&&void 0!==o?o:["l1","l2","l3"],l=!1!==n.includeStructure,c=Sf(e,i),u=$f(e,t,{levels:c?[...s,"l4"]:s,locale:a,capability:i,audience:r}),d=u.levels,{l4:h}=d,g=Zs(d,["l4"]),f=["l1","l2","l3"].map(e=>u.levels[e]).filter(Boolean).join(" "),p=Object.assign({levels:g,text:u.annotations?`${u.annotations} ${f}`.trim():f},u.annotations?{annotations:u.annotations}:{});let y;if(c&&h){const e=(m=i)?"fits"in m||"buildProps"in m?{family:m.family}:{family:m.family,intentScores:m.intentScores}:{};y={act:c,sentence:h,family:e.family,intentScores:e.intentScores}}var m;const v=l?Bf(e,t,{maxLeaves:n.maxLeaves,locale:a}):void 0,b=[p.text,null==y?void 0:y.sentence].filter(Boolean).join(" ");return{component:e,description:p,intent:y,structure:v,text:b}}function Sv(e){var t;if("string"==typeof e)return e;try{return null!==(t=JSON.stringify(e,null,2))&&void 0!==t?t:e+""}catch(t){return e+""}}function Cv(e,t,n){return{role:e,artifact:Object.assign({kind:"text",content:t},n?{filename:n}:{})}}function Ov(e,t,n,o){return{role:e,artifact:Object.assign({kind:"code",content:t,language:n},o?{filename:o}:{})}}function _v(e,t,n={}){var o,i,r,a,s,l,c,u;const d=[],h=!1!==n.includeConfig,g=!1!==n.includeJSX,f=!1!==n.includeGrounding,p=!1!==n.includeDiagnostics,y=!1!==n.includeAccessibility,m=null!==(o=n.filenamePrefix)&&void 0!==o?o:e,v=Rg(e,t,n.config);(null===(i=n.context)||void 0===i?void 0:i.trim())&&d.push(Cv("Analysis context",n.context.trim(),m+".context.md")),h&&d.push(Ov("Semiotic chart config",Sv(v),"json",m+".semiotic-config.json")),g&&d.push(Ov("Semiotic chart JSX",Wg(v),"jsx",m+".semiotic.jsx"));const b=function(e){return null==e?[]:Array.isArray(e)?e:[e]}(null===(r=n.rendered)||void 0===r?void 0:r.image),x=(w=b).length>0?{role:"Rendered chart image",artifact:{kind:"image",images:w}}:null;var w;let k,A,S;return x&&d.push(x),(null===(s=null===(a=n.rendered)||void 0===a?void 0:a.svg)||void 0===s?void 0:s.trim())&&d.push(Ov("Rendered chart SVG",n.rendered.svg.trim(),"svg",m+".rendered.svg")),null!=(null===(l=n.rendered)||void 0===l?void 0:l.evidence)&&d.push(Cv("Semiotic render evidence",[e+": Semiotic render evidence","\n```json",Sv(n.rendered.evidence),"```"].join("\n"),m+".render-evidence.md")),f&&(k=Av(e,t,n.grounding),d.push(Cv("Semiotic reader grounding",function(e){return[e.component+": Semiotic reader grounding","",e.text,"\nStructured grounding JSON:\n```json",Sv(e),"```"].join("\n")}(k),m+".reader-grounding.md"))),p&&(A=Gp(e,t),d.push(Cv("Semiotic config diagnostics",function(e,t){const n=t.diagnoses.filter(e=>"error"===e.severity).length,o=t.diagnoses.filter(e=>"warning"===e.severity).length,i=[e+": Semiotic diagnoseConfig report","ok: "+t.ok,"errors: "+n,"warnings: "+o];if(0===t.diagnoses.length)return i.push("","No Semiotic config issues detected."),i.join("\n");i.push("");for(const e of t.diagnoses)i.push(`[${e.severity}] ${e.code}: ${e.message}`),e.fix&&i.push("Fix: "+e.fix);return i.join("\n")}(e,A),m+".diagnose-config.md"))),y&&(S=iy(e,t,n.accessibility),d.push(Cv("Semiotic accessibility audit",ly(S),m+".accessibility.md"))),(null===(c=n.narrative)||void 0===c?void 0:c.trim())&&d.push(Cv("Author narrative",n.narrative.trim(),m+".narrative.md")),(null===(u=n.additionalStages)||void 0===u?void 0:u.length)&&d.push(...n.additionalStages),0===d.length&&d.push(Ov("Semiotic chart config",Sv(v),"json",m+".semiotic-config.json")),Object.assign(Object.assign(Object.assign({input:{kind:"chain",stages:d},config:v},k?{grounding:k}:{}),A?{diagnosis:A}:{}),S?{accessibility:S}:{})}function jv(e,t,n={}){return _v(e,t,n).input}function Pv(e){if("number"==typeof e)return e;const t=Date.parse(e);return Number.isNaN(t)?void 0:t}function Mv(e,t){var n,o,i;return"pass"===e?null!==(n=t.passColor)&&void 0!==n?n:"var(--semiotic-success)":"warn"===e?null!==(o=t.warnColor)&&void 0!==o?o:"var(--semiotic-warning)":null!==(i=t.failColor)&&void 0!==i?i:"var(--semiotic-danger)"}function Lv(e){if(null==e)return;const t="number"==typeof e?e:Date.parse(e);return Number.isNaN(t)?void 0:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Tv(e){var t,n;const o=null!==(n=null!==(t=e.label)&&void 0!==t?t:e.name)&&void 0!==n?n:e.id;return"number"==typeof e.confidence&&1>e.confidence?`${o} · ${Math.round(100*e.confidence)}%`:o}function $v(e){var t,n;return{author:null!==(t=e.name)&&void 0!==t?t:e.id,authorKind:"system",source:e.source,basis:null!==(n=e.basis)&&void 0!==n?n:"rule",confidence:e.confidence,createdAt:e.createdAt,dataVersion:e.dataVersion,stableId:e.id}}function Nv(e,t={}){var n,o,i,r,a;const s=[],l=[],c=null!==(n=t.valueAxis)&&void 0!==n?n:"y",u=null!==(o=t.status)&&void 0!==o?o:"proposed",d=null!==(i=t.anchor)&&void 0!==i?i:"semantic",h=Object.assign({status:u,anchor:d},void 0!==t.ttlHint?{ttlHint:t.ttlHint}:{});for(const n of e){if("pass"===n.status&&!t.includePassed)continue;const e=Mv(n.status,t),o=Tv(n),i={provenance:$v(n),lifecycle:h},u=e=>l.push({result:n,reason:e}),d=e=>s.push(Qg(e,i));switch(n.kind){case"range":if("number"!=typeof n.min||"number"!=typeof n.max){u("range check is missing numeric min/max bounds");break}d({type:"band",y0:n.min,y1:n.max,fill:e,fillOpacity:.12,color:e,label:o});break;case"min":case"max":case"threshold":{const t=null!==(r=n.value)&&void 0!==r?r:"min"===n.kind?n.min:n.max;if("number"!=typeof t){u(n.kind+" check is missing a numeric value");break}d({type:"x"===c?"x-threshold":"y-threshold",value:t,label:o,color:e});break}case"freshness":{const t=void 0!==n.at?Pv(n.at):void 0;if(void 0===t){u("freshness check has no parseable timestamp (`at`); render as a chart-level status badge");break}d({type:"x-threshold",value:t,label:o,color:e});break}default:u(`${n.kind} check on "${null!==(a=n.column)&&void 0!==a?a:"?"}" has no single chart coordinate; surface it as a chart-level status badge or a row-level mark in your UI`)}}return{annotations:s,unplaced:l}}function Dv(e){switch(e){case"pass":return"pass";case"warn":return"warn";case"fail":return"fail";default:return"error"}}function Bv(e){if(!e)return"dbt check";const t=e.split(".");return t[t.length-1]||e}function Iv(e,t={}){var n,o,i,r,a,s,l;const c=[],u=e.sources;if(null==u?void 0:u.results){const e=null===(n=u.metadata)||void 0===n?void 0:n.generated_at,t=null===(o=u.metadata)||void 0===o?void 0:o.invocation_id;for(const n of u.results){const o=Dv(n.status),r=Bv(n.unique_id),a=Lv(n.max_loaded_at);c.push({id:null!==(i=n.unique_id)&&void 0!==i?i:r,name:"dbt freshness: "+r,label:"pass"===o?r+" fresh":`${r} stale${a?" since "+a:""}`,status:o,kind:"freshness",at:n.max_loaded_at,message:`freshness ${o}${n.max_loaded_at?" — last load "+n.max_loaded_at:""}`,source:"dbt",basis:"rule",createdAt:e,dataVersion:t})}}const d=e.runResults;if(null==d?void 0:d.results){const e=null===(r=d.metadata)||void 0===r?void 0:r.generated_at,n=null===(a=d.metadata)||void 0===a?void 0:a.invocation_id;for(const o of d.results){const i=Dv(o.status);if("pass"===i&&!t.includePassed)continue;const r=Bv(o.unique_id);c.push({id:null!==(s=o.unique_id)&&void 0!==s?s:r,name:"dbt test · "+r,status:i,kind:"custom",message:null!==(l=o.message)&&void 0!==l?l:void 0,observedCount:"number"==typeof o.failures?o.failures:void 0,source:"dbt",basis:"rule",createdAt:e,dataVersion:n})}}return Nv(c,t)}function Rv(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Fv(e){return e.replace(/^expect_/,"").replace(/column_values_to_be_|column_values_to_|column_|to_be_|to_/g," ").replace(/_/g," ").replace(/\s+/g," ").trim()||e}function Ev(e,t={}){var n,o,i,r,a,s;const{createdAt:l,dataVersion:c}=function(e){var t;const n=null==e?void 0:e.run_id;return n?"string"==typeof n?{dataVersion:n}:{createdAt:n.run_time,dataVersion:null!==(t=n.run_name)&&void 0!==t?t:n.run_time}:{}}(e.meta),u=[];for(const[t,d]of(null!==(n=e.results)&&void 0!==n?n:[]).entries()){const e=null!==(o=d.expectation_config)&&void 0!==o?o:{},n=null!==(i=e.expectation_type)&&void 0!==i?i:"unknown_expectation",h=null!==(r=e.kwargs)&&void 0!==r?r:{},g=h.column,f=d.success?"pass":"fail",p=Rv(h.min_value),y=Rv(h.max_value),m=Rv(h.value),v=Rv(null===(a=d.result)||void 0===a?void 0:a.observed_value),b=null!=g?g:"value",x=Fv(n),w=void 0!==v?`${b}: ${v} `:"",k={id:`ge:${n}:${null!=g?g:t}`,name:`GE ${x}${g?` (${g})`:""}`,status:f,column:g,message:void 0!==v?"observed "+v:void 0,observedCount:null===(s=d.result)||void 0===s?void 0:s.unexpected_count,source:"great-expectations",basis:"statistical-test",createdAt:l,dataVersion:c},A=/_to_be_between$/.test(n);u.push(Object.assign(Object.assign({},k),A&&void 0!==p&&void 0!==y?{kind:"range",min:p,max:y,label:`${w}(expected ${p}–${y})`}:A&&void 0!==p?{kind:"min",value:p,label:`${w}(min ${p})`}:A&&void 0!==y?{kind:"max",value:y,label:`${w}(max ${y})`}:void 0!==m?{kind:"threshold",value:m,label:`${w}(target ${m})`}:{kind:"custom",label:`${b} ${x}`}))}return Nv(u,t)}function Hv(e,t,n={}){var o,i;const r=null!==(o=n.profile)&&void 0!==o?o:qy(null!=t?t:[],{rawInput:n.rawInput}),a=ov(e),s=null!==(i=n.maxAlternatives)&&void 0!==i?i:3;if(!a)return{status:"unknown",component:e,alternatives:pv(t,{profile:r,intent:n.intent,maxResults:s,includeVariants:!1}),profile:r};const l=a.fits(r);return null===l?{status:"ok",component:e,profile:r}:{status:"alternative",component:e,reason:l,alternatives:pv(t,{profile:r,intent:n.intent,maxResults:s,deny:[e],includeVariants:!1}),profile:r}}const zv={valid:!1,errors:[]};function Wv(e,t={}){var n,o;const i=e.component,r=null!==(n=e.props)&&void 0!==n?n:{},a=[],s=!!Tg[i];s||a.push(`Unknown component "${i}". It is not in the chart registry — pick a known chart.`);const l=s?Ng(i,r):Object.assign({},zv);if(!l.valid)for(const e of l.errors)a.push(e);const c=!1!==t.diagnose&&s?Gp(i,r).diagnoses:[],u=c.filter(e=>"error"===e.severity),d=!1!==t.treatErrorsAsBlocking;if(d)for(const e of u)a.push(`${e.code}: ${e.message}`);let h,g,f,p,y;if((null!==(o=t.repair)&&void 0!==o?o:!!t.data)&&t.data&&(h=Hv(i,t.data,{intent:t.intent}),"alternative"===h.status?a.push(`${i} is a poor fit: ${h.reason}. Consider ${h.alternatives.map(e=>e.component).slice(0,3).join(", ")}.`):"unknown"===h.status&&a.push(i+" could not be evaluated against the data; "+`consider ${h.alternatives.map(e=>e.component).slice(0,3).join(", ")}.`)),s&&(g=Rg(i,r),f=Wg(g)),t.render&&s){const e=t.render(i,r);y=e.svg,p=e.evidence,p.empty&&a.push("Rendered to an empty scene (no marks) — the data or accessors produce nothing to draw.");for(const e of p.warnings)a.push(e)}const m=s&&l.valid&&(!d||0===u.length)&&(!h||"ok"===h.status)&&(!p||!p.empty);return{ok:m,component:i,props:r,config:g,jsx:f,validation:l,diagnostics:c,repair:h,evidence:p,svg:y,reasons:m?[]:a}}function Gv(e={}){var t,n;const o=null!==(t=e.components)&&void 0!==t?t:Object.keys(Tg).sort();return{name:null!==(n=e.name)&&void 0!==n?n:"render_semiotic_chart",description:"Render a Semiotic chart from a component name and props. The result is validated, diagnosed for anti-patterns, and (when data is supplied) checked for fit against the data, so it is guaranteed renderable or returns reasons and ranked alternatives to retry with.",inputSchema:{type:"object",additionalProperties:!1,required:["component"],properties:{component:{type:"string",enum:[...o],description:"The chart component to render."},props:{type:"object",description:"Props for the chart (accessors, data, encodings). See the component schema.",additionalProperties:!0}}}}}function Yv(e){return{name:e.name,description:e.description,input_schema:e.inputSchema}}function qv(e){return{type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}}function Vv(e){return t=>Wv(t,e?e(t):{})}function Xv(e){var t;if("datum"===e.role&&e.datum)return e.datum;for(const n of null!==(t=e.children)&&void 0!==t?t:[]){const e=Xv(n);if(e)return e}return null}function Uv(e,t){return e?t.map(t=>e[t]+"").join(""):""}function Kv(e){var t;const{tree:n,chartId:o,observe:s=["hover","click"]}=e,c=null!==(t=e.selectionName)&&void 0!==t?t:"__semiotic-nav-sync"+(o?":"+o:""),u=r(()=>{if(e.matchFields)return e.matchFields;const t=Xv(n);return t?Object.keys(t).filter(e=>{return!e.startsWith("_")&&(null==(n=t[e])||"string"==typeof n||"number"==typeof n||"boolean"==typeof n);var n}):[]},[e.matchFields,n]),h=r(()=>{const e=new Map,t=n=>{var o;if("datum"===n.role&&n.datum){const t=Uv(n.datum,u);e.has(t)||e.set(t,n.id)}for(const e of null!==(o=n.children)&&void 0!==o?o:[])t(e)};return t(n),e},[n,u]),{selectPoints:g,clear:f}=Na({name:c}),{latest:p}=Ea({chartId:o,types:[...s,"hover-end"],limit:1}),[y,m]=d(n.id);a(()=>{m(n.id),f()},[n,f]);const v=l(e=>{if(m(e.id),"datum"===e.role&&e.datum&&u.length>0){const t={};for(const n of u)t[n]=[e.datum[n]];g(t)}else f()},[u,g,f]),b=e.annotations,x=r(()=>{const e=new Set;if(0===u.length||!b)return e;for(const t of b){const n=h.get(Uv(t,u));n&&e.add(n)}return e},[b,h,u]),w=l(e=>{const t="number"==typeof e?null==b?void 0:b[e]:e;if(!t||0===u.length)return!1;const n=h.get(Uv(t,u));if(!n)return!1;m(n);const o={};for(const e of u)o[e]=[t[e]];return g(o),!0},[b,h,u,g]),k=i(null);return a(()=>{if(!p||p===k.current)return;if(k.current=p,"hover-end"===p.type)return;const e=p.datum;if(!e||0===u.length)return;const t=h.get(Uv(e,u));t&&t!==y&&m(t)},[p,h,u,y]),{activeId:y,onActiveChange:v,selection:{name:c},annotatedIds:x,focusAnnotation:w}}const Qv=[{intent:"outlier-detection",weight:4,patterns:[/\b(outlier|outliers|anomal|anomaly|anomalies|extreme|extremes|unusual|stands? out|sticks? out|odd one)\b/i,/\b(peak|peaks|highest|lowest|biggest spike|spike|min|max|maximum|minimum)\b/i]},{intent:"trend",weight:4,patterns:[/\b(trend|trends|trending|trajectory|over time|across time|growth|decline|rising|falling|increasing|decreasing)\b/i,/\b(history|historical|evolved|evolution|change over)\b/i]},{intent:"change-detection",weight:3,patterns:[/\b(when did|what changed|shift|shifted|breakpoint|inflection|turning point|sudden|abrupt)\b/i]},{intent:"rank",weight:4,patterns:[/\b(rank|ranking|ranked|biggest|smallest|largest|order by|sorted|best|worst|leaderboard)\b/i,/\btop\s+(\d+|sellers?|performers?|picks?|results?|categories|items?)\b/i,/\bbottom\s+(\d+|results?|items?)\b/i,/\b(who has the most|which.*most|which.*highest|which.*lowest)\b/i]},{intent:"part-to-whole",weight:4,patterns:[/\b(share|shares|composition|portion|portions|fraction|percentage of|percent of|breakdown|make up|made up of|slice|slices)\b/i,/\b(part of|part to whole|piece of the pie|how much of)\b/i]},{intent:"composition-over-time",weight:5,patterns:[/\b(composition.*time|share.*over time|share.*across|how.*mix.*changed|stacked.*time)\b/i,/\b(over time.*share|over time.*composition|over time.*breakdown)\b/i]},{intent:"distribution",weight:4,patterns:[/\b(distribution|distributions|spread|variance|variation|histogram|skew|skewed|range of|how.*spread|shape of|bell curve)\b/i,/\b(typical value|typical range|where do most|mode|median)\b/i]},{intent:"correlation",weight:4,patterns:[/\b(correl|correlation|relationship|related to|connected to|associated|connection between|relate to)\b/i,/\b(\w+ vs\.? \w+|\w+ versus \w+|\w+ against \w+|scatter)\b/i]},{intent:"compare-series",weight:3,patterns:[/\b(compare.*series|compare.*groups|compare.*cohorts|side by side|group.*vs|series.*vs)\b/i,/\b(how do.*compare|each group|each series|each cohort)\b/i]},{intent:"compare-categories",weight:3,patterns:[/\b(compare.*categor|category.*compar|which is bigger|how does.*compare|differences? between)\b/i]},{intent:"flow",weight:4,patterns:[/\b(flow|flows|transition|transitions|movement|moved from|funnel|conversion|drop[- ]off|sankey|chord)\b/i,/\b(from.*to|source.*target|path|journey|pipeline)\b/i]},{intent:"hierarchy",weight:4,patterns:[/\b(hierarchy|hierarchical|tree|nested|parent.*child|subcategory|sub-?categor|drill down|drilldown|breakdown by level)\b/i]},{intent:"geo",weight:5,patterns:[/\b(geographic|geography|geospatial|map|maps|country|countries|cities|latitude|longitude|spatial|cartogr|choropleth)\b/i,/\b(city|us state|each state|the states)\b/i,/\bacross\s+(countries|states|regions|cities|the world|the country)\b/i]}];function Zv(e){var t;if("string"!=typeof e||0===e.trim().length)return null;const n=new Map;for(const o of Qv)for(const i of o.patterns)if(i.test(e)){const e=null!==(t=n.get(o.intent))&&void 0!==t?t:0;n.set(o.intent,Math.min(5,0===e?o.weight:e+.5));break}if(0===n.size)return null;const o=Array.from(n.entries()).map(([e,t])=>({intent:e,confidence:t})).sort((e,t)=>t.confidence-e.confidence),[i,...r]=o;return{intent:i.intent,confidence:i.confidence,alternates:r}}function Jv(e,t={}){var n,o,i,r,a,s,l,c,u,d,h,g;const f=t.audience;if(!f)return[];const p=null!==(n=t.profile)&&void 0!==n?n:qy(null!=e?e:[],{rawInput:t.rawInput}),y=cv(f),m=null!==(o=t.scoreTolerance)&&void 0!==o?o:1.5,v=null!==(i=t.maxResults)&&void 0!==i?i:5,b=nv(),x=new Map;for(const e of b)x.set(e.component,lv(e.component,e.rubric.familiarity,f));const w=pv(e,{profile:p,intent:t.intent,maxResults:30,includeVariants:!0,minScore:1,allow:t.allow,deny:t.deny}),k=w.filter(e=>{var t;return(null!==(t=x.get(e.component))&&void 0!==t?t:e.rubric.familiarity)>=4}),A=k[0],S=[];for(const e of w)(null!==(r=x.get(e.component))&&void 0!==r?r:e.rubric.familiarity)>y||("increase"===(null===(s=null===(a=f.targets)||void 0===a?void 0:a[e.component])||void 0===s?void 0:s.direction)||!A||m>=A.score-e.score)&&S.push({stretch:e,familiar:A});const C=new Set,O=[];for(const{stretch:e,familiar:t}of S){const n=`${e.component}/${null!==(c=null===(l=e.variant)||void 0===l?void 0:l.key)&&void 0!==c?c:"base"}`;if(C.has(n))continue;C.add(n);const o=null!==(u=x.get(e.component))&&void 0!==u?u:e.rubric.familiarity,i=null===(d=f.targets)||void 0===d?void 0:d[e.component],r=null!==(h=null==i?void 0:i.reason)&&void 0!==h?h:"increase"===(null==i?void 0:i.direction)?`${null!==(g=f.name)&&void 0!==g?g:"your audience"} is growing adoption of ${e.component}`:t?`${e.component} is on the data, and within reach of ${t.component} which you're already familiar with`:e.component+" fits this data and would expand your team's vocabulary";if(O.push({suggestion:e,replacing:null==t?void 0:t.component,rationale:r,familiarity:o}),O.length>=v)break}return O}function eb(e,t={}){var n,o,i,r,a,s,l,c,u,d,h;const g=null!==(n=t.profile)&&void 0!==n?n:qy(null!=e?e:[],{rawInput:t.rawInput}),f=null!==(o=t.maxPanels)&&void 0!==o?o:6,p=!1!==t.diversifyByFamily,y=null!==(i=t.intents)&&void 0!==i?i:function(e){const t=[];return e.hasTimeAxis&&(t.push("trend"),e.seriesCount&&e.seriesCount>=2&&t.push("compare-series","composition-over-time"),t.push("change-detection")),e.categoryCount&&t.push("rank","compare-categories","part-to-whole"),e.primary.y&&e.rowCount>=10&&t.push("distribution"),2>Object.values(e.fields).filter(e=>"numeric"===e.type).length||t.push("correlation","outlier-detection"),e.hasHierarchy&&t.push("hierarchy"),e.hasNetwork&&t.push("flow"),e.hasGeo&&t.push("geo"),Array.from(new Set(t))}(g),m=[],v=[],b=[],x=new Set,w=new Set;for(const n of y){if(m.length>=f){b.push(n);continue}const o=pv(e,{profile:g,intent:n,allow:t.allow,deny:t.deny,maxResults:20,includeVariants:!0,minScore:1.5,audience:t.audience});let i;for(const e of o){const t=`${e.component}/${null!==(a=null===(r=e.variant)||void 0===r?void 0:r.key)&&void 0!==a?a:"base"}`;if(!(w.has(t)||p&&x.has(e.family))){i=e;break}}if(!i&&p)for(const e of o){const t=`${e.component}/${null!==(l=null===(s=e.variant)||void 0===s?void 0:s.key)&&void 0!==l?l:"base"}`;if(!w.has(t)){i=e;break}}i?(m.push({intent:n,suggestion:i}),v.push(n),x.add(i.family),w.add(`${i.component}/${null!==(u=null===(c=i.variant)||void 0===c?void 0:c.key)&&void 0!==u?u:"base"}`)):b.push(n)}return{panels:m,intentsCovered:v,intentsMissing:b,stretchPanels:t.audience&&(null!==(d=t.audience.exposureLevel)&&void 0!==d?d:1)>0?Jv(e,{profile:g,audience:t.audience,deny:Array.from(w).map(e=>e.split("/")[0]),maxResults:null!==(h=t.maxStretchPanels)&&void 0!==h?h:Math.min(3,f)}):[],profile:g}}const tb={name:"Executive",familiarity:{BarChart:5,LineChart:5,PieChart:5,DonutChart:4,GaugeChart:5,AreaChart:4,FunnelChart:4,ChoroplethMap:4,Histogram:3,Heatmap:3,StackedBarChart:3,StackedAreaChart:3,Scatterplot:3,BubbleChart:3,GroupedBarChart:3,DotPlot:3,BoxPlot:2,ViolinPlot:1,SwarmPlot:1,RidgelinePlot:1,MultiAxisLineChart:2,CandlestickChart:2,DifferenceChart:2,QuadrantChart:3,LikertChart:3,SwimlaneChart:2,MinimapChart:2,ConnectedScatterplot:1,SankeyDiagram:2,TreeDiagram:3,Treemap:3,CirclePack:2,OrbitDiagram:1,ChordDiagram:1,ProcessSankey:2,ForceDirectedGraph:1,ProportionalSymbolMap:3,FlowMap:2,DistanceCartogram:1},targets:{PieChart:{direction:"decrease",weight:1,reason:"shifting from share-by-angle toward share-by-length for accuracy"},BarChart:{direction:"increase",weight:1}},exposureLevel:1},nb={name:"Analyst",familiarity:{BarChart:5,LineChart:5,PieChart:4,DonutChart:4,AreaChart:5,StackedAreaChart:4,StackedBarChart:5,GroupedBarChart:5,Histogram:5,Heatmap:5,Scatterplot:5,BubbleChart:4,BoxPlot:4,DotPlot:4,GaugeChart:3,FunnelChart:4,LikertChart:4,QuadrantChart:4,SwimlaneChart:4,MinimapChart:4,DifferenceChart:3,MultiAxisLineChart:4,CandlestickChart:3,ConnectedScatterplot:3,ViolinPlot:3,SwarmPlot:3,RidgelinePlot:2,TreeDiagram:4,Treemap:4,CirclePack:3,SankeyDiagram:4,ProcessSankey:3,ChordDiagram:3,OrbitDiagram:2,ForceDirectedGraph:3,ChoroplethMap:4,ProportionalSymbolMap:4,FlowMap:3,DistanceCartogram:2},targets:{PieChart:{direction:"decrease",weight:1},BoxPlot:{direction:"increase",weight:1,reason:"team is shifting from averages to distribution-aware comparisons"}},exposureLevel:1},ob={name:"Data scientist",familiarity:{BarChart:5,LineChart:5,PieChart:3,DonutChart:3,AreaChart:5,StackedAreaChart:5,StackedBarChart:5,GroupedBarChart:5,Histogram:5,Heatmap:5,Scatterplot:5,BubbleChart:5,BoxPlot:5,ViolinPlot:5,SwarmPlot:4,RidgelinePlot:4,DotPlot:4,QuadrantChart:4,LikertChart:4,DifferenceChart:4,MultiAxisLineChart:4,ConnectedScatterplot:4,GaugeChart:2,FunnelChart:3,SwimlaneChart:3,MinimapChart:4,CandlestickChart:3,TreeDiagram:4,Treemap:4,CirclePack:4,SankeyDiagram:4,ProcessSankey:3,ChordDiagram:3,OrbitDiagram:2,ForceDirectedGraph:4,ChoroplethMap:4,ProportionalSymbolMap:4,FlowMap:3,DistanceCartogram:3},targets:{PieChart:{direction:"decrease",weight:2,reason:"preferring length-encoded comparisons for precision"},BarChart:{direction:"decrease",weight:1,reason:"promoting distribution-aware charts over single-value bars when raw observations are available"},BoxPlot:{direction:"increase",weight:1},ViolinPlot:{direction:"increase",weight:1}},exposureLevel:2},ib={executive:tb,analyst:nb,"data-scientist":ob},rb={component:"RealtimeHeatmap",importPath:"semiotic/realtime",rubric:{familiarity:2,accuracy:3,precision:2},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"value"===e.role)?null:"needs a numeric value field":"needs a time field for the x axis",intentScores:{trend:e=>"high"===e.throughput?4:2,distribution:3,"change-detection":3,"compare-series":e=>e.fields.find(e=>"series"===e.role||"categorical"===e.kind&&"category"!==e.role)?4:1},buildProps:e=>{var t,n,o;const i=null===(t=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===t?void 0:t.name,r=null===(n=e.fields.find(e=>"y"===e.role||"value"===e.role||"numeric"===e.kind))||void 0===n?void 0:n.name,a=null===(o=e.fields.find(e=>"category"===e.role||"categorical"===e.kind&&"series"!==e.role))||void 0===o?void 0:o.name;return Object.assign({timeAccessor:i,valueAccessor:r},a?{categoryAccessor:a}:{})}},ab=[{component:"RealtimeLineChart",importPath:"semiotic/realtime",rubric:{familiarity:4,accuracy:4,precision:3},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"y"===e.role||"value"===e.role)?"high"===e.throughput?"for high-throughput streams, prefer RealtimeHeatmap or RealtimeWaterfallChart":null:"needs a numeric value field":"needs a date/time field for the x axis",intentScores:{trend:5,"change-detection":4,"outlier-detection":2},caveats:e=>{const t=[];return"cumulative"===e.retention&&t.push("cumulative retention will eventually exhaust the buffer — set a windowSize or downsample"),t},buildProps:e=>{var t,n;return{timeAccessor:null===(t=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===t?void 0:t.name,valueAccessor:null===(n=e.fields.find(e=>"y"===e.role||"value"===e.role||"numeric"===e.kind))||void 0===n?void 0:n.name}}},{component:"RealtimeHistogram",importPath:"semiotic/realtime",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"value"===e.role)?null:"needs a numeric field to bin":"needs a time field",intentScores:{distribution:5,"outlier-detection":4,"change-detection":2},buildProps:e=>{var t,n;return{timeAccessor:null===(t=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===t?void 0:t.name,valueAccessor:null===(n=e.fields.find(e=>"value"===e.role||"numeric"===e.kind))||void 0===n?void 0:n.name}}},{component:"RealtimeSwarmChart",importPath:"semiotic/realtime",rubric:{familiarity:2,accuracy:4,precision:4},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"value"===e.role)?e.fields.some(e=>"categorical"===e.kind||"category"===e.role)?null:"needs a category to swarm by":"needs a numeric field":"needs a time field (points are placed at (time, value))",intentScores:{"outlier-detection":5,distribution:4,"compare-categories":3},caveats:e=>"high"===e.throughput?["high-throughput swarms get crowded — consider RealtimeHistogram"]:[],buildProps:e=>{var t,n,o;return{timeAccessor:null===(t=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===t?void 0:t.name,valueAccessor:null===(n=e.fields.find(e=>"value"===e.role||"numeric"===e.kind))||void 0===n?void 0:n.name,categoryAccessor:null===(o=e.fields.find(e=>"category"===e.role||"categorical"===e.kind))||void 0===o?void 0:o.name}}},{component:"RealtimeWaterfallChart",importPath:"semiotic/realtime",rubric:{familiarity:2,accuracy:4,precision:3},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"value"===e.role)?null:"needs a numeric value field":"needs a time field",intentScores:{"change-detection":5,trend:3,"outlier-detection":4,distribution:e=>"high"===e.throughput?4:2},buildProps:e=>{var t,n;return{timeAccessor:null===(t=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===t?void 0:t.name,valueAccessor:null===(n=e.fields.find(e=>"value"===e.role||"numeric"===e.kind))||void 0===n?void 0:n.name}}},rb,{component:"TemporalHistogram",importPath:"semiotic/realtime",rubric:{familiarity:3,accuracy:4,precision:3},fits:e=>e.fields.some(e=>"date"===e.kind||"x"===e.role)?e.fields.some(e=>"numeric"===e.kind||"value"===e.role)?"windowed"===e.retention?"windowed retention is RealtimeHistogram's job; TemporalHistogram serves bounded/cumulative data":null:"needs a numeric value field":"needs a time field",intentScores:{distribution:5,"change-detection":3,trend:2},buildProps:e=>{var t,n;const o=null===(t=e.fields.find(e=>"value"===e.role||"numeric"===e.kind))||void 0===t?void 0:t.name;return{timeAccessor:null===(n=e.fields.find(e=>"x"===e.role||"date"===e.kind))||void 0===n?void 0:n.name,valueAccessor:o}}}],sb=new Map;function lb(e){sb.set(e.component,e)}function cb(e){sb.delete(e)}function ub(){if(0===sb.size)return ab;const e=new Map;for(const t of ab)e.set(t.component,t);for(const[t,n]of sb)e.set(t,n);return Array.from(e.values())}function db(e,t){if(void 0===e)return 0;const n="function"==typeof e?e(t):e;return Number.isFinite(n)?Math.max(0,Math.min(5,n)):0}function hb(e,t){var n;if(0===t.length){const t=Object.values(e).filter(e=>"number"==typeof e&&e>0);return 0===t.length?0:t.reduce((e,t)=>e+t,0)/t.length}let o=0;for(const i of t)o+=null!==(n=e[i])&&void 0!==n?n:0;return o/t.length}function gb(e,t,n){const o=[],i=n.map(e=>{var n;return{intent:e,score:null!==(n=t[e])&&void 0!==n?n:0}}).filter(e=>e.score>=3).sort((e,t)=>t.score-e.score).slice(0,2);for(const{intent:e,score:t}of i)o.push(`Strong fit for ${e} (${t}/5)`);return e.throughput&&o.push(`tuned for ${e.throughput} throughput`),o}function fb(e,t={}){var n,o,i;const r=null!==(n=t.capabilities)&&void 0!==n?n:ub(),a=t.intent?Array.isArray(t.intent)?t.intent:[t.intent]:[],s=null!==(o=t.minScore)&&void 0!==o?o:0,l=null!==(i=t.maxResults)&&void 0!==i?i:10,c=t.allow?new Set(t.allow):null,u=t.deny?new Set(t.deny):null,d=[];for(const t of r){if(c&&!c.has(t.component))continue;if(u&&u.has(t.component))continue;if(null!==t.fits(e))continue;const n={};for(const[o,i]of Object.entries(t.intentScores))n[o]=db(i,e);const o=hb(n,a);if(s>o)continue;const i=Object.assign({},t.rubric),r=t.caveats?Array.from(t.caveats(e)):[],l=gb(e,n,a),h=t.buildProps(e);d.push({component:t.component,family:"realtime",importPath:t.importPath,score:o,intentScores:n,rubric:i,reasons:l,caveats:r,props:h})}return d.sort((e,t)=>t.score!==e.score?t.score-e.score:t.rubric.accuracy!==e.rubric.accuracy?t.rubric.accuracy-e.rubric.accuracy:t.rubric.familiarity-e.rubric.familiarity),d.slice(0,l)}const pb=["x","y","size","category","series","time"];function yb(e,t){const n=e.fields[t];return n?"numeric"===n.type?"numeric":"categorical"===n.type?"categorical":"date"===n.type?"date":"unknown":"unknown"}function mb(e){const t=new Set;for(const n of nv())null===n.fits(e)&&t.add(n.component);return t}function vb(e,t){const n=new Set(Object.keys(e.fields)),o=new Set(Object.keys(t.fields)),i=[],r=[];for(const e of o)n.has(e)||i.push(e);for(const e of n)o.has(e)||r.push(e);i.sort(),r.sort();const a=[];for(const i of o){if(!n.has(i))continue;const o=yb(e,i),r=yb(t,i);o!==r&&a.push({field:i,from:o,to:r})}a.sort((e,t)=>e.field.localeCompare(t.field));const s=[];for(const n of pb){const o=e.primary[n],i=t.primary[n];o!==i&&s.push({role:n,from:o,to:i})}const l=mb(e),c=mb(t),u=Array.from(l).filter(e=>!c.has(e)).sort(),d=Array.from(c).filter(e=>!l.has(e)).sort();return{rowCountChange:t.rowCount-e.rowCount,added:i,removed:r,typeChanges:a,primaryChanges:s,becameUnfit:u,becameFit:d,unchanged:0===i.length&&0===r.length&&0===a.length&&0===s.length&&0===u.length&&0===d.length&&e.rowCount===t.rowCount}}function bb(e,t=nv()){var n,o,i,r,a,s,l,c,u;const d=new Map;for(const e of t)d.set(e.component,{component:e.component,family:e.family,fitsOn:0,rejectedOn:0,inTopThreeOn:0,topPickOn:0,expertAgreementCount:0,averageScore:0,caveatCoverage:0,variantUtilization:0});const h=new Map,g=new Map,f=new Map,p=new Map,y=[];for(const s of e){let e,l;try{e=qy(s.data,{rawInput:s.rawInput}),l=yv(s.data,{profile:e,intent:s.intent,capabilities:t,maxResults:40})}catch(e){const t=!!s.expected&&s.expected.length>0;y.push({fixture:s.name,shape:s.shape,intent:s.intent,expected:s.expected,topPick:void 0,topThree:[],fittingCount:0,rejectedCount:0,expertAgreement:!t&&null,topPickAgreement:!t&&null,noFitHonored:null});continue}const c=[],u=new Set;for(const e of l.fitting)if(!u.has(e.component)&&(u.add(e.component),c.push({component:e.component,variantKey:null===(n=e.variant)||void 0===n?void 0:n.key,score:e.score}),3===c.length))break;const m=s.expected&&s.expected.length>0?c.some(e=>s.expected.includes(e.component)):null,v=s.expected&&s.expected.length>0?c.length>0&&s.expected.includes(c[0].component):null;y.push({fixture:s.name,shape:s.shape,intent:s.intent,expected:s.expected,topPick:c[0],topThree:c,fittingCount:l.fitting.length,rejectedCount:l.rejected.length,expertAgreement:m,topPickAgreement:v,noFitHonored:!0===s.expectsNoFit?0===l.fitting.length:null});for(const e of l.fitting){const t=d.get(e.component);t&&(t.fitsOn+=1,h.set(e.component,(null!==(o=h.get(e.component))&&void 0!==o?o:0)+e.score),g.set(e.component,(null!==(i=g.get(e.component))&&void 0!==i?i:0)+1),e.caveats.length>0&&f.set(e.component,(null!==(r=f.get(e.component))&&void 0!==r?r:0)+1),e.variant&&p.set(e.component,(null!==(a=p.get(e.component))&&void 0!==a?a:0)+1))}for(const e of l.rejected){const t=d.get(e.component);t&&(t.rejectedOn+=1)}for(const e of c){const t=d.get(e.component);t&&(t.inTopThreeOn+=1)}if(c[0]){const e=d.get(c[0].component);e&&(e.topPickOn+=1)}if(s.expected&&m)for(const e of c)if(s.expected.includes(e.component)){const t=d.get(e.component);t&&(t.expertAgreementCount+=1)}}for(const e of d.values()){const t=null!==(s=g.get(e.component))&&void 0!==s?s:0;e.averageScore=0===t?0:(null!==(l=h.get(e.component))&&void 0!==l?l:0)/t,e.caveatCoverage=0===t?0:(null!==(c=f.get(e.component))&&void 0!==c?c:0)/t,e.variantUtilization=0===t?0:(null!==(u=p.get(e.component))&&void 0!==u?u:0)/t}const m=Array.from(d.values()).sort((e,t)=>{const n=e.expertAgreementCount-t.expertAgreementCount;return 0!==n?n:t.fitsOn-e.fitsOn}),v=y.filter(e=>null!==e.expertAgreement),b=0===v.length?0:v.filter(e=>!0===e.expertAgreement).length/v.length,x=0===v.length?0:v.filter(e=>!0===e.topPickAgreement).length/v.length,w=Array.from(g.values()).reduce((e,t)=>e+t,0),k=Array.from(f.values()).reduce((e,t)=>e+t,0),A=Array.from(p.values()).reduce((e,t)=>e+t,0);return{perCapability:m,perFixture:y,summary:{fixtureCount:e.length,capabilityCount:t.length,expertAgreementRate:b,top1AgreementRate:x,overallCaveatCoverage:0===w?0:k/w,overallVariantUtilization:0===w?0:A/w}}}const xb=(()=>{const e=Array.from({length:12},(e,t)=>t+1);return["EU","NA","APAC"].flatMap((t,n)=>e.map(e=>({month:e,revenue:800+e*(200+40*n)+150*Math.sin(e),region:t})))})(),wb=Array.from({length:12},(e,t)=>({month:t+1,revenue:1e3+150*t+100*Math.sin(t/2)})),kb=[{product:"Widget",units:480},{product:"Gadget",units:620},{product:"Sprocket",units:290},{product:"Whatsit",units:740},{product:"Doohickey",units:410}],Ab=Array.from({length:150},(e,t)=>({respondent_id:t+1,satisfaction:Math.max(1,Math.min(10,6+2*Math.sin(t/7)+3*Math.random()-1)),cohort:["Beta","GA","Enterprise"][t%3]})),Sb=Array.from({length:80},(e,t)=>{const n=Math.max(0,40*Math.random());return{student_id:"s"+(t+1),hours:n,grade:Math.min(100,1.8*n+30+20*(Math.random()-.5))}}),Cb=Array.from({length:50},(e,t)=>({observation:50+12*Math.sin(t/4)+6*Math.random()})),Ob=[{product:"Widget",region:"EU",units:480},{product:"Widget",region:"NA",units:620},{product:"Widget",region:"APAC",units:290},{product:"Gadget",region:"EU",units:320},{product:"Gadget",region:"NA",units:740},{product:"Gadget",region:"APAC",units:410},{product:"Sprocket",region:"EU",units:200},{product:"Sprocket",region:"NA",units:380},{product:"Sprocket",region:"APAC",units:150},{product:"Whatsit",region:"EU",units:290},{product:"Whatsit",region:"NA",units:550},{product:"Whatsit",region:"APAC",units:180}],_b=[{name:"monthly revenue with regions, intent=trend",shape:"12 months × 3 regions, numeric month, numeric revenue",data:xb,intent:"trend",expected:["LineChart","AreaChart","MinimapChart"]},{name:"monthly revenue with regions, intent=compare-series",shape:"12 months × 3 regions",data:xb,intent:"compare-series",expected:["LineChart","GroupedBarChart"]},{name:"monthly revenue with regions, intent=composition-over-time",shape:"12 months × 3 regions, additive",data:xb,intent:"composition-over-time",expected:["StackedAreaChart","StackedBarChart"]},{name:"monthly revenue single series, intent=trend",shape:"12 months, no series",data:wb,intent:"trend",expected:["LineChart","AreaChart"]},{name:"product sales, intent=rank",shape:"5 products, single numeric measure",data:kb,intent:"rank",expected:["BarChart","DotPlot"]},{name:"product sales, intent=part-to-whole",shape:"5 products, single numeric measure",data:kb,intent:"part-to-whole",expected:["PieChart","DonutChart","BarChart"]},{name:"satisfaction scores, intent=distribution",shape:"150 numeric observations across 3 cohorts",data:Ab,intent:"distribution",expected:["Histogram","BoxPlot","ViolinPlot"]},{name:"satisfaction scores, intent=compare-categories",shape:"150 obs × 3 cohorts",data:Ab,intent:"compare-categories",expected:["BoxPlot","ViolinPlot","SwarmPlot"]},{name:"hours vs grade, intent=correlation",shape:"80 students, hours + grade",data:Sb,intent:"correlation",expected:["Scatterplot"]},{name:"hours vs grade, intent=outlier-detection",shape:"80 students",data:Sb,intent:"outlier-detection",expected:["Scatterplot"]},{name:"conversion funnel, intent=flow",shape:"4 stages, descending values",data:[{stage:"Visit",users:1e4},{stage:"Signup",users:2400},{stage:"Trial",users:1100},{stage:"Paid",users:380}],intent:"flow",expected:["FunnelChart"]},{name:"org chart, intent=hierarchy",shape:"3-deep org tree",data:[],rawInput:{name:"Acme",children:[{name:"Engineering",children:[{name:"Platform",value:18},{name:"Product",value:22}]},{name:"Sales",children:[{name:"EMEA",value:12},{name:"AMER",value:26}]},{name:"Ops",value:9}]},intent:"hierarchy",expected:["TreeDiagram","Treemap","CirclePack"]},{name:"approval workflow transitions, intent=flow",shape:"5 nodes / 4 weighted edges",data:[],rawInput:{nodes:[{id:"draft"},{id:"review"},{id:"approved"},{id:"shipped"},{id:"rejected"}],edges:[{source:"draft",target:"review",value:100},{source:"review",target:"approved",value:60},{source:"review",target:"rejected",value:40},{source:"approved",target:"shipped",value:58}]},intent:"flow",expected:["SankeyDiagram","ChordDiagram"]},{name:"US states with values, intent=geo",shape:"3 polygon features with numeric values",data:[],rawInput:{type:"FeatureCollection",features:[{type:"Feature",id:"CA",properties:{name:"California",value:39},geometry:{type:"Polygon",coordinates:[[[-124,32],[-114,32],[-114,42],[-124,42],[-124,32]]]}},{type:"Feature",id:"TX",properties:{name:"Texas",value:29},geometry:{type:"Polygon",coordinates:[[[-106,26],[-93,26],[-93,36],[-106,36],[-106,26]]]}},{type:"Feature",id:"NY",properties:{name:"New York",value:19},geometry:{type:"Polygon",coordinates:[[[-79,40],[-72,40],[-72,45],[-79,45],[-79,40]]]}}]},intent:"geo",expected:["ChoroplethMap","ProportionalSymbolMap"]},{name:"country economies, intent=correlation",shape:"10 countries × 3 numeric measures (gdp, hours, population)",data:[{country:"USA",gdp_per_capita:70,hours_worked:1700,population_size:330},{country:"UK",gdp_per_capita:48,hours_worked:1500,population_size:67},{country:"Germany",gdp_per_capita:53,hours_worked:1330,population_size:84},{country:"Japan",gdp_per_capita:40,hours_worked:1600,population_size:125},{country:"France",gdp_per_capita:45,hours_worked:1480,population_size:67},{country:"Italy",gdp_per_capita:38,hours_worked:1700,population_size:60},{country:"Spain",gdp_per_capita:32,hours_worked:1640,population_size:47},{country:"Canada",gdp_per_capita:52,hours_worked:1690,population_size:38},{country:"Australia",gdp_per_capita:56,hours_worked:1700,population_size:26},{country:"South Korea",gdp_per_capita:35,hours_worked:1900,population_size:52}],intent:"correlation",expected:["Scatterplot","BubbleChart"]},{name:"website metrics with 3 measures, intent=compare-series",shape:"24 months × 3 numeric measures with different ranges",data:Array.from({length:24},(e,t)=>({month:t+1,page_views:Math.round(5e4+1200*t+8e3*Math.sin(t/3)),conversion_rate:2.5+.8*Math.sin(t/4)+.05*t,avg_session_seconds:Math.round(120+2*t+15*Math.cos(t/5))})),intent:"compare-series",expected:["MultiAxisLineChart","LineChart"]},{name:"sales by region and product, intent=compare-series",shape:"12 rows = 4 products × 3 regions",data:Ob,intent:"compare-series",expected:["GroupedBarChart","StackedBarChart"]},{name:"sales by region and product, intent=part-to-whole",shape:"12 rows = 4 products × 3 regions",data:Ob,intent:"part-to-whole",expected:["StackedBarChart","PieChart"]},{name:"revenue vs expenses, intent=compare-series",shape:"48 rows = 24 months × 2 series",data:[...Array.from({length:24},(e,t)=>({month:t+1,amount:100+8*t+25*Math.sin(t/3),series:"revenue"})),...Array.from({length:24},(e,t)=>({month:t+1,amount:80+6*t+15*Math.cos(t/4),series:"expenses"}))],intent:"compare-series",expected:["DifferenceChart","LineChart","GroupedBarChart"]},{name:"stock OHLC prices, intent=change-detection",shape:"30 days × open/high/low/close",data:Array.from({length:30},(e,t)=>{const n=100+1.2*t+8*Math.sin(t/4),o=n+4*(Math.random()-.5),i=n+4*(Math.random()-.5);return{day:t+1,open:o,high:Math.max(o,i)+3*Math.random(),low:Math.min(o,i)-3*Math.random(),close:i}}),intent:"change-detection",expected:["CandlestickChart","LineChart"]},{name:"unemployment vs inflation by year, intent=correlation",shape:"20 years × 2 measures, ordered by year",data:Array.from({length:20},(e,t)=>({year:2005+t,unemployment:5+2*Math.sin(t/2)+(t>4&&10>t?3:0),inflation:2+1.5*Math.cos(t/3)})),intent:"correlation",expected:["ConnectedScatterplot","Scatterplot"]},{name:"transition events, intent=flow",shape:"11 stage transitions across 3 deals with startTime + value",data:[{case:"deal-001",stage:"Inbound Lead",nextStage:"Qualified",startTime:"2024-04-01T09:00:00",value:18},{case:"deal-001",stage:"Qualified",nextStage:"Discovery",startTime:"2024-04-01T13:00:00",value:16},{case:"deal-001",stage:"Discovery",nextStage:"Proposal",startTime:"2024-04-02T11:00:00",value:14},{case:"deal-001",stage:"Proposal",nextStage:"Closed Won",startTime:"2024-04-04T09:00:00",value:12},{case:"deal-002",stage:"Inbound Lead",nextStage:"Qualified",startTime:"2024-04-01T10:00:00",value:10},{case:"deal-002",stage:"Qualified",nextStage:"Discovery",startTime:"2024-04-02T09:00:00",value:9},{case:"deal-002",stage:"Discovery",nextStage:"Proposal",startTime:"2024-04-03T09:00:00",value:7},{case:"deal-002",stage:"Proposal",nextStage:"Closed Lost",startTime:"2024-04-04T11:00:00",value:5},{case:"deal-003",stage:"Signup",nextStage:"Activated",startTime:"2024-04-01T08:30:00",value:28},{case:"deal-003",stage:"Activated",nextStage:"Trial",startTime:"2024-04-01T10:00:00",value:24},{case:"deal-003",stage:"Trial",nextStage:"Subscribed",startTime:"2024-04-02T10:00:00",value:18}],intent:"flow",expected:["SankeyDiagram","ProcessSankey","ChordDiagram"]},{name:"incidents by service and weekday, intent=compare-categories",shape:"56 cells = 8 services × 7 weekdays, numeric incident count",data:(()=>{const e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return["auth","billing","search","ingest","notify","reports","exports","webhooks"].flatMap((t,n)=>e.map((e,o)=>({service:t,day:e,incidents:Math.round(2+9*Math.abs(Math.sin(1.7*n+o))+(5>o?1.5:-1.5))})))})(),intent:"compare-categories",expected:["Heatmap","GroupedBarChart"]},{name:"capacity utilization single value, intent=part-to-whole",shape:"1 row, one numeric value against an implicit 0–100 plan",data:[{metric:"Cluster capacity used",value:78}],intent:"part-to-whole",expected:["GaugeChart","BigNumber"]},{name:"shipping flows between cities, intent=flow",shape:"6 lat/lon nodes, 6 weighted flows, 1 outline feature",data:[],rawInput:{type:"FeatureCollection",features:[{type:"Feature",id:"outline",properties:{name:"Region"},geometry:{type:"Polygon",coordinates:[[[-125,24],[-66,24],[-66,50],[-125,50],[-125,24]]]}}],points:[{id:"SEA",lon:-122.3,lat:47.6},{id:"SFO",lon:-122.4,lat:37.8},{id:"DEN",lon:-104.9,lat:39.7},{id:"ORD",lon:-87.6,lat:41.9},{id:"ATL",lon:-84.4,lat:33.7},{id:"JFK",lon:-73.8,lat:40.6}],flows:[{source:"SEA",target:"ORD",value:320},{source:"SFO",target:"JFK",value:540},{source:"SFO",target:"ATL",value:210},{source:"DEN",target:"ORD",value:180},{source:"ORD",target:"JFK",value:460},{source:"ATL",target:"JFK",value:250}]},intent:"flow",expected:["FlowMap"]},{name:"travel times from HQ, intent=geo",shape:"6 lat/lon points with a cost field measured from a center",data:[],rawInput:{type:"FeatureCollection",features:[{type:"Feature",id:"outline",properties:{name:"Region"},geometry:{type:"Polygon",coordinates:[[[-125,24],[-66,24],[-66,50],[-125,50],[-125,24]]]}}],points:[{id:"HQ",lon:-122.4,lat:37.8,cost:0},{id:"Seattle",lon:-122.3,lat:47.6,cost:95},{id:"Denver",lon:-104.9,lat:39.7,cost:150},{id:"Chicago",lon:-87.6,lat:41.9,cost:245},{id:"Atlanta",lon:-84.4,lat:33.7,cost:280},{id:"New York",lon:-73.8,lat:40.6,cost:330}]},intent:"geo",expected:["DistanceCartogram","ProportionalSymbolMap"]},{name:"flat single column",shape:"50 rows, one numeric column",data:Cb,expected:["Histogram"]},{name:"sparse 3-row data, intent=rank",shape:"3 rows total",data:[{name:"A",value:12},{name:"B",value:34},{name:"C",value:8}],intent:"rank",expected:["BarChart","DotPlot"]}],jb=e=>tp(e),Pb=()=>fp().enabled,Mb=()=>!1;function Lb(e,t={}){const{intent:n,allow:o,deny:s,maxResults:l,includeVariants:u,minScore:d,rawInput:h,seriesField:g,capabilities:f,audience:p,profile:y}=t,m=r(()=>null!=y?y:qy(null!=e?e:[],{rawInput:h,seriesField:g}),[y,e,h,g]),v=r(()=>pv(e,{intent:n,allow:o,deny:s,maxResults:l,includeVariants:u,minScore:d,capabilities:f,audience:p,profile:m}),[e,n,o,s,l,u,d,f,p,m]),b=c(jb,Pb,Mb),x=i(null);return a(()=>{var e,t,o,i;if(0===v.length)return void(x.current=null);if(!b)return void(x.current=null);const r=fp(),a=null!==(e=null==p?void 0:p.name)&&void 0!==e?e:p?"custom":void 0,s=`${null!=n?n:""}|${null!=a?a:""}|${v.map(e=>e.component).join(",")}`;if(s===x.current)return;const l=r.getEvents();for(let e=l.length-1;e>=0;e--){const n=l[e];if("suggestion-shown"===n.type){if(`${Array.isArray(n.intent)?n.intent.join(","):null!==(t=n.intent)&&void 0!==t?t:""}|${null!==(o=n.audience)&&void 0!==o?o:""}|${n.components.join(",")}`===s)return void(x.current=s);break}}x.current=s,r.record({type:"suggestion-shown",intent:n,components:v.map(e=>e.component),topScore:null===(i=v[0])||void 0===i?void 0:i.score,audience:a})},[v,n,p,b]),{suggestions:v,profile:m}}const Tb=[{id:"trend",label:"Trend over time",description:"How a single metric changes over an ordered sequence (typically time).",familyHint:"time-series"},{id:"compare-series",label:"Compare series",description:"Compare multiple measured series across a shared x domain.",familyHint:"time-series"},{id:"compare-categories",label:"Compare categories",description:"Compare a single measure across discrete categories.",familyHint:"categorical"},{id:"rank",label:"Rank",description:"Show category ordering by a measure (largest to smallest).",familyHint:"categorical"},{id:"part-to-whole",label:"Part to whole",description:"Show how individual categories share a total.",familyHint:"categorical"},{id:"distribution",label:"Distribution",description:"Show the shape, spread, and central tendency of a numeric variable.",familyHint:"distribution"},{id:"correlation",label:"Correlation",description:"Show the relationship between two (or more) numeric variables.",familyHint:"relationship"},{id:"flow",label:"Flow",description:"Show movement, transitions, or transfers between states.",familyHint:"flow"},{id:"hierarchy",label:"Hierarchy",description:"Show parent/child structure or nested totals.",familyHint:"hierarchy"},{id:"geo",label:"Geography",description:"Show values bound to geographic locations or regions.",familyHint:"geo"},{id:"outlier-detection",label:"Outlier detection",description:"Surface individual data points that diverge from the rest.",familyHint:"distribution"},{id:"composition-over-time",label:"Composition over time",description:"Show how the share of categories changes across an ordered sequence.",familyHint:"time-series"},{id:"change-detection",label:"Change detection",description:"Surface where or when a metric shifted meaningfully.",familyHint:"time-series"}],$b=new Map(Tb.map(e=>[e.id,e]));function Nb(e){return $b.get(e)}function Db(){return Array.from($b.values())}function Bb(e){$b.set(e.id,e)}const Ib=new Set(Tb.map(e=>e.id)),Rb=new Set;function Fb(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):t}function Eb(e,t){return void 0===e?0:Fb("function"==typeof e?e(t):e,0,5)}function Hb(e){return e?Array.isArray(e)?[...e]:[e]:[]}function zb(e,t,n){var o;const i={};for(const[n,o]of Object.entries(e.intentScores))i[n]=Eb(o,t);if(n)for(const[e,t]of Object.entries(n))i[e]=Fb((null!==(o=i[e])&&void 0!==o?o:0)+t,0,5);return i}function Wb(e,t){if(t.length>0)return t.reduce((t,n)=>{var o;return t+(null!==(o=e[n])&&void 0!==o?o:0)},0)/t.length;const n=Object.values(e).filter(e=>"number"==typeof e&&e>0);return n.length?n.reduce((e,t)=>e+t,0)/n.length:0}function Gb(e,t){var n;return{id:`${e.component}:${t.key}`,baseComponent:e.component,label:t.label,intentDeltas:t.intentDeltas,rubricDeltas:t.rubricDeltas,buildProps:n=>e.buildProps(n,t),rationale:null!==(n=t.description)&&void 0!==n?n:`Registered ${e.component} variant: ${t.label}.`,source:"manual",variantKey:t.key,tags:t.tags}}function Yb(e,t,n){return e.some(e=>{var o;return(null===(o=e.props)||void 0===o?void 0:o[t])===n})}const qb=new Set(["BarChart","GroupedBarChart","StackedBarChart","DotPlot"]);const Vb=(e,t,n)=>function(e,t,n){var o;const i=new Map,r=e=>{for(const t of e)t&&t.id&&t.baseComponent&&(i.has(t.id)||i.set(t.id,t))};r(function(e,t,n){var o,i,r;const a=n.profile,s=null!==(i=null!==(o=n.existingVariants)&&void 0!==o?o:t.variants)&&void 0!==i?i:[],l=Hb(n.intent),c=[];for(const e of s)c.push(Gb(t,e));const u=l.includes("rank")||l.includes("compare-categories");!qb.has(e)||"categorical"!==t.family||Yb(s,"orientation","horizontal")||!u&&6>(null!==(r=a.categoryCount)&&void 0!==r?r:0)||c.push({id:e+":heuristic-horizontal",baseComponent:e,label:"Horizontal ranked view",intentDeltas:{rank:1,"compare-categories":.5},rubricDeltas:{precision:1},buildProps:e=>Object.assign(Object.assign({},t.buildProps(e)),{orientation:"horizontal",sort:"desc"}),rationale:"Horizontal orientation improves label legibility and rank scanning for categorical comparisons.",source:"heuristic",tags:["horizontal","ranked"]});const d=Yb(s,"normalize",!0)||Yb(s,"type","percent")||s.some(e=>/normal|percent/i.test(`${e.key} ${e.label}`));if(/Stacked/.test(e)&&!d&&(l.includes("part-to-whole")||l.includes("composition-over-time"))&&c.push({id:e+":heuristic-normalized",baseComponent:e,label:"Normalized composition",intentDeltas:{"part-to-whole":1,"compare-categories":-.5},rubricDeltas:{precision:-1},buildProps:e=>Object.assign(Object.assign({},t.buildProps(e)),{normalize:!0}),rationale:"Normalization emphasizes proportional composition when absolute magnitude is secondary.",source:"heuristic",tags:["normalized","part-to-whole"]}),l.length>0){const t=nv().filter(t=>t.component!==e).filter(e=>null===e.fits(a)).map(e=>{const t=zb(e,a);return{candidate:e,fit:Wb(t,l),scores:t}}).filter(e=>e.fit>=4).sort((e,t)=>t.fit!==e.fit?t.fit-e.fit:t.candidate.rubric.accuracy!==e.candidate.rubric.accuracy?t.candidate.rubric.accuracy-e.candidate.rubric.accuracy:t.candidate.rubric.familiarity-e.candidate.rubric.familiarity).slice(0,3);for(const{candidate:e,fit:n}of t)c.push({id:`${e.component}:heuristic-${l.join("-")}`,baseComponent:e.component,label:e.component+" alternative",buildProps:t=>e.buildProps(t),rationale:`${e.component} is a strong ${l.join(" + ")} alternative (${n.toFixed(1)}/5) for this data shape.`,source:"heuristic",tags:["cross-family",e.family]})}return c}(e,t,n));for(const i of Rb){let a=[];try{a=null!==(o=i(e,t,n))&&void 0!==o?o:[]}catch(e){void 0!==console&&console.warn("[variantDiscovery] proposer threw:",e);continue}r(a)}return Array.from(i.values())}(e,t,n),Xb=(e,t,n,o={})=>{var i,r,a,s,l;const c=ov(e.baseComponent);if(!c)return{proposalId:e.id,fit:0,novelty:1,risk:1,reasons:[`No capability registered for proposed component "${e.baseComponent}".`]};const u=c.fits(t);if(null!==u)return{proposalId:e.id,fit:0,novelty:"manual"===e.source?.2:.7,risk:1,reasons:["Rejected: "+u]};const d=Hb(o.intent),h=zb(c,t,e.intentDeltas),g=Wb(h,d),f=function(e,t){var n,o,i,r;return t?(r={familiarity:e.familiarity+(null!==(n=t.familiarity)&&void 0!==n?n:0),accuracy:e.accuracy+(null!==(o=t.accuracy)&&void 0!==o?o:0),precision:e.precision+(null!==(i=t.precision)&&void 0!==i?i:0)},{familiarity:Math.round(Fb(r.familiarity,1,5)),accuracy:Math.round(Fb(r.accuracy,1,5)),precision:Math.round(Fb(r.precision,1,5))}):e}(c.rubric,e.rubricDeltas);let p;const y=null==n?void 0:n.receptionModality;if(y&&"visual"!==y){const o=e.variantKey?null===(i=c.variants)||void 0===i?void 0:i.find(t=>t.key===e.variantKey):void 0,r=e.buildProps?e.buildProps(t,n):c.buildProps(t,o);p=av(iy(e.baseComponent,r),y)}const m=sv(g,f,e.baseComponent,n,p),v=Fb(m.score,0,5);let b="manual"===e.source?.15:"heuristic"===e.source?.45:.75;o.baselineComponent&&o.baselineComponent!==e.baseComponent&&(b+=.2),e.variantKey||(b+=.05),b=Fb(b,0,1);let x="manual"===e.source?.1:"heuristic"===e.source?.25:.45;0>(null!==(a=null===(r=e.rubricDeltas)||void 0===r?void 0:r.accuracy)&&void 0!==a?a:0)&&(x+=.15),0>(null!==(l=null===(s=e.rubricDeltas)||void 0===s?void 0:s.precision)&&void 0!==l?l:0)&&(x+=.1),f.accuracy>3||(x+=.1),3>v&&(x+=.2),x=Fb(x,0,1);const w=[];if(e.rationale&&w.push(e.rationale),d.length>0){const e=d.map(e=>{var t;return`${e}: ${(null!==(t=h[e])&&void 0!==t?t:0).toFixed(1)}/5`}).join(", ");w.push(`Intent fit — ${e}.`)}else w.push(`Mean non-zero intent fit ${g.toFixed(1)}/5.`);return"manual"!==e.source&&w.push(e.source+" proposal; verify against domain context."),m.appliedReason&&w.push(m.appliedReason),m.receivabilityReason&&w.push(m.receivabilityReason),e.rubricDeltas&&Object.values(e.rubricDeltas).some(e=>0>(null!=e?e:0))&&w.push("Rubric tradeoff: improves one reading mode while reducing precision or accuracy."),{proposalId:e.id,fit:v,novelty:b,risk:x,reasons:w}};function Ub(e){return Rb.add(e),()=>{Rb.delete(e)}}function Kb(){return Array.from(Rb)}function Qb(){Rb.clear()}const Zb={total:0,byType:{},componentsSeen:[],audiencesSeen:[],startedAt:null,lastAt:null,durationMs:0};function Jb(e){var t;if(0===e.length)return Zb;const n={},o=new Set,i=[];let r;for(const a of e){n[a.type]=(null!==(t=n[a.type])&&void 0!==t?t:0)+1,a.arcId&&(r=a.arcId);const e="component"in a&&"string"==typeof a.component?a.component:void 0;if(e&&o.add(e),"from"in a&&"string"==typeof a.from&&o.add(a.from),"to"in a&&"string"==typeof a.to&&o.add(a.to),"components"in a&&Array.isArray(a.components))for(const e of a.components)"string"==typeof e&&o.add(e);"audience-set"===a.type&&"string"==typeof a.audience&&i.push(a.audience)}const a=e[0].timestamp,s=e[e.length-1].timestamp;return{total:e.length,byType:n,componentsSeen:Array.from(o),audiencesSeen:i,latestArcId:r,startedAt:a,lastAt:s,durationMs:Math.max(0,s-a)}}function ex(e={}){const{enableOnMount:t=!0,disableOnUnmount:n=!1,capacity:o,sessionId:i}=e;a(()=>(t&&hp({capacity:o,sessionId:i}),()=>{n&&gp()}),[t,n,o,i]);const s=l(e=>tp(e),[]),u=l(()=>fp().getEvents(),[]),h=c(s,u,u),[g,f]=d(()=>fp().enabled),[p,y]=d(()=>fp().sessionId);a(()=>(f(fp().enabled),y(fp().sessionId),tp(()=>{const e=fp();f(e.enabled),y(e.sessionId)})),[]);const m=r(()=>Jb(h),[h]),v=l(e=>fp().record(e),[]),b=l(()=>fp().clear(),[]);return{history:h,summary:m,enabled:g,sessionId:p,record:v,clear:b}}export{al as $,mp as A,ib as B,_b as C,Vn as D,_p as E,fl as F,pm as G,Km as H,Xc as I,Om as J,Yc as K,Sm as L,Um as M,ph as N,Rm as O,nu as P,jm as Q,tu as R,Pm as S,Ic as T,km as U,Al as V,mm as W,Wc as X,$m as Y,hu as Z,Lm as _,ho as a,Jy as a$,am as a0,Ua as a1,$l as a2,fm as a3,Gl as a4,gm as a5,Lr as a6,Ih as a7,qm as a8,Vc as a9,ug as aA,as as aB,Ag as aC,$h as aD,zm as aE,Nh as aF,Gm as aG,Gc as aH,Bm as aI,ry as aJ,nb as aK,nf as aL,lf as aM,ff as aN,sv as aO,im as aP,iy as aQ,Xn as aR,_v as aS,Bf as aT,Av as aU,Gv as aV,Qy as aW,Zy as aX,Ky as aY,Qb as aZ,Af as a_,Cm as aa,Th as ab,Hm as ac,Xm as ad,Fl as ae,hm as af,gg as ag,cg as ah,sg as ai,dg as aj,hg as ak,qc as al,Im as am,mh as an,Fm as ao,bl as ap,cm as aq,Ll as ar,pl as as,lm as at,Bc as au,Am as av,Fc as aw,Dm as ax,gu as ay,Tm as az,hl as b,vv as b$,of as b0,nm as b1,Wg as b2,zg as b3,Rf as b4,Vv as b5,ip as b6,op as b7,rp as b8,Zg as b9,ub as bA,Zv as bB,Db as bC,ap as bD,Wv as bE,qy as bF,Vb as bG,av as bH,cp as bI,lp as bJ,ev as bK,np as bL,Bb as bM,lb as bN,Ub as bO,Hv as bP,sp as bQ,tm as bR,Sf as bS,em as bT,bb as bU,rm as bV,mv as bW,cy as bX,cv as bY,tp as bZ,pv as b_,Nv as ba,ob as bb,$f as bc,uy as bd,Gp as be,vb as bf,gp as bg,lv as bh,hp as bi,Xb as bj,tb as bk,yv as bl,Sg as bm,gf as bn,If as bo,ly as bp,Fg as bq,Iv as br,Ev as bs,Hg as bt,yy as bu,nv as bv,ov as bw,fp as bx,Nb as by,Kb as bz,sm as c,eb as c0,fb as c1,Jv as c2,Jb as c3,Sy as c4,Yv as c5,Rg as c6,jv as c7,qv as c8,Eg as c9,tv as ca,cb,Ia as cc,Ca as cd,kv as ce,xv as cf,Ea as cg,Lb as ch,ex as ci,Fa as cj,Da as ck,Kv as cl,Na as cm,ss as cn,Ng as co,Jg as cp,Qg as cq,Ib as d,Dc as e,wm as f,uo as g,wg as h,Hc as i,Nm as j,kl as k,dm as l,Yl as m,ym as n,Sa as o,Ap as p,Cp as q,yh as r,Em as s,Vm as t,Dh as u,Ym as v,wl as w,um as x,Op as y,Vy as z};