semiotic 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/ai/schema.json +1 -1
  2. package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
  3. package/dist/components/charts/ordinal/BoxPlot.d.ts +2 -0
  4. package/dist/components/charts/ordinal/DotPlot.d.ts +2 -0
  5. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -0
  6. package/dist/components/charts/ordinal/Histogram.d.ts +2 -0
  7. package/dist/components/charts/ordinal/LikertChart.d.ts +2 -0
  8. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  9. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -0
  10. package/dist/components/charts/ordinal/SwarmPlot.d.ts +2 -0
  11. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -0
  12. package/dist/components/charts/ordinal/ViolinPlot.d.ts +2 -0
  13. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +24 -0
  14. package/dist/components/charts/xy/AreaChart.d.ts +14 -0
  15. package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
  16. package/dist/components/charts/xy/CandlestickChart.d.ts +4 -0
  17. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -0
  18. package/dist/components/charts/xy/Heatmap.d.ts +4 -0
  19. package/dist/components/charts/xy/LineChart.d.ts +12 -0
  20. package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
  21. package/dist/components/charts/xy/Scatterplot.d.ts +4 -0
  22. package/dist/components/charts/xy/StackedAreaChart.d.ts +12 -0
  23. package/dist/ordinal.min.js +1 -1
  24. package/dist/ordinal.module.min.js +1 -1
  25. package/dist/realtime.min.js +1 -1
  26. package/dist/realtime.module.min.js +1 -1
  27. package/dist/semiotic-ai.min.js +1 -1
  28. package/dist/semiotic-ai.module.min.js +1 -1
  29. package/dist/semiotic.min.js +1 -1
  30. package/dist/semiotic.module.min.js +1 -1
  31. package/dist/server.min.js +1 -1
  32. package/dist/server.module.min.js +1 -1
  33. package/dist/xy.min.js +1 -1
  34. package/dist/xy.module.min.js +1 -1
  35. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useEffect as i,useMemo as r,useRef as s,useState as a,useSyncExternalStore as l,useLayoutEffect as c,useContext as d,useCallback as u,createContext as h,forwardRef as g,useImperativeHandle as f,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as v,scaleBand as m}from"d3-scale";import{quadtree as b}from"d3-quadtree";import{quantile as x}from"d3-array";import{packEnclose as w}from"d3-hierarchy";import{area as k,curveCatmullRom as A,curveCardinal as O,curveBasis as S,curveStepBefore as j,curveStepAfter as _,curveStep as M,curveMonotoneY as C,curveMonotoneX as P,curveLinear as L,arc as T}from"d3-shape";import H from"regression";import{select as B}from"d3-selection";import{brushX as I,brushY as R}from"d3-brush";const F=Object.freeze([]);function W(e){if(!e)return F;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class D{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=W(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=W(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ${constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class z{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function N(e,t,o){return e+(t-e)*o}function E(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function G(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function V(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function X(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Y(e){const t=e.map(V),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return X(e,o,n)}if(e>=1){const[e,n,i]=t[o];return X(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return X(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const Q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=Y(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),U=Y(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),J=Y(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ee=Y(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);Y(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const te=Y(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oe=Y(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);Y(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Y(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Y(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Y(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const ne=Y(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ie=Y(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),re=Y(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),se=Y(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ae=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),le=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ce=Y(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),de={category10:Q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:K,reds:Z,greens:U,oranges:J,purples:ee,viridis:te,plasma:oe},ue=Q,he=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ge=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 fe(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ge.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):ue[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%ue.length]}function pe(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return y().domain(n).range(o).unknown("#999");const r=de[o]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(n).range(e).unknown("#999")}}function ye(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function ve(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,d=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:d,datum:e.pieceData,category:e.name}))}return r}function me(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=x(e,.25))&&void 0!==t?t:r,median:null!==(o=x(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=x(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function be(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}const xe={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:d}=e,{r:u,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=d(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=u(0>a?i:n+a),o=0>a?u(i+a)-u(i):u(n)-u(n+a);g.push(ye(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=u(0>a?i+a:n),o=0>a?u(i)-u(i+a):u(n+a)-u(n);g.push(ye(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(u){const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(r,Math.min(a,u),n,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(Math.min(a,u),r,Math.abs(u-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of d){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=u?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return d},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:d}=i,u=[],h="vertical"===d,g="radial"===d,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),d=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=d(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return u},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),d=r(n,e.name),u=d.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:u,style:d,datum:n})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:d,getR:u,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],d=l[l.length-1],f=null!==(o=x(l,.25))&&void 0!==o?o:c,m=null!==(n=x(l,.5))&&void 0!==n?n:(c+d)/2,b=null!==(i=x(l,.75))&&void 0!==i?i:d,w=b-f,k=f-1.5*w,A=b+1.5*w,O=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:d,j=h(t.pieceData[0],t.name),_=[];if(v)for(const e of t.pieceData){const o=u(e);if(k>o||o>A){const n=y?t.middle:g(o),i=y?g(o):t.middle;_.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:_}),v)for(const t of _)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:d,projection:u}=r,h=[],g="vertical"===u,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,u=Array(f).fill(0);for(const e of t)u[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...u,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const o=d(r+(t+.5)*a);m+=` L ${e.middle+u[t]/y*v} ${o}`}m+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const o=d(r+(t+.5)*a);m+=` L ${e.middle-u[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*v}`;m+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(o=x(t,.25))&&void 0!==o?o:r,l=null!==(n=x(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=x(t,.75))&&void 0!==i?i:s;w={q1Pos:d(a),medianPos:d(l),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:me(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],d=r.bins||25,u=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/d||1,r=Array(d).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),d-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===r[t])continue;const n=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(ye(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,d=[],u=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/u||1,c=Array(u).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;u>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;u>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};d.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:me(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,d=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(ye(o,e.x,i-o,e.width,d,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(ye(e.x,o,e.width,i-o,d,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:d,getR:u,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===m.length)return f;const b=[],x=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let A=0;for(const e of m){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(n);i.total+=r,i.pieces.push(n),o+=r}k.push({col:e,groups:t,stepTotal:o}),w||o>A&&(A=o)}if(w)for(const e of k){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,_=v().domain([0,A]).range([0,j]),M=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let C=new Map;for(let t=0;k.length>t;t++){const o=k[t],n=o.col,d=0===t,u=n.width,h=.55*u,v=n.x+(u-h)/2,m=new Map;if(w){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=_(n.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=o.groups.get(a);if(!l)continue;const c=_(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const w=g(l.pieces[0],a),k=null!==(s=O.get(a))&&void 0!==s?s:l.total,A=k>0?l.total/k*100:0,S=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=v,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=v,S.__funnelBarW=c),f.push(ye(x,v,c,h,w,S,a)),m.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=_(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],u=l?a:n.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:d,category:l?a:n.name});y&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=v,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=v,k.__funnelBarW=t),f.push(ye(s,v,t,h,x,k,u)),m.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=m.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),d={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(d)}}C=m}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:d}=e,u=[],h=d.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return u;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,d=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:y,A=n?0:Math.max(0,k-y),O=o.x+e*a+l/2,S=m(y),j=m(0)-S,_=c(f.pieces[0],p?h:o.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:m(y+A)});if(u.push(ye(O,S,d,j,_,M,p?h:o.name)),A>0){const e=m(y+A),t=S-e,n=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});u.push(ye(O,e,d,t,n,i,p?h:o.name))}}}return u},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="horizontal"===c,h=e.config.gradientFill,g=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=u?ye(s,o.x,a,o.width,n,null,"__track__"):ye(o.x,s,o.width,a,n,null,"__track__");d.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(u){const r=l(t),s=l(t+n);f=ye(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=ye(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=n}}return d}};class we{constructor(e){this.rExtent=new z,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new $(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new z)):(this.getR=G(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new $(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let d,u;if(l){d=m().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;u=v().domain(s).range([n,o])}else a?(d=m().domain(r).range([0,e.height]).padding(c),u=v().domain(s).range([0,e.width])):(d=m().domain(r).range([0,e.width]).padding(c),u=v().domain(s).range([e.height,0]));this.scales={o:d,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const d=null!==(r=t.extentPadding)&&void 0!==r?r:.05,u=c-l,h=u>0?u*d:1;return l-=h,c+=h,l>0&&(l=0),a?v().domain([l,c]).range([0,e.width]):v().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>d&&(d=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&&(d=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(d=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a){const e=d-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||u&&!this.config.baselinePadding&&0===d||"swimlane"===a||(d+=t)}return[c,d]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==n){d=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of d)d.set(t,o/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;d?(c=h,g=d.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:u},u+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=xe[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,d=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(o)||d.set(o,[]),d.get(o).push({x:n,y:i,datum:t,category:a(t)})}const u=i.o.domain(),h=r.connectorStyle;for(const[t,i]of d)if(i.length>=2){i.sort((e,t)=>u.indexOf(e.category)-u.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=function(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=de[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(r.colorScheme,r.themeCategorical,he),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:be(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,we.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const n=d.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,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,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,O);if(!d)continue;c._transitionKey=d;const u=this.prevPositionMap.get(d);if("point"===c.type)u?(A.add(d),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(u.x!==c.x||u.y!==c.y||void 0!==u.r&&u.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=u.x,c.y=u.y,void 0!==u.r&&(c.r=u.r),k=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,u.x===c.x&&u.y===c.y&&u.w===c.w&&u.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=u.x,c.y=u.y,c.w=null!==(i=u.w)&&void 0!==i?i:c.w,c.h=null!==(r=u.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(u)A.add(d),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,u.startAngle===c.startAngle&&u.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=u.startAngle,c.endAngle=u.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(d,{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!==(d=t.opacity)&&void 0!==d?d: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!==(u=t.w)&&void 0!==u?u:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=N(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=N(n.x,e._targetX,s),e.y=N(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=N(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=N(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=N(o.x,e._targetX,s),e.y=N(o.y,e._targetY,s),void 0!==o.w&&(e.w=N(o.w,e._targetW,s),e.h=N(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:N(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=N(o.startAngle,e._targetStartAngle,s),e.endAngle=N(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!E(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!E(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(E(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!E(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new z)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!E(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!E(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!E(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function ke(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Se(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function je(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Ae(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _e(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Oe(Math.atan2(i,n)),a=Oe(e.startAngle),l=Oe(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function Me(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Ce(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Pe(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function Le(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}we.QUADTREE_THRESHOLD=500;const Te={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function He(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,Te[o])(n(e,t)),i}function Be(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ie(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Re=(o,n,i,r,s,a,l,c,d,u)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===u||void 0===u&&null!=s;return f.forEach((o,u)=>{const b=He(o,u,h,g),x=Ie(o,r,s),w=s&&s.size>0&&s.has(o.label);p.push(e("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?w||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),y+=22}),p};function Fe({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let e=0;64>=e;e++){const o=e/64;c.push(t("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:n,height:o,fill:`url(#${u})`,rx:2}),t("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),t("text",{x:i+n,y:o+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const o=e/64;h.push(t("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function We(o){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:g="vertical"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:e,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d})=>{let u=24;const h=[];return e.forEach((e,g)=>{u+=5,h.push(t("line",{stroke:"gray",x1:0,y1:u,x2:o,y2:u},"legend-top-line legend-symbol-"+g)),u+=8,e.label&&(u+=16,h.push(t("text",{y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),u+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${u})`,children:Re(e,n,i,r,s,a,l,g,c,d)},"legend-group-"+g)),u+=22*e.items.length+8}),h})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===u||void 0===u&&null!=s;p.forEach((o,u)=>{const w=He(o,u,g,f),k=Ie(o,r,s),A=s&&s.size>0&&s.has(o.label),O=26+7*o.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(e("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&u===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,A&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),v+=O});let w=0,k=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(w=Math.max(w,k),k=t):k+=t}w=Math.max(w,k);const A=m+1;return{items:y,offset:w,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,d,n,u,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((e,i)=>{const r=o[i];r.label&&(y.push(t("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),y.push(t("g",{className:"legend-item",transform:`translate(${p},0)`,children:e.items},"legend-group-"+i)),p+=e.offset+5,o[i+1]&&y.push(t("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(e.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),t("g",{children:y})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==d&&""!==d&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:u/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:d}),b]})}function De(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $e(e){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),t("g",{transform:`translate(${f}, ${p})`,children:(y=o,"object"==typeof y&&null!==y&&"gradient"in y?t(Fe,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):De(o)?t(We,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):o)});var y}function ze(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Ne(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Ee(o,n,i,r){if(!o)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=o;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?u?[a]:ze(a,d):[],v=s?u?[s]:ze(s,d):[],m="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:v.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-label"));let k=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const e=Math.min(d,120);let o=0,n=e;"end"===f?(o=-e,n=0):"middle"===f&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=e;"bottom"===g?(o=-e,n=0):"middle"===g&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function Ge(e,o,n,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-e;a.push(t("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(t("line",{x1:(o.x1||0)-e,y1:i,x2:(o.x2||0)-e,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(t("line",{x1:(o.x1||0)-e,y1:0,x2:(o.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(t("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==e&&a.push(t("path",{d:Ne((null==o?void 0:o.type)||"curly",e,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function qe(e,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,n=s.height||0;if(t>0||n>0){const i=t/2,r=n/2,s=e-i,a=o-r;if(0!==s||0!==a){const e=Math.abs(s),o=Math.abs(a),d=t/2,u=n/2,h=e*u>o*d?d/e:u/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==o)){const n=Math.atan2(o,e);l=Math.cos(n)*t,c=Math.sin(n)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(o-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function Ve(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:d,type:u,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===m&&0===b)if(void 0!==d.width){m=d.width/2;const e=d.depth||30;b=e+(0>e?-5:5)}else if(void 0!==d.height){const e=d.depth||30;m=e+(0>e?-5:5),b=d.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&qe(m,b,c,h,x,d),!v.has("subject")&&Ge(x,d,h,o,n),!v.has("note")&&Ee(l,m,b,h)]}))}function Xe(e){var o,n;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:e,ny:a});return t(Ve,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(Ve,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ye(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Qe(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,d=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!d)return null;const u=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==u||null==h?null:{x:c(u),y:d(h)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ye(e,o),c=Qe(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ze(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ue={linear:L,monotoneX:P,monotoneY:C,step:M,stepAfter:_,stepBefore:j,basis:S,cardinal:O,catmullRom:A};function Je(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==d?void 0:d.projection),y="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||p?[]:(f||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(g||et)(e)})),[d,g,p,f]),m=h&&d&&!p,b=u&&d&&!p;return m||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[m&&t("g",{className:"ordinal-grid",children:v.map((e,o)=>t("line",{x1:y?e.pixel:0,y1:y?0:e.pixel,x2:y?e.pixel:i,y2:y?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&t(o,{children:e(o,y?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function et(e){return Math.round(100*e)/100+""}function tt(n){var i,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M,legendPosition:C="right",foregroundGraphics:P,annotations:T,svgAnnotationRules:B,xAccessor:I,yAccessor:R,annotationData:F,underlayRendered:W,children:D}=n,$="radial"===(null==g?void 0:g.projection),z="horizontal"===(null==g?void 0:g.projection),N=!1!==p,E=r(()=>f&&N&&g&&!$?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,N,g,m,$]),G=n.rTickValues,q=n.tickLabelEdgeAlign,V=r(()=>f&&g&&!$?(G||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||et)(e)})):[],[f,g,b,$,G]),X=s(new Map),Y=s(null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0),Q=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const K=r(()=>{if(!T||0===T.length)return null;const o=function(o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,A,O,S,j,_,M,C,P,T,B,I,R,F,W,D,$,z,N,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe;switch(o.type){case"label":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=Ye(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Qe(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=w(r),a=o.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:u,width:d-c,height:h-u,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const e=i.data||[],r="function"==typeof o.filter?e.filter(o.filter):o.field&&null!=o.value?e.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,n)=>{const r=Ye(e,i),a=Qe(e,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(e):o.r||6,c="function"==typeof o.style?o.style(e):o.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const e=Ye(o,i),r=Qe(o,i);return t(Xe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,v=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(d=i.scales)||void 0===d?void 0:d.value;if(!y||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===d){a.push([t,r[e]]);continue}const p=d*g-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*f-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(p,null!==(u=o.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?H.polynomial(p,{order:o.order||2}):H.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),w=o.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:w,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.y1))&&void 0!==y?y:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(A=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==A?A:null===(O=i.scales)||void 0===O?void 0:O.value;if(!a||!l)return null;const c=o.upperAccessor||"upperBounds",d=o.lowerAccessor||"lowerBounds",u=o.filter,h=r.filter(e=>null!=e[c]&&null!=e[d]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ue[i.curve||"linear"]||L,f=k().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return e("g",{children:[t("path",{d:f,fill:p,fillOpacity:null!==(S=o.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),o.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.x)&&void 0!==_?_:null===(M=i.scales)||void 0===M?void 0:M.time,l=null!==(P=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(T=i.scales)||void 0===T?void 0:T.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const d=c.reduce((e,t)=>e+t,0)/c.length,u=c.reduce((e,t)=>e+Math.pow(t-d,2),0)/c.length,h=Math.sqrt(u),g=null!==(B=o.threshold)&&void 0!==B?B:2,f=d-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(I=o.fillOpacity)&&void 0!==I?I:.1,m=o.anomalyColor||"#ef4444",b=null!==(R=o.anomalyRadius)&&void 0!==R?R:6,x=l(d+g*h),w=l(f),k=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return e("g",{children:[p&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:y,fillOpacity:v}),k.map((e,o)=>{const n=Ye(e,i),r=Qe(e,i);return null==n||null==r?null:t("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(W=null===(F=i.scales)||void 0===F?void 0:F.x)&&void 0!==W?W:null===(D=i.scales)||void 0===D?void 0:D.time,c=null!==(z=null===($=i.scales)||void 0===$?void 0:$.y)&&void 0!==z?z:null===(N=i.scales)||void 0===N?void 0:N.value;if(!l||!c)return null;const d=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>d.length)return null;let u;if("polynomial"===(o.method||"linear")){const e=H.polynomial(d,{order:o.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=d.length;let t=0,o=0,n=0,i=0;for(const[e,r]of d)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const h=d.length,g=d.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=d.reduce((e,t)=>e+t[0],0)/h,y=d.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(E=o.confidence)&&void 0!==E?E:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(G=o.steps)&&void 0!==G?G:5,x=d[h-1][0],w=(x-d[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=u(e),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const O=`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`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(u(x))}`,_=o.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:o.fill||"#6366f1",fillOpacity:null!==(q=o.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),t("polyline",{points:`${j} ${S}`,fill:"none",stroke:_,strokeWidth:null!==(V=o.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=o.strokeDasharray)&&void 0!==X?X:"6,3"}),o.label&&A.length>0&&t("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:_,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let e=null,r=null;if(null!=o.px&&null!=o.py)e=o.px,r=o.py;else{const t=Ke(o,n,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ze(e,r,i))return null;const s=null!==(Y=o.dx)&&void 0!==Y?Y:0,a=null!==(Q=o.dy)&&void 0!==Q?Q:0,l=null!==(K=o.width)&&void 0!==K?K:32,c=null!==(Z=o.height)&&void 0!==Z?Z:32,d=null!==(U=o.content)&&void 0!==U?U:t("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+n)}case"text":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const d=c(r);if(null==d)return null;const u=c.bandwidth(),h=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(oe=o.opacity)&&void 0!==oe?oe:.15,f=o.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:d,y:0,width:u,height:i.height||0,fill:h,fillOpacity:g}),f&&t("text",{x:d+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[t("rect",{x:0,y:d,width:i.width||0,height:u,fill:h,fillOpacity:g}),f&&t("text",{x:12,y:d+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n="horizontal"===(null==g?void 0:g.projection),i=(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,r={scales:g?{x:n?g.r:i||g.r,y:n&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:I,yAccessor:R,width:l,height:c,data:F,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:X.current};return T.map((e,t)=>{if(B){const n=B(e,t,r);return null!=n?n:o(e,t,r)}return o(e,t,r)}).filter(Boolean)},[T,B,l,c,g,I,R,F]);return f||A||O||P||K&&K.length>0||x||D?e("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof A?A:"Ordinal Chart"}),t("desc",{children:"string"==typeof A?A+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!$&&!W&&t("g",{className:"ordinal-grid",children:V.map((e,o)=>t("line",{x1:z?e.pixel:0,y1:z?0:e.pixel,x2:z?e.pixel:l,y2:z?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!$&&t("g",{className:"ordinal-axes",children:e(o,z?{children:[!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!W&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),V.map((o,n)=>{const i=q?0===n?"start":n===V.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!W&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,o=0>e||e>c?c:e;return t("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),E.map((o,n)=>e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),K,P,D]}),A&&t("text",{x:d/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof A?A:null}),$e({legend:O,totalWidth:d,totalHeight:u,margin:h,legendPosition:C,title:A,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M})]}):null}function ot({width:e,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=s(null),u=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const f=s(!1),p=s(null),y="horizontal"===(null==l?void 0:l.projection),v=s(y);return v.current=y,i(()=>{if(!d.current)return;const t=B(d.current).select(".brush-g"),n=y?I():R();return n.extent([[0,0],[e,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),t.call(n),u.current=n,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),u.current=null}},[e,o,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=B(d.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1)},[l,y]),t("svg",{ref:d,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}const nt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function it(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const rt="undefined"==typeof window||"undefined"==typeof document,st="undefined"!=typeof window?c:i,at=()=>()=>{},lt=()=>!1,ct=()=>!0;function dt(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function ut(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function ht(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 gt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ft=new WeakMap;let pt=0,yt=!1,vt=null,mt=null,bt=null;function xt(e,t){var o,n;if(!t)return t;const i=gt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(yt)return;if("undefined"==typeof window||"undefined"==typeof document)return;yt=!0;const e=()=>{pt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(vt=new MutationObserver(e),vt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),bt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",bt):"function"==typeof mt.addListener&&mt.addListener(bt)}catch(e){}}();let s=ft.get(r);s&&s.version===pt||(s={version:pt,map:new Map},ft.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}const wt=n.createContext(null),kt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function At(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}const Ot=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},St={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},jt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},_t={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Mt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ct={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Pt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Lt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Tt({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),d=n.useContext(wt),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||u||c(!0)},[l,u]),y=n.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!o||0===o.length)return r?t("span",{id:r,tabIndex:-1,style:kt}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:p,style:kt,role:"region","aria-label":f,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,w,k,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":j.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(u=_.datum)||void 0===u?void 0:u.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(f=_.cy)&&void 0!==f?f:_.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(p=_.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=_.cx)&&void 0!==v?v:_.x,y:null!==(m=_.cy)&&void 0!==m?m:_.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=_.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(S=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ot(e.min)} to ${Ot(e.max)}, mean ${Ot(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:St,role:"region","aria-label":f,children:[t("button",{type:"button",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:_t,children:"×"}),t("div",{role:"note",style:jt,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:Mt,children:[e("caption",{style:Lt,children:["First ",x.length," of ",v.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Ct,children:"type"}),k.map(e=>t("th",{style:Ct,children:e},e))]})}),t("tbody",{children:x.map((o,n)=>e("tr",{children:[t("td",{style:Pt,children:o.label}),k.map(e=>{return t("td",{style:Pt,children:(n=o.values[e],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ot(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},e);var n})]},n))})]})]})}function Ht({summary:e}){return e?t("div",{role:"note",style:kt,children:e}):null}function Bt({tableId:e}){return t("a",{href:"#"+e,style:kt,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,kt)},children:"Skip to data table"})}function It({hoverPoint:e}){let o="";if(e){const t=e.data||e;o="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:kt,children:o})}const Rt="var(--semiotic-focus, #005fcc)";function Ft({active:e,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!e||!o)return null;const l=o.x+n.left,c=o.y+n.top;let d;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),o=Math.max(a,4);d=t("rect",{x:l-e/2-3,y:c-o/2-3,width:e+6,height:o+6,rx:3,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"})}else d=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Rt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function Wt({x:e,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=n.useRef(null),[u,h]=n.useState(null);n.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=u?`translate(${u.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,t("div",{ref:d,className:l,style:{position:"absolute",left:s.left+e,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function Dt(e){let o=null;const n=()=>(o||(o=h(null)),o),i=$t(e);return[function({children:o,initialState:i}){const a=s(i),l=r(()=>$t(e,a.current),[]),c=n();return t(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=d(o))&&void 0!==t?t:i,a=s(e);a.current=e;const c=u(()=>a.current(r.getState()),[r]),h=u(()=>a.current(r.getState()),[r]);return l(r.subscribe,c,h)}]}function $t(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function zt(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 Nt(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:Et})})),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 Et=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Gt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},qt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Vt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Et,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 Xt(e,t){if("light"===t)return Gt;if("dark"===t)return qt;if("high-contrast"===t)return Vt;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?qt:Gt;return Nt(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 Nt(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[Yt,Qt]=Dt(e=>({theme:Gt,setTheme(t){e(e=>({theme:Xt(e.theme,t)}))}}));const Kt="undefined"==typeof window?i:c;function Zt(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Ut(e){const t=function(){const[e,t]=a(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),o=s(t);o.current=t;const[l,c]=function(e,t,o){const n=s(null),[r,l]=a(null);return i(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;l(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),d=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-d.left-d.right,g=c[1]-d.top-d.bottom,f=Zt(e.foregroundGraphics,c,d),p=Zt(e.backgroundGraphics,c,d),y=Qt(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=s(0),w=s(()=>{}),k=u(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=s(()=>{}),O=s(()=>{}),S=s(null),j=s(0),_=u(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),M=u(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(_))},[_]),C=u(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);i(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return Kt(()=>{P&&(pt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:C}}function Jt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function eo(e,t,o=.3){Jt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function to(e,t,o=.6){var n,i,r,s,a;if(!Jt(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,d=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,u=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(d,u,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function oo(e,t,o,n=.35){Jt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function no(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function io(e,t,o){return null==t?o:"string"!=typeof t?t:xt(e,t)||o}function ro(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,l)),u=e.createLinearGradient(n,i,r,s),[h,g,f]=no(e,o);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function so(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 ao=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)lo(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}eo(e,t),e.globalAlpha=1}};function lo(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}const co=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=io(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=io(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),to(e,t),e.globalAlpha=1}}finally{e.restore()}}};function uo(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 ho(e,t){const o=T().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}const go=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),ho(e,t)):(uo(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(uo(e,t),oo(e,t)),e.globalAlpha=1}},fo=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=xt(e,"var(--semiotic-primary, #007bff)"),a=xt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?xt(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?xt(e,d)||d:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=u,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},po=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},yo=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=xt(e,o.style.stroke)||("string"==typeof o.style.fill?xt(e,o.style.fill):o.style.fill)||xt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},vo=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function mo(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 bo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let xo=null;function wo(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(xo||(xo=document.createElement("canvas")),xo.width=e,xo.height=e,xo)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(d);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const ko=new Map;function Ao(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=ko.get(o);if(void 0!==n)return n;const i=wo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ko.set(o,i),i}function Oo(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function So(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 jo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const _o=e=>[yo,...e],Mo={bar:_o([ao]),clusterbar:_o([ao]),point:_o([co]),swarm:_o([co]),pie:[go],donut:[go],boxplot:_o([fo,co]),violin:_o([po]),histogram:_o([ao]),ridgeline:_o([po]),timeline:_o([ao]),funnel:[ao,vo,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?mo(i):null!=r?`${mo(i)} (${bo(r)})`:mo(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=mo(i),e.measureText(c).width+16>n)continue}const d=o.__funnelValueLabelX,u=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ao,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||xt(e,"var(--semiotic-border, #999)"),n=Ao(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=no(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,xt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,d=r?jo(i):"",u=So(n);e.font="bold 13px sans-serif";const h=r?e.measureText(d).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,v=y-f/2,m=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Oo(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Oo(e,v,m,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,m+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,m+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,m+3))}e.lineWidth=1}],swimlane:_o([ao]),custom:_o([ao,co,go,fo,po,vo])},Co={top:50,right:40,bottom:60,left:70},Po={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 Lo({hover:o}){var n,i,r,s,a,l;const c=o.data||{},d=o.stats,u=o.category;if(Array.isArray(c)){const o=u||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(d)return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:["n = ",d.n]}),e("div",{children:["Min: ",d.min.toLocaleString()]}),e("div",{children:["Q1: ",d.q1.toLocaleString()]}),e("div",{children:["Median: ",d.median.toLocaleString()]}),e("div",{children:["Q3: ",d.q3.toLocaleString()]}),e("div",{children:["Max: ",d.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return e("div",{className:"semiotic-tooltip",style:Po,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===o.length&&e("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e("div",{className:"semiotic-tooltip",style:Po,children:[p&&t("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&t("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const To=g(function(o,c){var d,h,g,p,y,v,m,b,x,w,k;const{chartType:A,runtimeMode:O,data:S,oAccessor:j="category",rAccessor:_="value",colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:H,valueAccessor:B,categoryAccessor:I,projection:R="vertical",size:F=[600,400],responsiveWidth:$,responsiveHeight:z,margin:N,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,rExtent:ce,oExtent:de,extentPadding:ue=.05,oSort:he,windowMode:ge="sliding",windowSize:fe=200,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,barColors:me,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:Oe,valueLabel:Te,categoryFormat:He,valueFormat:Be,oLabel:Ie,rLabel:Re,oFormat:Fe,rFormat:We,rTickValues:De,tickLabelEdgeAlign:$e,enableHover:ze=!0,hoverAnnotation:Ne,tooltipContent:Ee,customHoverBehavior:Ge,annotations:qe,svgAnnotationRules:Ve,showGrid:Xe=!1,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,legendCategoryAccessor:gt,onCategoriesChange:ft,backgroundGraphics:pt,foregroundGraphics:yt,title:vt,className:mt,background:bt,centerContent:wt,decay:kt,pulse:Ot,transition:St,animate:jt,staleness:_t,brush:Mt,onBrush:Ct,accessibleTable:Pt=!0,description:Lt,summary:Rt,customLayout:Dt,layoutConfig:$t}=o,Nt=s(!0),Et=Ut({sizeProp:F,responsiveWidth:$,responsiveHeight:z,userMargin:N,marginDefault:Co,foregroundGraphics:yt,backgroundGraphics:pt,animate:jt,transitionProp:St,themeDirtyRef:Nt}),{reducedMotionRef:Gt,responsiveRef:qt,size:Vt,margin:Xt,adjustedWidth:Yt,adjustedHeight:Qt,resolvedForeground:Kt,resolvedBackground:Zt,currentTheme:Jt,transition:eo,introEnabled:to,tableId:oo,rafRef:no,renderFnRef:io,scheduleRender:ro}=Et,so=function(){const[e,t]=a(!1);return st(()=>{t(!0)},[]),e}(),ao=function(){const e=l(at,lt,ct);return s(e).current}(),lo=r(()=>W(S),[S]),co=null!=Oe?Oe:Ie,uo=null!=Te?Te:Re,ho=null!=He?He:Fe,go=null!=Be?Be:We,fo=s(null),po=s(null),yo=s([]),vo=s(gt),mo=s(ft);vo.current=gt,mo.current=ft;const[bo,xo]=a(null),[wo,ko]=a(null),[Ao,Oo]=a(0),[So,jo]=a(!1),[_o,Po]=a(null),To=u(()=>{var e,t;Po(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Ho=ze||Ne,Bo="streaming"===O,Io=r(()=>{var e,t,o;return{chartType:A,runtimeMode:Bo?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:ue,projection:R,oAccessor:Bo?void 0:j,rAccessor:Bo?void 0:_,colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:Bo?H:void 0,valueAccessor:Bo?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:Bo?I||j:void 0,rExtent:ce,oExtent:de,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,themeCategorical:null===(e=null==Jt?void 0:Jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:zt(Jt),themeSequential:null===(t=null==Jt?void 0:Jt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Jt?void 0:Jt.colors)||void 0===o?void 0:o.diverging,barColors:me,decay:kt,pulse:Ot,transition:eo,introAnimation:to,staleness:_t,customLayout:Dt,layoutConfig:$t,layoutMargin:Xt}},[A,fe,ge,ue,R,j,_,M,C,P,L,H,B,I,ce,de,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe,ne,ie,re,se,ae,le,he,pe,ye,ve,me,kt,Ot,null==eo?void 0:eo.duration,null==eo?void 0:eo.easing,to,_t,Bo,Jt,Dt,$t,Xt]),Ro=function(e){const t=s(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ut(e,t);if(!ht(e)||!ht(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!ut(o,i))return!1}else{if(!ht(o)||!ht(i))return!1;if(!dt(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Io),Fo=s(null);Fo.current||(Fo.current=new we(Ro));const Wo=u(()=>{var e,t;const o=vo.current,n=mo.current;if(!n||!o)return;const i=function(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i,yo.current)||(yo.current=i,n(i))},[]);i(()=>{var e;null===(e=Fo.current)||void 0===e||e.updateConfig(Ro),Nt.current=!0,ro()},[Ro,ro]);const Do=s(null);Do.current||(Do.current=new D(e=>{const t=Fo.current;t&&t.ingest(e)&&(Nt.current=!0,ro())}));const $o=u(e=>{var t;null===(t=Do.current)||void 0===t||t.push(e)},[]),zo=u(e=>{var t;null===(t=Do.current)||void 0===t||t.pushMany(e)},[]),No=u(()=>{var e,t;null===(e=Do.current)||void 0===e||e.clear(),null===(t=Fo.current)||void 0===t||t.clear(),Nt.current=!0,ro()},[ro]),Eo=u(e=>{var t,o;null===(t=Do.current)||void 0===t||t.clearLastData(),null===(o=Do.current)||void 0===o||o.setReplacementData(e)},[]);f(c,()=>({push:$o,pushMany:zo,replace:Eo,remove:e=>{var t,o,n,i;null===(t=Do.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Fo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=po.current)||void 0===i?void 0:i.data;!!po.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(po.current=null,xo(null)),Nt.current=!0,ro()}return r},update:(e,t)=>{var o,n,i;null===(o=Do.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Fo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,ro()),r},clear:No,getData:()=>{var e,t,o;return null===(e=Do.current)||void 0===e||e.flush(),null!==(o=null===(t=Fo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[$o,zo,Eo,No,ro]),i(()=>{var e;S&&(null===(e=Do.current)||void 0===e||e.setBoundedData(lo))},[S,lo]);const{hoverHandlerRef:Go,hoverLeaveRef:qo,onPointerMove:Vo,onPointerLeave:Xo}=Et;Go.current=e=>{if(!Ho)return;const t=fo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Xt.left,i=e.clientY-o.top-Xt.top;if(0>n||n>Yt||0>i||i>Qt)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const r=Fo.current;if(!r||0===r.scene.length)return;const s="radial"===R,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=function(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let d=null,u=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Ae(e.r,n)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=Se(r,t,o);break;case"point":if(i)break;e=je(r,t,o,n);break;case"wedge":e=_e(r,t,o);break;case"boxplot":e=Me(r,t,o);break;case"violin":e=Ce(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-Yt/2:n,s?i-Qt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const l=(c=a.datum||{},d=a.x,u=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A}),Object.assign({data:c,x:d,y:u,__semioticHoverData:!0},h));var c,d,u,h;po.current=l,xo(l),Ge&&(Ge(l),Nt.current=!0),ro()},qo.current=()=>{po.current&&(po.current=null,xo(null),Ge&&(Ge(null),Nt.current=!0),ro())};const Yo=s(-1),Qo=s(null),Ko=s(null),Zo=u(e=>{const t=Fo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Ko.current&&Ko.current.version===o)n=Ko.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=function(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}(e),Ko.current={version:o,graph:n}}const i=Yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Yo.current=0;const t=n.flat[0];Qo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Le(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return po.current=o,xo(o),Ge&&Ge(o),void ro()}const r=function(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}(n,i),s=function(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Pe(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Pe(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Yo.current=-1,Qo.current=null,po.current=null,xo(null),Ge&&Ge(null),void ro();Yo.current=s;const a=n.flat[s];Qo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Le(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});po.current=l,xo(l),Ge&&Ge(l),ro()},[Ge,ro]),Uo=u(e=>{Yo.current=-1,Qo.current=null,Vo(e)},[Vo]);io.current=()=>{var e,t;no.current=0;const o=fo.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Fo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Gt.current?r+1e6:r),a=!Gt.current&&s,l=Nt.current;l&&!s&&(i.computeScene({width:Yt,height:Qt}),Wo(),To(),Nt.current=!1),(l||a)&&o.setAttribute("aria-label",At(i.scene,A+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Vt[0]*c,u=Vt[1]*c;o.width===d&&o.height===u||(o.width=d,o.height=u,o.style.width=Vt[0]+"px",o.style.height=Vt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,Vt[0],Vt[1]);const h=null!==(e=null==_t?void 0:_t.threshold)&&void 0!==e?e:5e3,g=_t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==_t?void 0:_t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==bt&&!pt){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=bt||(e&&"transparent"!==e?e:null),i=t?xt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,Vt[0],Vt[1]))}const f="radial"===R;n.save(),n.beginPath(),n.rect(Xt.left,Xt.top,Yt,Qt),n.clip(),f?(n.save(),n.translate(Xt.left+Yt/2,Xt.top+Qt/2)):n.translate(Xt.left,Xt.top);const p=Dt?Mo.custom:Mo[A]||[],y={width:Yt,height:Qt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(ko(i.scales),Oo(e=>e+1)),(null==_t?void 0:_t.showBadge)&&jo(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(no.current=requestAnimationFrame(()=>io.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;st(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:so,wasHydratingFromSSR:ao,storeRef:Fo,dirtyRef:Nt,renderFnRef:io,cleanup:()=>{var e;return null===(e=Do.current)||void 0===e?void 0:e.clear()}}),i(()=>{Nt.current=!0,ro()},[A,Yt,Qt,be,bt,ro]),function(e,t,o,n,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,d=l-a.lastIngestTime>c;d!==r&&(s(d),o.current=!0,n())},1e3);return()=>clearInterval(i)},[e,r,n])}(_t,Fo,Nt,ro,So,jo);const Jo=Ho&&bo?Ee?Ee(bo):t(Lo,{hover:bo}):null,en="radial"===R,tn=Jo?t(Wt,{x:bo?en?bo.x+Yt/2:bo.x:0,y:bo?en?bo.y+Qt/2:bo.y:0,containerWidth:Yt,containerHeight:Qt,margin:Xt,className:"stream-ordinal-tooltip",children:Jo}):null;if(rt||!so&&ao){const o=Fo.current;o&&S&&(o.ingest({inserts:lo,bounded:!0}),o.computeScene({width:Yt,height:Qt}));const i=null!==(d=null==o?void 0:o.scene)&&void 0!==d?d:[],r=null!==(h=null==o?void 0:o.scales)&&void 0!==h?h:null,s="radial"===R,a=s?Xt.left+Yt/2:Xt.left,l=s?Xt.top+Qt/2:Xt.top;return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1]},children:[t(Ht,{summary:Rt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[Zt&&t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt}),e("g",{transform:`translate(${a},${l})`,children:[bt&&t("rect",{x:0,y:0,width:Yt,height:Qt,fill:bt}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const d=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",u=e=>`ord-${o.type}-${d}-${i}-${e}`,h=`ord-${o.type}-${d}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,o){const n=e.fillGradient;if(!n)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let o=0;e.length>o;o++)l.push(t("stop",{offset:e[o].offset,stopColor:e[o].color},o))}else{const o=it(e.style.fill);l.push(t("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return t("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:it(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+d-o} A${o},${o} 0 0 0 ${r+o},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r+o},${l+d} A${o},${o} 0 0 1 ${r},${l+d-o} Z`;break;default:u=`M${r},${l+d} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d} Z`}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=o;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:it(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=o,n=T().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&n.cornerRadius(e.cornerRadius);const i=n(nt)||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:it(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return e("g","vertical"===n.projection?{children:[t("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:it(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:it(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=o,n=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:it(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},u("path"))];if(e.iqrLine&&e.bounds){const o=e.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med")))}return t("g",{children:n},h)}case"connector":return t("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=o,n=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:n,fill:it(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,rTickValues:De,tickLabelEdgeAlign:$e,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,null===(g=Fo.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:qe,svgAnnotationRules:Ve,annotationFrame:0,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null==o?void 0:o.getData()}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt})]})}return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"group","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1],overflow:"visible"},onKeyDown:Zo,children:[Pt&&t(Bt,{tableId:oo}),Pt&&t(Tt,{scene:null!==(y=null===(p=Fo.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:A+" chart",tableId:oo,chartTitle:"string"==typeof vt?vt:void 0}),t(Ht,{summary:Rt}),e("div",{role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ho?Uo:void 0,onMouseLeave:Ho?Xo:void 0,children:[Zt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt})}),t(Je,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showGrid:Xe,rFormat:go,rTickValues:De}),t("canvas",{ref:fo,"aria-label":At(null!==(m=null===(v=Fo.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1]}}),t(It,{hoverPoint:bo}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,_o),annotations:qe,svgAnnotationRules:Ve,annotationFrame:Ao,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null===(b=Fo.current)||void 0===b?void 0:b.getData(),underlayRendered:!0}),(Mt||Ct)&&"radial"!==R&&t(ot,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,onBrush:Ct||(()=>{})}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt}),(null==_t?void 0:_t.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===_t.badgePosition?{top:4,left:4}:"bottom-left"===_t.badgePosition?{bottom:4,left:4}:"bottom-right"===_t.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:So?"#dc3545":"#28a745",color:"white"}),children:So?"STALE":"LIVE"}),t(Ft,{active:Yo.current>=0,hoverPoint:bo,margin:Xt,size:Vt,shape:null===(x=Qo.current)||void 0===x?void 0:x.shape,width:null===(w=Qo.current)||void 0===w?void 0:w.w,height:null===(k=Qo.current)||void 0===k?void 0:k.h}),tn]})]})});To.displayName="StreamOrdinalFrame";const Ho={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 Bo(e,t){return"function"==typeof t?t(e):e[t]}function Io(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 Ro(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=Bo(o,i);l=Io(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Bo(o,n);c.push({label:t,value:Io(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=Io(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=Io(o[e[0]],r))}}const d=Object.assign(Object.assign({},Ho),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,o)=>e("div",{style:{marginTop:0===o&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},o))]})}}function Fo(e){if(!0!==e){if("function"==typeof e){const o=e;return e=>{var n;const i=!0===(null==e?void 0:e.__semioticHoverData)||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?null!==(n=e.data)&&void 0!==n?n:{}:e,r=o(i);return null==r?null:t("div",{className:"semiotic-tooltip",style:Ho,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ro(e):Ro())}}function Wo(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function Do(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function $o(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Fo(t)||o}}const zo=h(null);function No(){return d(zo)}function Eo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Go(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[qo,Vo]=Dt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Xo,Yo]=Dt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Qo={positions:new Map};const Ko=new Set;function Zo(){for(const e of Ko)e()}function Uo(e,t){const o=Qo.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}function Jo(e){const t=p(),o=e.clientId||t,{name:n}=e,i=Vo(e=>e.selections.get(n)),s=Vo(e=>e.setClause),a=Vo(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Eo(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:u(()=>{a(n,o)},[a,n,o]),clientId:o}}function en(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const tn=h(!1),on=h(null),nn="undefined"==typeof window?i:c;function rn(e){const t=d(on),o=p(),n=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),i=s([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i.current,n)||(i.current=n);const r=i.current;nn(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),nn(()=>{t&&t.registerCategories(o,r)},[t,o,r])}function sn({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function an(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}function ln(){return Qt(e=>e.theme)}function cn(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function dn(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 un(){var e;const t=ln(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function hn(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=de[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:"#007bff"}function gn(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}n.createContext(void 0);const fn={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 pn(e,t,o){var n,i,r,s,a,l,c;const d=fn[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?d.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?d.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:d.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:d.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||d.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:d.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:d.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:yn(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function yn(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function vn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function mn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function bn(e,t){if(!t)return mn(e);try{const o=t(e);return null==o?mn(e):o}catch(t){return mn(e)}}function xn(e,t){return"function"==typeof t?t(e):e[t]}function wn({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const d=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,u=xn(d,o),h=xn(d,n),g=i?xn(d,i):void 0;return e("div",{className:"semiotic-tooltip",style:Ho,children:[t("div",{style:{fontWeight:"bold"},children:mn(u)}),t("div",{style:{marginTop:4},children:bn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",mn(g)]})]});var f}}function kn({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&t("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 An extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,o=this.state.error;return"function"==typeof e?e(o):void 0!==e?e:t(kn,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var On;const Sn="undefined"!=typeof process&&"production"!==(null===(On=process.env)||void 0===On?void 0:On.NODE_ENV);function jn({componentName:e,width:o,height:n,children:i}){return t(An,{fallback:i=>t(kn,{componentName:e,message:i.message,width:o,height:n}),children:i})}const _n={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Mn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Cn(e,t,o,n){if(!Sn)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Pn(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function Ln(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Pn(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function Tn({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Ln(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Hn(e){const{data:o,rawData:n,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:v=!1,onObservation:m,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,emptyContent:_,width:M,height:C}=e,P=void 0===n,L=r(()=>W(o),[o]),[T,H]=a([]),B=u(e=>{H(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:F,customHoverBehavior:D,customClickBehavior:$,crosshairSourceId:z}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:s,chartType:l,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,o),v=Jo({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Jo({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Yo(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[w,k]=a(null),A=g||o[0],O=r(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,w,A]),S=u(e=>{var o,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o})},Zo())}(y.name||"hover",o,f)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Uo(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];k(null!=o?o+"":null)}else k(null);if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=dn(e),r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,m,y,f,s,l,c,b,h,A]),j=u(e=>{var t,o,n,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(Qo.positions);return t.delete(e),Qo={positions:t},Zo(),!1}Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Zo()}(y.name||"hover",o,f)}if(e&&d){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),d(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const o=dn(e),r=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[d,s,b,l,c,y,f]);return i(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{!function(e,t){const o=Qo.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}(e,f),Uo(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}({selection:g,linkedHover:f,fallbackFields:y,unwrapData:v,onObservation:m,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:I}),N=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(f,z),E=function(e,t,o){const n=No(),i=un();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=pe(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return pe(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=pe(e,t,s);return e=>n[e]||o(e)}return pe(e,t,s)}if(n&&Object.keys(n).length>0){const e=pe([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}(L,s,l),G=r(()=>{if(!s)return[];const e=new Set;for(const t of L){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[L,s]),q=r(()=>P&&T.length>0?T:G,[P,T,G]),V=function(e,t,o){const[n,i]=a(null),[s,l]=a(new Set),c=u(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=u(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,q),X=r(()=>F||(V.legendSelectionHook?V.legendSelectionHook:R),[F,V.legendSelectionHook,R]),Y=function(e){const t=Qt(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}(g),Q=un(),K=No(),Z=r(()=>{if(E)return E;if(!s||0===q.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Q&&Q.length>0?Q:he,t="__streamCat",o=pe(q.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||o(e)||"#999"},[E,s,q,l,Q,K]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(tn),u=null!==d(on),h=void 0!==n?n:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[l,t,e,g]);rn(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=sn({data:e,colorBy:t,colorScale:o,getColor:fe,categories:f});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return p&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:L,colorBy:s,colorScale:Z,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:q}),te=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=ee),c&&"none"!==c&&(e.legendHoverBehavior=V.onLegendHover,e.legendClickBehavior=V.onLegendClick,e.legendHighlightedCategory=V.highlightedCategory,e.legendIsolatedCategories=V.isolatedCategories),P&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=B),e},[U,ee,c,V.onLegendHover,V.onLegendClick,V.highlightedCategory,V.isolatedCategories,P,s,B]),oe=Array.isArray(n)?W(n):n,ne=function(e,o,n){if(!e)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return t("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mn),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}(j,M,C),ie=ne?null:function(e,o,n,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},_n),{width:o,height:n}),children:i||"No data available"}):null}(oe,M,C,_);return{data:L,colorScale:E,allCategories:q,legendState:V,effectiveSelectionHook:X,activeSelectionHook:R,customHoverBehavior:D,customClickBehavior:$,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||ie||null,legendBehaviorProps:te,crosshairProps:N,resolvedSelection:Y}}function Bn({ref:e,frameRef:t,setup:o}){return f(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}const In=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:v=40,roundedTop:m,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,showCategoryTicks:D,categoryFormat:$,dataIdAccessor:z}=e,{width:N,height:E,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=n,J=r(()=>W(a),[a]),ee=Hn({data:J,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"BarChart",chartId:C,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:N,height:E}),{effectiveLegendProps:te,effectiveMargin:oe}=Bn({ref:o,frameRef:i,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;Cn("BarChart",J,"categoryAccessor",d),Cn("BarChart",J,"valueAccessor",u);const ne=gn(J,y,u),ie=un(),re=r(()=>new Map,[J]),se=r(()=>(e,t)=>{const o={};return o.fill=f?fe(e,f,ee.colorScale):hn(B,ie,p,void 0,re),o},[f,ee.colorScale,B,ie,p,re]),ae=r(()=>{const e=null==A?void 0:A.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},se(t,o)),e(t,o)||{}):se,{stroke:I,strokeWidth:R,opacity:F})},[se,A,I,R,F]),le=r(()=>an(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),de=Tn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(de)return t(kn,{componentName:"BarChart",message:de,width:N,height:E});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ne}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[N,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:U,rFormat:g}),$&&{oFormat:$}),{showGrid:q,showCategoryTicks:D,oSort:y}),te),Wo({title:X,description:Y,summary:Q,accessibleTable:K,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:ce})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BarChart",width:N,height:E,children:t(To,Object.assign({ref:i},ue))})});In.displayName="BarChart";const Rn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",stackBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,categoryFormat:$}=e,{width:z,height:N,enableHover:E,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=n,U=r(()=>W(a),[a]),J=p||u,ee=Hn({data:U,rawData:a,colorBy:J,colorScheme:y,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:N});if(ee.earlyReturn)return ee.earlyReturn;const te=un(),oe=r(()=>new Map,[U]),ne=r(()=>(e,t)=>J?ee.colorScale?{fill:fe(e,J,ee.colorScale)}:{}:{fill:hn(I,te,y,t,oe)},[J,ee.colorScale,I,te,y,oe]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>{const n=ne(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ne,{stroke:R,strokeWidth:F,opacity:D})},[ne,O,R,F,D]),re=r(()=>an(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ae=Tn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Bn({ref:o,frameRef:i,setup:ee}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:E}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Z,rFormat:f}),$&&{oFormat:$}),{showGrid:G}),le),Wo({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:e.animate})),$o({tooltip:k,defaultTooltipContent:se})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?t(kn,{componentName:"StackedBarChart",message:ae,width:z,height:N}):t(jn,{componentName:"StackedBarChart",width:z,height:N,children:t(To,Object.assign({ref:i},de))})});Rn.displayName="StackedBarChart";const Fn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",groupBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=n,Z=r(()=>W(a),[a]),U=p||u,J=Hn({data:Z,rawData:a,colorBy:U,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"GroupedBarChart",chartId:C,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:$,height:z});if(J.earlyReturn)return J.earlyReturn;const ee=un(),te=r(()=>new Map,[Z]),oe=A.pieceStyle,ne=r(()=>(e,t)=>{const o=U?J.colorScale?{fill:fe(e,U,J.colorScale)}:{}:{fill:hn(B,ee,y,t,te)};if(oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[U,J.colorScale,B,ee,y,te,oe]),ie=r(()=>vn(ne,{stroke:I,strokeWidth:R,opacity:F}),[ne,I,R,F]),re=r(()=>an(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ae=Tn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Bn({ref:o,frameRef:i,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:K,rFormat:f}),D&&{oFormat:D}),{showGrid:E}),le),Wo({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:se})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ae?t(kn,{componentName:"GroupedBarChart",message:ae,width:$,height:z}):t(jn,{componentName:"GroupedBarChart",width:$,height:z,children:t(To,Object.assign({ref:i},de))})});function Wn({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const i=(a="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=Jo({name:t}),c=o&&n?"xyBrush":o?"xBrush":"yBrush",d=u(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&en(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&en(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,n,a,l]);return{brushInteraction:r(()=>({brush:c,during:d,end:d}),[c,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof n?n:"value")}),c=s(l.brushInteraction);c.current=l.brushInteraction;const d=u(e=>{if(i){c.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||o||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Fn.displayName="GroupedBarChart";const Dn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",subcategoryAccessor:u,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D,rTickValues:$,tickLabelEdgeAlign:z,showCategoryTicks:N,gradientFill:E,trackFill:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,oe=r(()=>W(a),[a]),ne=p||u,ie=r(()=>{if(null!=v)return v;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof d?d(e):e[d])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?V:q)-2*o)/(o-1))):1},[v,e.mode,oe,d,g,q,V]),re=Hn({data:oe,rawData:a,colorBy:ne,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"SwimlaneChart",chartId:C,showLegend:Q,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:q,height:V}),se=Wn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(re.earlyReturn)return re.earlyReturn;const ae=un(),le=r(()=>new Map,[oe]),ce=A.pieceStyle,de=r(()=>(e,t)=>{const o=ne?re.colorScale?{fill:fe(e,ne,re.colorScale)}:{}:{fill:hn(B,ae,y,t,le)};if(ce){const n=ce(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ne,re.colorScale,B,ae,y,le,ce]),ue=r(()=>vn(de,{stroke:I,strokeWidth:R,opacity:F}),[de,I,R,F]),he=r(()=>an(ue,re.effectiveSelectionHook,re.resolvedSelection),[ue,re.effectiveSelectionHook,re.resolvedSelection]),ge=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),pe=Tn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ye,effectiveMargin:ve}=Bn({ref:o,frameRef:i,setup:re}),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:he,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,barPadding:ie,enableHover:X}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===N?void 0:ee,rLabel:te,rFormat:f}),$&&{rTickValues:$}),null!=z&&{tickLabelEdgeAlign:z}),D&&{oFormat:D}),void 0!==N&&{showCategoryTicks:N}),{showGrid:Y}),ye),Wo({title:K,description:Z,summary:U,accessibleTable:J,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ge})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),b&&b.length>0&&{annotations:b}),E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E}),null!=G&&{trackFill:G}),se.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return pe?t(kn,{componentName:"SwimlaneChart",message:pe,width:q,height:V}):t(jn,{componentName:"SwimlaneChart",width:q,height:V,children:t(To,Object.assign({ref:i},me))})});function $n(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Dn.displayName="SwimlaneChart";const zn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:v=[3,8],pointRadius:m=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,brush:A,onBrush:O,linkedBrush:S,frameProps:j={},selection:_,linkedHover:M,onObservation:C,onClick:P,hoverHighlight:L,chartId:T,loading:H,emptyContent:B,legendInteraction:I,legendPosition:R,color:F,stroke:D,strokeWidth:$,opacity:z,showCategoryTicks:N,categoryFormat:E}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:K,summary:Z,accessibleTable:U,categoryLabel:J,valueLabel:ee}=n,te=r(()=>W(a),[a]),oe=Hn({data:te,rawData:a,colorBy:f,colorScheme:p,legendInteraction:I,legendPosition:R,selection:_,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:H,emptyContent:B,width:G,height:q}),ne=Wn({brushProp:A,onBrushProp:O,linkedBrush:S,valueAccessor:u});if(oe.earlyReturn)return oe.earlyReturn;const ie=r(()=>{if(!y)return;const e=te.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[te,y]),re=un(),se=r(()=>new Map,[te]),ae=j.pieceStyle,le=r(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=f?fe(e,f,oe.colorScale):hn(F,re,p,void 0,se),o.r=y?function(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,y,v,ie):m,ae){const n=ae(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,oe.colorScale,y,v,ie,m,b,F,re,p,se,ae]),ce=r(()=>vn(le,{stroke:D,strokeWidth:$,opacity:z}),[le,D,$,z]),de=r(()=>an(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),ue=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),he=Tn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(he)return t(kn,{componentName:"SwarmPlot",message:he,width:G,height:q});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({chartType:"swarm"},null!=a&&{data:te}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:J,rLabel:ee,rFormat:g}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:N}),oe.legendBehaviorProps),Wo({title:Q,description:K,summary:Z,accessibleTable:U,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:ue})),Do({linkedHover:M,onObservation:C,onClick:P,hoverHighlight:L,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"SwarmPlot",width:G,height:q,children:t(To,Object.assign({ref:i},ge))})});function Nn(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Ho,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}zn.displayName="SwarmPlot";const En=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:v=20,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B,showCategoryTicks:I,categoryFormat:R}=e,{width:F,height:D,enableHover:$,showGrid:z,showLegend:N,title:E,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,Q=r(()=>W(a),[a]),K=Hn({data:Q,rawData:a,colorBy:f,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"BoxPlot",chartId:j,showLegend:N,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:M,width:F,height:D});if(K.earlyReturn)return K.earlyReturn;const Z=un(),U=r(()=>new Map,[Q]),J=r(()=>e=>{const t=f?fe(e,f,K.colorScale):hn(L,Z,p,void 0,U);return{fill:t,stroke:t,fillOpacity:.8}},[f,K.colorScale,L,Z,p,U]),ee=r(()=>vn(J,{stroke:T,strokeWidth:H,opacity:B}),[J,T,H,B]),te=r(()=>an(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),oe=r(()=>Nn(),[]),ne=Tn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ne)return t(kn,{componentName:"BoxPlot",message:ne,width:F,height:D});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,showOutliers:y,size:[F,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:v,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:g}),R&&{oFormat:R}),{showGrid:z,showCategoryTicks:I}),K.legendBehaviorProps),Wo({title:E,description:G,summary:q,accessibleTable:V,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:oe})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BoxPlot",width:F,height:D,children:t(To,Object.assign({ref:i},ie))})});En.displayName="BoxPlot";const Gn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,showCategoryTicks:$,categoryFormat:z}=o,{width:N,height:E,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=i,J=r(()=>W(l),[l]),ee=Hn({data:J,rawData:l,colorBy:y,colorScheme:v,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"Histogram",chartId:P,showLegend:V,userMargin:c,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:E}),te=Wn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:h});if(ee.earlyReturn)return ee.earlyReturn;const oe=r(()=>{if(0===J.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of J){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[J,h]),ne=un(),ie=r(()=>new Map,[J]),re=r(()=>e=>{const t=y?fe(e,y,ee.colorScale):hn(I,ne,v,void 0,ie);return{fill:t,stroke:t,fillOpacity:.8}},[y,ee.colorScale,I,ne,v,ie]),se=r(()=>vn(re,{stroke:R,strokeWidth:F,opacity:D}),[re,R,F,D]),ae=r(()=>an(se,ee.effectiveSelectionHook,ee.resolvedSelection),[se,ee.effectiveSelectionHook,ee.resolvedSelection]),le=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return e("div",{className:"semiotic-tooltip",style:Ho,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ce=Tn({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ce)return t(kn,{componentName:"Histogram",message:ce,width:N,height:E});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:J}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),oe&&{rExtent:oe}),{size:[N,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:G}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:U,rFormat:p}),z&&{oFormat:z}),{showGrid:q,showCategoryTicks:$}),ee.legendBehaviorProps),Wo({title:X,description:Y,summary:Q,accessibleTable:K,className:d,animate:o.animate})),$o({tooltip:b,defaultTooltipContent:le})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"Histogram",width:N,height:E,children:t(To,Object.assign({ref:a},de))})});Gn.displayName="Histogram";const qn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,showCategoryTicks:$,categoryFormat:z}=e,{width:N,height:E,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=n,J=r(()=>W(a),[a]),ee=Hn({data:J,rawData:a,colorBy:y,colorScheme:v,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:N,height:E}),te=Wn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=un(),ne=r(()=>new Map,[J]),ie=r(()=>e=>{const t=y?fe(e,y,ee.colorScale):hn(I,oe,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[y,ee.colorScale,I,oe,v,ne]),re=r(()=>vn(ie,{stroke:R,strokeWidth:F,opacity:D}),[ie,R,F,D]),se=r(()=>an(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=r(()=>Nn({valueAccessor:u}),[u]),le=Tn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(le)return t(kn,{componentName:"ViolinPlot",message:le,width:N,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:J}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:se,bins:g,showIQR:f,size:[N,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:U,rFormat:p}),z&&{oFormat:z}),{showGrid:q,showCategoryTicks:$}),ee.legendBehaviorProps),Wo({title:X,description:Y,summary:Q,accessibleTable:K,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:ae})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"ViolinPlot",width:N,height:E,children:t(To,Object.assign({ref:i},ce))})});qn.displayName="ViolinPlot";const Vn=g(function(e,o){var n;const i=pn(e.mode,{width:e.width,height:e.height,showGrid:null===(n=e.showGrid)||void 0===n||n,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);$n(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:v="auto",dotRadius:m=5,categoryPadding:b=10,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,chartId:M,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:H,stroke:B,strokeWidth:I,opacity:R,categoryFormat:F}=e,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,K=r(()=>W(l),[l]),Z=Hn({data:K,rawData:l,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:j,hoverHighlight:_,chartType:"DotPlot",chartId:M,showLegend:E,userMargin:c,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;const U=gn(K,v,h),J=un(),ee=r(()=>new Map,[K]),te=k.pieceStyle,oe=r(()=>(e,t)=>{const o={r:m,fillOpacity:.8};if(o.fill=p?fe(e,p,Z.colorScale):hn(H,J,y,void 0,ee),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,Z.colorScale,m,H,J,y,ee,te]),ne=r(()=>vn(oe,{stroke:B,strokeWidth:I,opacity:R}),[oe,B,I,R]),ie=r(()=>an(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=r(()=>wn({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),se=Tn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(se)return t(kn,{componentName:"DotPlot",message:se,width:D,height:$});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:U}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[D,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:b,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:f}),F&&{oFormat:F}),{showGrid:N,oSort:v}),Z.legendBehaviorProps),Wo({title:G,description:q,summary:V,accessibleTable:X,className:d,animate:e.animate})),$o({tooltip:x,defaultTooltipContent:re})),Do({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"DotPlot",width:D,height:$,children:t(To,Object.assign({ref:a},ae))})});Vn.displayName="DotPlot";const Xn=g(function(e,o){var n,i;const a=pn(e.mode,{width:null!==(n=e.width)&&void 0!==n?n:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=a,G=r(()=>W(c),[c]),q=f||h,V=Hn({data:G,rawData:c,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:D,userMargin:d,marginDefaults:a.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=un(),Y=r(()=>new Map,[G]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,X,p,t,Y)},[q,V.colorScale,L,X,p,Y]),K=r(()=>{const e=null==x?void 0:x.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},Q(t,o)),e(t,o)||{}):Q,{stroke:T,strokeWidth:H,opacity:B})},[Q,x,T,H,B]),Z=r(()=>an(K,V.effectiveSelectionHook,V.resolvedSelection),[K,V.effectiveSelectionHook,V.resolvedSelection]),U=r(()=>wn({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),J=Tn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Bn({ref:o,frameRef:l,setup:V}),oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:G}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),Wo({title:$,description:z,summary:N,accessibleTable:E,className:u,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:U})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(kn,{componentName:"PieChart",message:J,width:I,height:R}):t(jn,{componentName:"PieChart",width:I,height:R,children:t(To,Object.assign({ref:l},oe))})});Xn.displayName="PieChart";const Yn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=n,G=r(()=>W(a),[a]),q=f||d,V=Hn({data:G,rawData:a,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:D,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(I,R)),Y=un(),Q=r(()=>new Map,[G]),K=x.pieceStyle,Z=r(()=>(e,t)=>{let o;if(o=q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,Y,p,t,Q)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[q,V.colorScale,L,Y,p,Q,K]),U=r(()=>vn(Z,{stroke:T,strokeWidth:H,opacity:B}),[Z,T,H,B]),J=r(()=>an(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),te=Tn({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bn({ref:o,frameRef:i,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:G}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),oe),Wo({title:$,description:z,summary:N,accessibleTable:E,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ee})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(kn,{componentName:"DonutChart",message:te,width:I,height:R}):t(jn,{componentName:"DonutChart",width:I,height:R,children:t(To,Object.assign({ref:i},ie))})});Yn.displayName="DonutChart";const Qn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=s(null),l="context"===o.mode,{compactMode:c}=i,{value:d,min:u=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:k=240,fillZones:A=!0,tooltip:O,annotations:S,frameProps:j={},className:_,stroke:M,strokeWidth:C,opacity:P}=o,{width:L,height:T,title:H,description:B,summary:I,accessibleTable:R}=i,F=Math.max(u,Math.min(h,d)),W=h-u||1,D=(F-u)/W,{gaugeData:$,pieceStyle:z,gaugeAnnotations:N}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(u,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=u;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/W;if(A){const n=(i-u)/W,a=Math.max(0,Math.min(D,(r.value-u)/W)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>u&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[d,u,h,g,f,p,D,W,w,A]),E=r(()=>vn(z,{stroke:M,strokeWidth:C,opacity:P}),[z,M,C,P]),G=k*Math.PI/180,q=180+(360-k)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+q*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+G),Math.sin(X+G)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>G+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),K=Math.max(...Y.map(e=>e[0])),Z=Math.min(...Y.map(e=>e[1])),U=Math.max(...Y.map(e=>e[1])),J=(Z+U)/2,ee=(Q+K)/2,te=Math.max(4,Math.min((L-2*V)/(K-Q),(T-2*V)/(U-Z))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(F,u,h):b;const o=x?x(F):Math.round(F)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[b,F,u,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(F):Math.round(F)+""}:null,[l,b,F,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+q*Math.PI/180+D*G,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,D,q,G,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const e=-Math.PI/2+q*Math.PI/180+(o.value-u)/W*G,r=oe-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,u,W,q,G,oe,te]),de=r(()=>{const e=[...N,...S||[]];return le&&e.push(le),ae&&e.push(ae),e},[N,S,le,ae]),ue=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return e("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:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(F):"Remaining"})]})},[F]);if(0===$.length)return t(kn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:$,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:oe,startAngle:q,sweepAngle:k,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Fo(O)||ue,svgAnnotationRules:ce},de.length>0&&{annotations:de}),H&&{title:H}),B&&{description:B}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=o.animate&&{animate:o.animate}),j);return t(jn,{componentName:"GaugeChart",width:L,height:T,children:t(To,Object.assign({ref:a},he))})});Qn.displayName="GaugeChart";const Kn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=5,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,showCategoryTicks:R,categoryFormat:F}=e,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=n,K=r(()=>W(a),[a]),Z=Hn({data:K,rawData:a,colorBy:y,colorScheme:v,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"RidgelinePlot",chartId:_,showLegend:E,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;const U=un(),J=r(()=>new Map,[K]),ee=r(()=>e=>{const t=y?fe(e,y,Z.colorScale):hn(T,U,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.5}},[y,Z.colorScale,T,U,v,J]),te=r(()=>vn(ee,{stroke:H,strokeWidth:B,opacity:I}),[ee,H,B,I]),oe=r(()=>an(te,Z.effectiveSelectionHook,Z.resolvedSelection),[te,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=r(()=>Nn(),[]),ie=Tn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return t(kn,{componentName:"RidgelinePlot",message:ie,width:D,height:$});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:oe,bins:g,size:[D,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Y,rLabel:Q,rFormat:p}),F&&{oFormat:F}),{showGrid:N,showCategoryTicks:R,oSort:!1,amplitude:f}),Z.legendBehaviorProps),Wo({title:G,description:q,summary:V,accessibleTable:X,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:ne})),Do({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"RidgelinePlot",width:D,height:$,children:t(To,Object.assign({ref:i},re))})});Kn.displayName="RidgelinePlot";const Zn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,stepAccessor:u="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:v=.3,showLabels:m=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,categoryFormat:R}=o,F="vertical"===y,{width:D,height:$,enableHover:z,showLegend:N,title:E,description:G,summary:q,accessibleTable:V}=i,X=F?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},Y=r(()=>W(l),[l]),Q=f||g,K=!Q,Z=Hn({data:Y,rawData:l,colorBy:Q,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:_,showLegend:N,userMargin:c,marginDefaults:X,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;Cn("FunnelChart",Y,"stepAccessor",u),Cn("FunnelChart",Y,"valueAccessor",h);const U=un(),J=r(()=>new Map,[Y]),ee=r(()=>{if(K)return T||((null==U?void 0:U[0])?U[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,T,U,p]),te=w.pieceStyle,oe=r(()=>(e,t)=>{const o={};if(o.fill=ee||(Q?fe(e,Q,Z.colorScale):hn(T,U,p,t,J)),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ee,Q,Z.colorScale,T,U,p,J,te]),ne=r(()=>vn(oe,{stroke:H,strokeWidth:B,opacity:I}),[oe,H,B,I]),ie=r(()=>an(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,d=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",u=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Ho,children:[d&&t("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&t("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),se=Tn({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(se)return t(kn,{componentName:"FunnelChart",message:se,width:D,height:$});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:F?"bar-funnel":"funnel"},null!=l&&{data:Y}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:ie,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:F,showCategoryTicks:F}),R&&{oFormat:R}),{showGrid:F}),!F&&{connectorOpacity:v}),{showLabels:m}),Z.legendBehaviorProps),E&&{title:E}),G&&{description:G}),q&&{summary:q}),void 0!==V&&{accessibleTable:V}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?re:Fo(b)||re}),(A||O||S||j)&&{customHoverBehavior:Z.customHoverBehavior}),(O||S||A)&&{customClickBehavior:Z.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"FunnelChart",width:D,height:$,children:t(To,Object.assign({ref:a},ae))})});Zn.displayName="FunnelChart";const Un={RdBu:ne,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},Jn="__likert_neutral_neg",ei="__likert_neutral_pos";function ti(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function oi(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function ni(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Jn,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:ei,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function ii(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Jn?r=o:o.__likertLevel===ei?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const ri=g(function(e,o){const i=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),l=s(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:p,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,valueFormat:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,categoryFormat:R,stroke:F,strokeWidth:W,opacity:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z="horizontal"===b,U=void 0===c,J=!y,ee=function(){var e;const t=ln();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),te=r(()=>x&&Array.isArray(x)&&x.length>=m.length?x:function(e,t){if(0>=e)return[];if(t){const o=Un[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(m.length,ee),[x,m.length,ee]),oe=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],te[t]||"#888");return e},[m,te]),{processedData:ne,reAggregate:ie,accumulatorRef:re}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>ti(o,"question"),[o]),g=r(()=>d?ti(n,"score"):null,[d,n]),f=r(()=>d?null:ti(i,"level"),[d,i]),p=r(()=>d?null:ti(a,"count"),[d,a]),y=e||[],v=s([]),m=r(()=>{if(0===y.length)return[];let e=oi(y,t,h,g,f,p);return l&&(e=ni(e,t),e=ii(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var o;let n=oi(e,t,h,g,f,p);l&&(n=ni(n,t),n=ii(n,t)),null===(o=c.current)||void 0===o||o.replace(n)},[t,h,g,f,p,l,c]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:v,isDiverging:Z,frameRef:l}),se="__likertLevelLabel",ae=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=No(),f=un(),p=u(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=u(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=u(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(l.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=u(e=>t=>{y([t]),e(t)},[y]),b=u(e=>t=>{y(t),e(t)},[y]),x=u(()=>{l.current=new Set,c.current=[],h(e=>e+1)},[]);rn(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return sn({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,n,o,g,f,d]),k=r(()=>{if(w)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[w,i]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:U,colorBy:se,colorScheme:te,showLegend:G,legendPosition:I}),le=u(ae.wrapPush(e=>{re.current.push(e),ie(re.current)}),[ae.wrapPush,ie,re]),ce=u(ae.wrapPushMany(e=>{re.current.push(...e),ie(re.current)}),[ae.wrapPushMany,ie,re]);f(o,()=>({push:le,pushMany:ce,remove:e=>{var t,o;return null!==(o=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=l.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;re.current=[],ae.resetCategories(),null===(e=l.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[le,ce,ae.resetCategories,re]);const de=Hn({data:ne,rawData:c,colorBy:se,colorScheme:te,legendInteraction:B,legendPosition:I,selection:S,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"LikertChart",chartId:P,showLegend:G,userMargin:d,marginDefaults:i.marginDefaults,loading:T,emptyContent:H,width:$,height:z});if(de.earlyReturn)return de.earlyReturn;const ue=r(()=>{const e=m.length;return e%2!=0&&oe.get(m[Math.floor(e/2)])||"#888"},[m,oe]),ge=O.pieceStyle,ye=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Jn||r===ei)s={fill:ue};else{const e=i||r;s=e&&oe.has(e)?{fill:oe.get(e)}:{fill:"#888"}}if(ge){const o=ge(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[oe,ue,ge]),ve=r(()=>vn(ye,{stroke:F,strokeWidth:W,opacity:D}),[ye,F,W,D]),me=r(()=>an(ve,de.effectiveSelectionHook,de.resolvedSelection),[ve,de.effectiveSelectionHook,de.resolvedSelection]),be=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),xe=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Jn||o===ei?be:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Jn||o===ei?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:Ho},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[be]),we=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!v)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return J?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),Tn({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,p,y,v,m,J]),ke=r(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,oe]),Ae=r(()=>!1!==G?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:ke},legendPosition:I||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,I,G,ke]),Oe=r(()=>{const e=Object.assign({},de.margin);if(U&&!1!==G){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ae.streamingMarginAdjust)for(const[t,o]of Object.entries(ae.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Z&&100>e.left&&(e.left=100),e},[de.margin,ae.streamingMarginAdjust,Z,U,G,I]),Se=r(()=>L||(Z?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Z,L]),je=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Z?"horizontal":"vertical",pieceStyle:me,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Oe,barPadding:w,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K||(Z?void 0:"Percentage"),rFormat:Se}),R&&{oFormat:R}),{showGrid:E}),Ae),q&&{title:q}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),h&&{className:h}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===k?()=>null:!0===k?xe:Fo(k)||xe}),(j||_||M||C)&&{customHoverBehavior:de.customHoverBehavior}),(_||M||j)&&{customClickBehavior:de.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return we?t(kn,{componentName:"LikertChart",message:we,width:$,height:z}):t(jn,{componentName:"LikertChart",width:$,height:z,children:t(To,Object.assign({ref:l},je))})});ri.displayName="LikertChart";const si=g(function(e,o){const{data:n,layout:i,layoutConfig:a,categoryAccessor:l="category",valueAccessor:c="value",oExtent:d,rExtent:u,projection:h="vertical",margin:g,className:f,colorScheme:p,showAxes:y=!1,annotations:v,onObservation:m,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,emptyContent:O,frameProps:S={}}=e,{frameRef:j,resolved:_,safeData:M,setup:C,earlyReturn:P}=function(e){var t;const o=function(e){const t=s(null);return $n(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:i}=o,a=Hn({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:p,selection:x,linkedHover:w,onObservation:m,onClick:b,chartId:k,loading:A,emptyContent:O,margin:g,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode});if(P)return P;const{width:L,height:T,enableHover:H,showGrid:B,title:I,description:R,summary:F,accessibleTable:W}=_,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:C.margin,enableHover:H,showAxes:y,showGrid:B,annotations:v}),Wo({title:I,description:R,summary:F,accessibleTable:W,className:f,animate:e.animate})),Do({linkedHover:w,onObservation:m,onClick:b,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),S);return t(jn,{componentName:"OrdinalCustomChart",width:L,height:T,children:t(To,Object.assign({ref:j},D))})});si.displayName="OrdinalCustomChart";export{In as BarChart,En as BoxPlot,Yn as DonutChart,Vn as DotPlot,Zn as FunnelChart,Qn as GaugeChart,Fn as GroupedBarChart,Gn as Histogram,ri as LikertChart,si as OrdinalCustomChart,Xn as PieChart,Kn as RidgelinePlot,Rn as StackedBarChart,To as StreamOrdinalFrame,zn as SwarmPlot,Dn as SwimlaneChart,qn as ViolinPlot,wo as createHatchPattern};
2
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useEffect as i,useMemo as r,useRef as s,useState as a,useSyncExternalStore as l,useLayoutEffect as c,useContext as d,useCallback as u,createContext as h,forwardRef as g,useImperativeHandle as f,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as v,scaleBand as m}from"d3-scale";import{quadtree as b}from"d3-quadtree";import{quantile as x}from"d3-array";import{packEnclose as w}from"d3-hierarchy";import{area as k,curveCatmullRom as A,curveCardinal as O,curveBasis as S,curveStepBefore as j,curveStepAfter as _,curveStep as M,curveMonotoneY as C,curveMonotoneX as P,curveLinear as L,arc as T}from"d3-shape";import H from"regression";import{select as B}from"d3-selection";import{brushX as I,brushY as R}from"d3-brush";const F=Object.freeze([]);function W(e){if(!e)return F;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class D{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=W(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=W(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ${constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class z{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function N(e,t,o){return e+(t-e)*o}function E(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function G(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function V(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function X(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Y(e){const t=e.map(V),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return X(e,o,n)}if(e>=1){const[e,n,i]=t[o];return X(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return X(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const Q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=Y(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),U=Y(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),J=Y(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ee=Y(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);Y(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const te=Y(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oe=Y(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);Y(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Y(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Y(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Y(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const ne=Y(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ie=Y(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),re=Y(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),se=Y(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ae=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),le=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ce=Y(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),de={category10:Q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:K,reds:Z,greens:U,oranges:J,purples:ee,viridis:te,plasma:oe},ue=Q,he=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ge=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 fe(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ge.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):ue[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%ue.length]}function pe(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return y().domain(n).range(o).unknown("#999");const r=de[o]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(n).range(e).unknown("#999")}}function ye(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function ve(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,d=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:d,datum:e.pieceData,category:e.name}))}return r}function me(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=x(e,.25))&&void 0!==t?t:r,median:null!==(o=x(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=x(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function be(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}const xe={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:d}=e,{r:u,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=d(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=u(0>a?i:n+a),o=0>a?u(i+a)-u(i):u(n)-u(n+a);g.push(ye(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=u(0>a?i+a:n),o=0>a?u(i)-u(i+a):u(n+a)-u(n);g.push(ye(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(u){const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(r,Math.min(a,u),n,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(Math.min(a,u),r,Math.abs(u-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of d){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=u?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return d},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:d}=i,u=[],h="vertical"===d,g="radial"===d,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),d=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=d(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return u},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),d=r(n,e.name),u=d.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:u,style:d,datum:n})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:d,getR:u,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],d=l[l.length-1],f=null!==(o=x(l,.25))&&void 0!==o?o:c,m=null!==(n=x(l,.5))&&void 0!==n?n:(c+d)/2,b=null!==(i=x(l,.75))&&void 0!==i?i:d,w=b-f,k=f-1.5*w,A=b+1.5*w,O=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:d,j=h(t.pieceData[0],t.name),_=[];if(v)for(const e of t.pieceData){const o=u(e);if(k>o||o>A){const n=y?t.middle:g(o),i=y?g(o):t.middle;_.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:_}),v)for(const t of _)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:d,projection:u}=r,h=[],g="vertical"===u,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,u=Array(f).fill(0);for(const e of t)u[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...u,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const o=d(r+(t+.5)*a);m+=` L ${e.middle+u[t]/y*v} ${o}`}m+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const o=d(r+(t+.5)*a);m+=` L ${e.middle-u[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*v}`;m+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(o=x(t,.25))&&void 0!==o?o:r,l=null!==(n=x(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=x(t,.75))&&void 0!==i?i:s;w={q1Pos:d(a),medianPos:d(l),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:me(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],d=r.bins||25,u=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/d||1,r=Array(d).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),d-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===r[t])continue;const n=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(ye(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,d=[],u=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/u||1,c=Array(u).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;u>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;u>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};d.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:me(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,d=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(ye(o,e.x,i-o,e.width,d,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(ye(e.x,o,e.width,i-o,d,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:d,getR:u,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===m.length)return f;const b=[],x=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let A=0;for(const e of m){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(n);i.total+=r,i.pieces.push(n),o+=r}k.push({col:e,groups:t,stepTotal:o}),w||o>A&&(A=o)}if(w)for(const e of k){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,_=v().domain([0,A]).range([0,j]),M=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let C=new Map;for(let t=0;k.length>t;t++){const o=k[t],n=o.col,d=0===t,u=n.width,h=.55*u,v=n.x+(u-h)/2,m=new Map;if(w){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=_(n.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=o.groups.get(a);if(!l)continue;const c=_(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const w=g(l.pieces[0],a),k=null!==(s=O.get(a))&&void 0!==s?s:l.total,A=k>0?l.total/k*100:0,S=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=v,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=v,S.__funnelBarW=c),f.push(ye(x,v,c,h,w,S,a)),m.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=_(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],u=l?a:n.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:d,category:l?a:n.name});y&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=v,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=v,k.__funnelBarW=t),f.push(ye(s,v,t,h,x,k,u)),m.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=m.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),d={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(d)}}C=m}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:d}=e,u=[],h=d.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return u;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,d=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:y,A=n?0:Math.max(0,k-y),O=o.x+e*a+l/2,S=m(y),j=m(0)-S,_=c(f.pieces[0],p?h:o.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:m(y+A)});if(u.push(ye(O,S,d,j,_,M,p?h:o.name)),A>0){const e=m(y+A),t=S-e,n=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});u.push(ye(O,e,d,t,n,i,p?h:o.name))}}}return u},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="horizontal"===c,h=e.config.gradientFill,g=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=u?ye(s,o.x,a,o.width,n,null,"__track__"):ye(o.x,s,o.width,a,n,null,"__track__");d.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(u){const r=l(t),s=l(t+n);f=ye(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=ye(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=n}}return d}};class we{constructor(e){this.rExtent=new z,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new $(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new z)):(this.getR=G(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new $(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let d,u;if(l){d=m().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;u=v().domain(s).range([n,o])}else a?(d=m().domain(r).range([0,e.height]).padding(c),u=v().domain(s).range([0,e.width])):(d=m().domain(r).range([0,e.width]).padding(c),u=v().domain(s).range([e.height,0]));this.scales={o:d,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const d=null!==(r=t.extentPadding)&&void 0!==r?r:.05,u=c-l,h=u>0?u*d:1;return l-=h,c+=h,l>0&&(l=0),a?v().domain([l,c]).range([0,e.width]):v().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>d&&(d=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&&(d=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(d=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a){const e=d-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||u&&!this.config.baselinePadding&&0===d||"swimlane"===a||(d+=t)}return[c,d]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==n){d=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of d)d.set(t,o/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;d?(c=h,g=d.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:u},u+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=xe[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,d=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(o)||d.set(o,[]),d.get(o).push({x:n,y:i,datum:t,category:a(t)})}const u=i.o.domain(),h=r.connectorStyle;for(const[t,i]of d)if(i.length>=2){i.sort((e,t)=>u.indexOf(e.category)-u.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=function(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=de[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(r.colorScheme,r.themeCategorical,he),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:be(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,we.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const n=d.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,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,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,O);if(!d)continue;c._transitionKey=d;const u=this.prevPositionMap.get(d);if("point"===c.type)u?(A.add(d),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(u.x!==c.x||u.y!==c.y||void 0!==u.r&&u.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=u.x,c.y=u.y,void 0!==u.r&&(c.r=u.r),k=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,u.x===c.x&&u.y===c.y&&u.w===c.w&&u.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=u.x,c.y=u.y,c.w=null!==(i=u.w)&&void 0!==i?i:c.w,c.h=null!==(r=u.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(u)A.add(d),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,u.startAngle===c.startAngle&&u.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=u.startAngle,c.endAngle=u.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(d,{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!==(d=t.opacity)&&void 0!==d?d: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!==(u=t.w)&&void 0!==u?u:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=N(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=N(n.x,e._targetX,s),e.y=N(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=N(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=N(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=N(o.x,e._targetX,s),e.y=N(o.y,e._targetY,s),void 0!==o.w&&(e.w=N(o.w,e._targetW,s),e.h=N(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:N(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=N(o.startAngle,e._targetStartAngle,s),e.endAngle=N(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!E(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!E(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(E(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!E(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new z)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!E(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!E(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!E(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function ke(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Se(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function je(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Ae(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _e(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Oe(Math.atan2(i,n)),a=Oe(e.startAngle),l=Oe(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function Me(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Ce(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Pe(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function Le(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}we.QUADTREE_THRESHOLD=500;const Te={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function He(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,Te[o])(n(e,t)),i}function Be(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ie(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Re=(o,n,i,r,s,a,l,c,d,u)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===u||void 0===u&&null!=s;return f.forEach((o,u)=>{const b=He(o,u,h,g),x=Ie(o,r,s),w=s&&s.size>0&&s.has(o.label);p.push(e("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?w||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),y+=22}),p};function Fe({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let e=0;64>=e;e++){const o=e/64;c.push(t("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:n,height:o,fill:`url(#${u})`,rx:2}),t("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),t("text",{x:i+n,y:o+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const o=e/64;h.push(t("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function We(o){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:g="vertical"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:e,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d})=>{let u=24;const h=[];return e.forEach((e,g)=>{u+=5,h.push(t("line",{stroke:"gray",x1:0,y1:u,x2:o,y2:u},"legend-top-line legend-symbol-"+g)),u+=8,e.label&&(u+=16,h.push(t("text",{y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),u+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${u})`,children:Re(e,n,i,r,s,a,l,g,c,d)},"legend-group-"+g)),u+=22*e.items.length+8}),h})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===u||void 0===u&&null!=s;p.forEach((o,u)=>{const w=He(o,u,g,f),k=Ie(o,r,s),A=s&&s.size>0&&s.has(o.label),O=26+7*o.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(e("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&u===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,A&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),v+=O});let w=0,k=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(w=Math.max(w,k),k=t):k+=t}w=Math.max(w,k);const A=m+1;return{items:y,offset:w,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,d,n,u,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((e,i)=>{const r=o[i];r.label&&(y.push(t("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),y.push(t("g",{className:"legend-item",transform:`translate(${p},0)`,children:e.items},"legend-group-"+i)),p+=e.offset+5,o[i+1]&&y.push(t("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(e.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),t("g",{children:y})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==d&&""!==d&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:u/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:d}),b]})}function De(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $e(e){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),t("g",{transform:`translate(${f}, ${p})`,children:(y=o,"object"==typeof y&&null!==y&&"gradient"in y?t(Fe,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):De(o)?t(We,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):o)});var y}function ze(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Ne(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Ee(o,n,i,r){if(!o)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=o;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?u?[a]:ze(a,d):[],v=s?u?[s]:ze(s,d):[],m="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:v.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-label"));let k=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const e=Math.min(d,120);let o=0,n=e;"end"===f?(o=-e,n=0):"middle"===f&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=e;"bottom"===g?(o=-e,n=0):"middle"===g&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function Ge(e,o,n,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-e;a.push(t("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(t("line",{x1:(o.x1||0)-e,y1:i,x2:(o.x2||0)-e,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(t("line",{x1:(o.x1||0)-e,y1:0,x2:(o.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(t("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==e&&a.push(t("path",{d:Ne((null==o?void 0:o.type)||"curly",e,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function qe(e,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,n=s.height||0;if(t>0||n>0){const i=t/2,r=n/2,s=e-i,a=o-r;if(0!==s||0!==a){const e=Math.abs(s),o=Math.abs(a),d=t/2,u=n/2,h=e*u>o*d?d/e:u/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==o)){const n=Math.atan2(o,e);l=Math.cos(n)*t,c=Math.sin(n)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(o-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function Ve(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:d,type:u,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===m&&0===b)if(void 0!==d.width){m=d.width/2;const e=d.depth||30;b=e+(0>e?-5:5)}else if(void 0!==d.height){const e=d.depth||30;m=e+(0>e?-5:5),b=d.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&qe(m,b,c,h,x,d),!v.has("subject")&&Ge(x,d,h,o,n),!v.has("note")&&Ee(l,m,b,h)]}))}function Xe(e){var o,n;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:e,ny:a});return t(Ve,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(Ve,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ye(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Qe(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,d=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!d)return null;const u=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==u||null==h?null:{x:c(u),y:d(h)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ye(e,o),c=Qe(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ze(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ue={linear:L,monotoneX:P,monotoneY:C,step:M,stepAfter:_,stepBefore:j,basis:S,cardinal:O,catmullRom:A};function Je(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==d?void 0:d.projection),y="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||p?[]:(f||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(g||et)(e)})),[d,g,p,f]),m=h&&d&&!p,b=u&&d&&!p;return m||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[m&&t("g",{className:"ordinal-grid",children:v.map((e,o)=>t("line",{x1:y?e.pixel:0,y1:y?0:e.pixel,x2:y?e.pixel:i,y2:y?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&t(o,{children:e(o,y?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function et(e){return Math.round(100*e)/100+""}function tt(n){var i,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M,legendPosition:C="right",foregroundGraphics:P,annotations:T,svgAnnotationRules:B,xAccessor:I,yAccessor:R,annotationData:F,underlayRendered:W,children:D}=n,$="radial"===(null==g?void 0:g.projection),z="horizontal"===(null==g?void 0:g.projection),N=!1!==p,E=r(()=>f&&N&&g&&!$?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,N,g,m,$]),G=n.rTickValues,q=n.tickLabelEdgeAlign,V=r(()=>f&&g&&!$?(G||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||et)(e)})):[],[f,g,b,$,G]),X=s(new Map),Y=s(null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0),Q=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const K=r(()=>{if(!T||0===T.length)return null;const o=function(o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,A,O,S,j,_,M,C,P,T,B,I,R,F,W,D,$,z,N,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe;switch(o.type){case"label":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=Ye(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Qe(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=w(r),a=o.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:u,width:d-c,height:h-u,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const e=i.data||[],r="function"==typeof o.filter?e.filter(o.filter):o.field&&null!=o.value?e.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,n)=>{const r=Ye(e,i),a=Qe(e,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(e):o.r||6,c="function"==typeof o.style?o.style(e):o.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const e=Ye(o,i),r=Qe(o,i);return t(Xe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,v=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(d=i.scales)||void 0===d?void 0:d.value;if(!y||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===d){a.push([t,r[e]]);continue}const p=d*g-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*f-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(p,null!==(u=o.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?H.polynomial(p,{order:o.order||2}):H.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),w=o.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:w,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.y1))&&void 0!==y?y:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(A=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==A?A:null===(O=i.scales)||void 0===O?void 0:O.value;if(!a||!l)return null;const c=o.upperAccessor||"upperBounds",d=o.lowerAccessor||"lowerBounds",u=o.filter,h=r.filter(e=>null!=e[c]&&null!=e[d]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ue[i.curve||"linear"]||L,f=k().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return e("g",{children:[t("path",{d:f,fill:p,fillOpacity:null!==(S=o.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),o.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.x)&&void 0!==_?_:null===(M=i.scales)||void 0===M?void 0:M.time,l=null!==(P=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(T=i.scales)||void 0===T?void 0:T.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const d=c.reduce((e,t)=>e+t,0)/c.length,u=c.reduce((e,t)=>e+Math.pow(t-d,2),0)/c.length,h=Math.sqrt(u),g=null!==(B=o.threshold)&&void 0!==B?B:2,f=d-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(I=o.fillOpacity)&&void 0!==I?I:.1,m=o.anomalyColor||"#ef4444",b=null!==(R=o.anomalyRadius)&&void 0!==R?R:6,x=l(d+g*h),w=l(f),k=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return e("g",{children:[p&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:y,fillOpacity:v}),k.map((e,o)=>{const n=Ye(e,i),r=Qe(e,i);return null==n||null==r?null:t("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(W=null===(F=i.scales)||void 0===F?void 0:F.x)&&void 0!==W?W:null===(D=i.scales)||void 0===D?void 0:D.time,c=null!==(z=null===($=i.scales)||void 0===$?void 0:$.y)&&void 0!==z?z:null===(N=i.scales)||void 0===N?void 0:N.value;if(!l||!c)return null;const d=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>d.length)return null;let u;if("polynomial"===(o.method||"linear")){const e=H.polynomial(d,{order:o.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=d.length;let t=0,o=0,n=0,i=0;for(const[e,r]of d)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const h=d.length,g=d.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=d.reduce((e,t)=>e+t[0],0)/h,y=d.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(E=o.confidence)&&void 0!==E?E:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(G=o.steps)&&void 0!==G?G:5,x=d[h-1][0],w=(x-d[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=u(e),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const O=`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`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(u(x))}`,_=o.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:o.fill||"#6366f1",fillOpacity:null!==(q=o.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),t("polyline",{points:`${j} ${S}`,fill:"none",stroke:_,strokeWidth:null!==(V=o.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=o.strokeDasharray)&&void 0!==X?X:"6,3"}),o.label&&A.length>0&&t("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:_,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let e=null,r=null;if(null!=o.px&&null!=o.py)e=o.px,r=o.py;else{const t=Ke(o,n,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ze(e,r,i))return null;const s=null!==(Y=o.dx)&&void 0!==Y?Y:0,a=null!==(Q=o.dy)&&void 0!==Q?Q:0,l=null!==(K=o.width)&&void 0!==K?K:32,c=null!==(Z=o.height)&&void 0!==Z?Z:32,d=null!==(U=o.content)&&void 0!==U?U:t("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+n)}case"text":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const d=c(r);if(null==d)return null;const u=c.bandwidth(),h=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(oe=o.opacity)&&void 0!==oe?oe:.15,f=o.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:d,y:0,width:u,height:i.height||0,fill:h,fillOpacity:g}),f&&t("text",{x:d+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[t("rect",{x:0,y:d,width:i.width||0,height:u,fill:h,fillOpacity:g}),f&&t("text",{x:12,y:d+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n="horizontal"===(null==g?void 0:g.projection),i=(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,r={scales:g?{x:n?g.r:i||g.r,y:n&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:I,yAccessor:R,width:l,height:c,data:F,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:X.current};return T.map((e,t)=>{if(B){const n=B(e,t,r);return null!=n?n:o(e,t,r)}return o(e,t,r)}).filter(Boolean)},[T,B,l,c,g,I,R,F]);return f||A||O||P||K&&K.length>0||x||D?e("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof A?A:"Ordinal Chart"}),t("desc",{children:"string"==typeof A?A+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!$&&!W&&t("g",{className:"ordinal-grid",children:V.map((e,o)=>t("line",{x1:z?e.pixel:0,y1:z?0:e.pixel,x2:z?e.pixel:l,y2:z?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!$&&t("g",{className:"ordinal-axes",children:e(o,z?{children:[!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!W&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),V.map((o,n)=>{const i=q?0===n?"start":n===V.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!W&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,o=0>e||e>c?c:e;return t("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),E.map((o,n)=>e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),K,P,D]}),A&&t("text",{x:d/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof A?A:null}),$e({legend:O,totalWidth:d,totalHeight:u,margin:h,legendPosition:C,title:A,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M})]}):null}function ot({width:e,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=s(null),u=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const f=s(!1),p=s(null),y="horizontal"===(null==l?void 0:l.projection),v=s(y);return v.current=y,i(()=>{if(!d.current)return;const t=B(d.current).select(".brush-g"),n=y?I():R();return n.extent([[0,0],[e,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),t.call(n),u.current=n,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),u.current=null}},[e,o,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=B(d.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1)},[l,y]),t("svg",{ref:d,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}const nt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function it(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const rt="undefined"==typeof window||"undefined"==typeof document,st="undefined"!=typeof window?c:i,at=()=>()=>{},lt=()=>!1,ct=()=>!0;function dt(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function ut(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function ht(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 gt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ft=new WeakMap;let pt=0,yt=!1,vt=null,mt=null,bt=null;function xt(e,t){var o,n;if(!t)return t;const i=gt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(yt)return;if("undefined"==typeof window||"undefined"==typeof document)return;yt=!0;const e=()=>{pt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(vt=new MutationObserver(e),vt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),bt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",bt):"function"==typeof mt.addListener&&mt.addListener(bt)}catch(e){}}();let s=ft.get(r);s&&s.version===pt||(s={version:pt,map:new Map},ft.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}const wt=n.createContext(null),kt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function At(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}const Ot=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},St={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},jt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},_t={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Mt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ct={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Pt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Lt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Tt({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),d=n.useContext(wt),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||u||c(!0)},[l,u]),y=n.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!o||0===o.length)return r?t("span",{id:r,tabIndex:-1,style:kt}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:p,style:kt,role:"region","aria-label":f,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,w,k,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":j.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(u=_.datum)||void 0===u?void 0:u.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(f=_.cy)&&void 0!==f?f:_.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(p=_.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=_.cx)&&void 0!==v?v:_.x,y:null!==(m=_.cy)&&void 0!==m?m:_.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=_.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(S=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ot(e.min)} to ${Ot(e.max)}, mean ${Ot(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:St,role:"region","aria-label":f,children:[t("button",{type:"button",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:_t,children:"×"}),t("div",{role:"note",style:jt,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:Mt,children:[e("caption",{style:Lt,children:["First ",x.length," of ",v.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Ct,children:"type"}),k.map(e=>t("th",{style:Ct,children:e},e))]})}),t("tbody",{children:x.map((o,n)=>e("tr",{children:[t("td",{style:Pt,children:o.label}),k.map(e=>{return t("td",{style:Pt,children:(n=o.values[e],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ot(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},e);var n})]},n))})]})]})}function Ht({summary:e}){return e?t("div",{role:"note",style:kt,children:e}):null}function Bt({tableId:e}){return t("a",{href:"#"+e,style:kt,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,kt)},children:"Skip to data table"})}function It({hoverPoint:e}){let o="";if(e){const t=e.data||e;o="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:kt,children:o})}const Rt="var(--semiotic-focus, #005fcc)";function Ft({active:e,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!e||!o)return null;const l=o.x+n.left,c=o.y+n.top;let d;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),o=Math.max(a,4);d=t("rect",{x:l-e/2-3,y:c-o/2-3,width:e+6,height:o+6,rx:3,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"})}else d=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Rt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function Wt({x:e,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=n.useRef(null),[u,h]=n.useState(null);n.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=u?`translate(${u.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,t("div",{ref:d,className:l,style:{position:"absolute",left:s.left+e,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function Dt(e){let o=null;const n=()=>(o||(o=h(null)),o),i=$t(e);return[function({children:o,initialState:i}){const a=s(i),l=r(()=>$t(e,a.current),[]),c=n();return t(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=d(o))&&void 0!==t?t:i,a=s(e);a.current=e;const c=u(()=>a.current(r.getState()),[r]),h=u(()=>a.current(r.getState()),[r]);return l(r.subscribe,c,h)}]}function $t(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function zt(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 Nt(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:Et})})),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 Et=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Gt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},qt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Vt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Et,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 Xt(e,t){if("light"===t)return Gt;if("dark"===t)return qt;if("high-contrast"===t)return Vt;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?qt:Gt;return Nt(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 Nt(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[Yt,Qt]=Dt(e=>({theme:Gt,setTheme(t){e(e=>({theme:Xt(e.theme,t)}))}}));const Kt="undefined"==typeof window?i:c;function Zt(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Ut(e){const t=function(){const[e,t]=a(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),o=s(t);o.current=t;const[l,c]=function(e,t,o){const n=s(null),[r,l]=a(null);return i(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;l(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),d=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-d.left-d.right,g=c[1]-d.top-d.bottom,f=Zt(e.foregroundGraphics,c,d),p=Zt(e.backgroundGraphics,c,d),y=Qt(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=s(0),w=s(()=>{}),k=u(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=s(()=>{}),O=s(()=>{}),S=s(null),j=s(0),_=u(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),M=u(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(_))},[_]),C=u(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);i(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return Kt(()=>{P&&(pt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:C}}function Jt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function eo(e,t,o=.3){Jt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function to(e,t,o=.6){var n,i,r,s,a;if(!Jt(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,d=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,u=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(d,u,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function oo(e,t,o,n=.35){Jt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function no(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function io(e,t,o){return null==t?o:"string"!=typeof t?t:xt(e,t)||o}function ro(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,l)),u=e.createLinearGradient(n,i,r,s),[h,g,f]=no(e,o);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function so(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 ao=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)lo(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}eo(e,t),e.globalAlpha=1}};function lo(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}const co=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=io(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=io(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),to(e,t),e.globalAlpha=1}}finally{e.restore()}}};function uo(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 ho(e,t){const o=T().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}const go=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),ho(e,t)):(uo(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(uo(e,t),oo(e,t)),e.globalAlpha=1}},fo=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=xt(e,"var(--semiotic-primary, #007bff)"),a=xt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?xt(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?xt(e,d)||d:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=u,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},po=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},yo=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=xt(e,o.style.stroke)||("string"==typeof o.style.fill?xt(e,o.style.fill):o.style.fill)||xt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},vo=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function mo(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 bo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let xo=null;function wo(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(xo||(xo=document.createElement("canvas")),xo.width=e,xo.height=e,xo)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(d);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const ko=new Map;function Ao(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=ko.get(o);if(void 0!==n)return n;const i=wo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ko.set(o,i),i}function Oo(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function So(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 jo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const _o=e=>[yo,...e],Mo={bar:_o([ao]),clusterbar:_o([ao]),point:_o([co]),swarm:_o([co]),pie:[go],donut:[go],boxplot:_o([fo,co]),violin:_o([po]),histogram:_o([ao]),ridgeline:_o([po]),timeline:_o([ao]),funnel:[ao,vo,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?mo(i):null!=r?`${mo(i)} (${bo(r)})`:mo(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=mo(i),e.measureText(c).width+16>n)continue}const d=o.__funnelValueLabelX,u=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ao,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||xt(e,"var(--semiotic-border, #999)"),n=Ao(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=no(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,xt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,d=r?jo(i):"",u=So(n);e.font="bold 13px sans-serif";const h=r?e.measureText(d).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,v=y-f/2,m=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Oo(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Oo(e,v,m,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,m+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,m+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,m+3))}e.lineWidth=1}],swimlane:_o([ao]),custom:_o([ao,co,go,fo,po,vo])},Co={top:50,right:40,bottom:60,left:70},Po={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 Lo({hover:o}){var n,i,r,s,a,l;const c=o.data||{},d=o.stats,u=o.category;if(Array.isArray(c)){const o=u||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(d)return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:["n = ",d.n]}),e("div",{children:["Min: ",d.min.toLocaleString()]}),e("div",{children:["Q1: ",d.q1.toLocaleString()]}),e("div",{children:["Median: ",d.median.toLocaleString()]}),e("div",{children:["Q3: ",d.q3.toLocaleString()]}),e("div",{children:["Max: ",d.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return e("div",{className:"semiotic-tooltip",style:Po,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===o.length&&e("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e("div",{className:"semiotic-tooltip",style:Po,children:[p&&t("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&t("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const To=g(function(o,c){var d,h,g,p,y,v,m,b,x,w,k;const{chartType:A,runtimeMode:O,data:S,oAccessor:j="category",rAccessor:_="value",colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:H,valueAccessor:B,categoryAccessor:I,projection:R="vertical",size:F=[600,400],responsiveWidth:$,responsiveHeight:z,margin:N,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,rExtent:ce,oExtent:de,extentPadding:ue=.05,oSort:he,windowMode:ge="sliding",windowSize:fe=200,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,barColors:me,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:Oe,valueLabel:Te,categoryFormat:He,valueFormat:Be,oLabel:Ie,rLabel:Re,oFormat:Fe,rFormat:We,rTickValues:De,tickLabelEdgeAlign:$e,enableHover:ze=!0,hoverAnnotation:Ne,tooltipContent:Ee,customHoverBehavior:Ge,annotations:qe,svgAnnotationRules:Ve,showGrid:Xe=!1,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,legendCategoryAccessor:gt,onCategoriesChange:ft,backgroundGraphics:pt,foregroundGraphics:yt,title:vt,className:mt,background:bt,centerContent:wt,decay:kt,pulse:Ot,transition:St,animate:jt,staleness:_t,brush:Mt,onBrush:Ct,accessibleTable:Pt=!0,description:Lt,summary:Rt,customLayout:Dt,layoutConfig:$t}=o,Nt=s(!0),Et=Ut({sizeProp:F,responsiveWidth:$,responsiveHeight:z,userMargin:N,marginDefault:Co,foregroundGraphics:yt,backgroundGraphics:pt,animate:jt,transitionProp:St,themeDirtyRef:Nt}),{reducedMotionRef:Gt,responsiveRef:qt,size:Vt,margin:Xt,adjustedWidth:Yt,adjustedHeight:Qt,resolvedForeground:Kt,resolvedBackground:Zt,currentTheme:Jt,transition:eo,introEnabled:to,tableId:oo,rafRef:no,renderFnRef:io,scheduleRender:ro}=Et,so=function(){const[e,t]=a(!1);return st(()=>{t(!0)},[]),e}(),ao=function(){const e=l(at,lt,ct);return s(e).current}(),lo=r(()=>W(S),[S]),co=null!=Oe?Oe:Ie,uo=null!=Te?Te:Re,ho=null!=He?He:Fe,go=null!=Be?Be:We,fo=s(null),po=s(null),yo=s([]),vo=s(gt),mo=s(ft);vo.current=gt,mo.current=ft;const[bo,xo]=a(null),[wo,ko]=a(null),[Ao,Oo]=a(0),[So,jo]=a(!1),[_o,Po]=a(null),To=u(()=>{var e,t;Po(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Ho=ze||Ne,Bo="streaming"===O,Io=r(()=>{var e,t,o;return{chartType:A,runtimeMode:Bo?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:ue,projection:R,oAccessor:Bo?void 0:j,rAccessor:Bo?void 0:_,colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:Bo?H:void 0,valueAccessor:Bo?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:Bo?I||j:void 0,rExtent:ce,oExtent:de,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,themeCategorical:null===(e=null==Jt?void 0:Jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:zt(Jt),themeSequential:null===(t=null==Jt?void 0:Jt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Jt?void 0:Jt.colors)||void 0===o?void 0:o.diverging,barColors:me,decay:kt,pulse:Ot,transition:eo,introAnimation:to,staleness:_t,customLayout:Dt,layoutConfig:$t,layoutMargin:Xt}},[A,fe,ge,ue,R,j,_,M,C,P,L,H,B,I,ce,de,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe,ne,ie,re,se,ae,le,he,pe,ye,ve,me,kt,Ot,null==eo?void 0:eo.duration,null==eo?void 0:eo.easing,to,_t,Bo,Jt,Dt,$t,Xt]),Ro=function(e){const t=s(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ut(e,t);if(!ht(e)||!ht(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!ut(o,i))return!1}else{if(!ht(o)||!ht(i))return!1;if(!dt(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Io),Fo=s(null);Fo.current||(Fo.current=new we(Ro));const Wo=u(()=>{var e,t;const o=vo.current,n=mo.current;if(!n||!o)return;const i=function(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i,yo.current)||(yo.current=i,n(i))},[]);i(()=>{var e;null===(e=Fo.current)||void 0===e||e.updateConfig(Ro),Nt.current=!0,ro()},[Ro,ro]);const Do=s(null);Do.current||(Do.current=new D(e=>{const t=Fo.current;t&&t.ingest(e)&&(Nt.current=!0,ro())}));const $o=u(e=>{var t;null===(t=Do.current)||void 0===t||t.push(e)},[]),zo=u(e=>{var t;null===(t=Do.current)||void 0===t||t.pushMany(e)},[]),No=u(()=>{var e,t;null===(e=Do.current)||void 0===e||e.clear(),null===(t=Fo.current)||void 0===t||t.clear(),Nt.current=!0,ro()},[ro]),Eo=u(e=>{var t,o;null===(t=Do.current)||void 0===t||t.clearLastData(),null===(o=Do.current)||void 0===o||o.setReplacementData(e)},[]);f(c,()=>({push:$o,pushMany:zo,replace:Eo,remove:e=>{var t,o,n,i;null===(t=Do.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Fo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=po.current)||void 0===i?void 0:i.data;!!po.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(po.current=null,xo(null)),Nt.current=!0,ro()}return r},update:(e,t)=>{var o,n,i;null===(o=Do.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Fo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,ro()),r},clear:No,getData:()=>{var e,t,o;return null===(e=Do.current)||void 0===e||e.flush(),null!==(o=null===(t=Fo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[$o,zo,Eo,No,ro]),i(()=>{var e;S&&(null===(e=Do.current)||void 0===e||e.setBoundedData(lo))},[S,lo]);const{hoverHandlerRef:Go,hoverLeaveRef:qo,onPointerMove:Vo,onPointerLeave:Xo}=Et;Go.current=e=>{if(!Ho)return;const t=fo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Xt.left,i=e.clientY-o.top-Xt.top;if(0>n||n>Yt||0>i||i>Qt)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const r=Fo.current;if(!r||0===r.scene.length)return;const s="radial"===R,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=function(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let d=null,u=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Ae(e.r,n)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=Se(r,t,o);break;case"point":if(i)break;e=je(r,t,o,n);break;case"wedge":e=_e(r,t,o);break;case"boxplot":e=Me(r,t,o);break;case"violin":e=Ce(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-Yt/2:n,s?i-Qt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const l=(c=a.datum||{},d=a.x,u=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A}),Object.assign({data:c,x:d,y:u,__semioticHoverData:!0},h));var c,d,u,h;po.current=l,xo(l),Ge&&(Ge(l),Nt.current=!0),ro()},qo.current=()=>{po.current&&(po.current=null,xo(null),Ge&&(Ge(null),Nt.current=!0),ro())};const Yo=s(-1),Qo=s(null),Ko=s(null),Zo=u(e=>{const t=Fo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Ko.current&&Ko.current.version===o)n=Ko.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=function(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}(e),Ko.current={version:o,graph:n}}const i=Yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Yo.current=0;const t=n.flat[0];Qo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Le(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return po.current=o,xo(o),Ge&&Ge(o),void ro()}const r=function(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}(n,i),s=function(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Pe(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Pe(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Yo.current=-1,Qo.current=null,po.current=null,xo(null),Ge&&Ge(null),void ro();Yo.current=s;const a=n.flat[s];Qo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Le(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});po.current=l,xo(l),Ge&&Ge(l),ro()},[Ge,ro]),Uo=u(e=>{Yo.current=-1,Qo.current=null,Vo(e)},[Vo]);io.current=()=>{var e,t;no.current=0;const o=fo.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Fo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Gt.current?r+1e6:r),a=!Gt.current&&s,l=Nt.current;l&&!s&&(i.computeScene({width:Yt,height:Qt}),Wo(),To(),Nt.current=!1),(l||a)&&o.setAttribute("aria-label",At(i.scene,A+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Vt[0]*c,u=Vt[1]*c;o.width===d&&o.height===u||(o.width=d,o.height=u,o.style.width=Vt[0]+"px",o.style.height=Vt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,Vt[0],Vt[1]);const h=null!==(e=null==_t?void 0:_t.threshold)&&void 0!==e?e:5e3,g=_t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==_t?void 0:_t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==bt&&!pt){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=bt||(e&&"transparent"!==e?e:null),i=t?xt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,Vt[0],Vt[1]))}const f="radial"===R;n.save(),n.beginPath(),n.rect(Xt.left,Xt.top,Yt,Qt),n.clip(),f?(n.save(),n.translate(Xt.left+Yt/2,Xt.top+Qt/2)):n.translate(Xt.left,Xt.top);const p=Dt?Mo.custom:Mo[A]||[],y={width:Yt,height:Qt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(ko(i.scales),Oo(e=>e+1)),(null==_t?void 0:_t.showBadge)&&jo(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(no.current=requestAnimationFrame(()=>io.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;st(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:so,wasHydratingFromSSR:ao,storeRef:Fo,dirtyRef:Nt,renderFnRef:io,cleanup:()=>{var e;return null===(e=Do.current)||void 0===e?void 0:e.clear()}}),i(()=>{Nt.current=!0,ro()},[A,Yt,Qt,be,bt,ro]),function(e,t,o,n,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,d=l-a.lastIngestTime>c;d!==r&&(s(d),o.current=!0,n())},1e3);return()=>clearInterval(i)},[e,r,n])}(_t,Fo,Nt,ro,So,jo);const Jo=Ho&&bo?Ee?Ee(bo):t(Lo,{hover:bo}):null,en="radial"===R,tn=Jo?t(Wt,{x:bo?en?bo.x+Yt/2:bo.x:0,y:bo?en?bo.y+Qt/2:bo.y:0,containerWidth:Yt,containerHeight:Qt,margin:Xt,className:"stream-ordinal-tooltip",children:Jo}):null;if(rt||!so&&ao){const o=Fo.current;o&&S&&(o.ingest({inserts:lo,bounded:!0}),o.computeScene({width:Yt,height:Qt}));const i=null!==(d=null==o?void 0:o.scene)&&void 0!==d?d:[],r=null!==(h=null==o?void 0:o.scales)&&void 0!==h?h:null,s="radial"===R,a=s?Xt.left+Yt/2:Xt.left,l=s?Xt.top+Qt/2:Xt.top;return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1]},children:[t(Ht,{summary:Rt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[Zt&&t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt}),e("g",{transform:`translate(${a},${l})`,children:[bt&&t("rect",{x:0,y:0,width:Yt,height:Qt,fill:bt}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const d=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",u=e=>`ord-${o.type}-${d}-${i}-${e}`,h=`ord-${o.type}-${d}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,o){const n=e.fillGradient;if(!n)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let o=0;e.length>o;o++)l.push(t("stop",{offset:e[o].offset,stopColor:e[o].color},o))}else{const o=it(e.style.fill);l.push(t("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return t("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:it(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+d-o} A${o},${o} 0 0 0 ${r+o},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r+o},${l+d} A${o},${o} 0 0 1 ${r},${l+d-o} Z`;break;default:u=`M${r},${l+d} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d} Z`}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=o;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:it(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=o,n=T().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&n.cornerRadius(e.cornerRadius);const i=n(nt)||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:it(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return e("g","vertical"===n.projection?{children:[t("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:it(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:it(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=o,n=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:it(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},u("path"))];if(e.iqrLine&&e.bounds){const o=e.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med")))}return t("g",{children:n},h)}case"connector":return t("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=o,n=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:n,fill:it(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,rTickValues:De,tickLabelEdgeAlign:$e,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,null===(g=Fo.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:qe,svgAnnotationRules:Ve,annotationFrame:0,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null==o?void 0:o.getData()}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt})]})}return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"group","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1],overflow:"visible"},onKeyDown:Zo,children:[Pt&&t(Bt,{tableId:oo}),Pt&&t(Tt,{scene:null!==(y=null===(p=Fo.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:A+" chart",tableId:oo,chartTitle:"string"==typeof vt?vt:void 0}),t(Ht,{summary:Rt}),e("div",{role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ho?Uo:void 0,onMouseLeave:Ho?Xo:void 0,children:[Zt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt})}),t(Je,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showGrid:Xe,rFormat:go,rTickValues:De}),t("canvas",{ref:fo,"aria-label":At(null!==(m=null===(v=Fo.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1]}}),t(It,{hoverPoint:bo}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,_o),annotations:qe,svgAnnotationRules:Ve,annotationFrame:Ao,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null===(b=Fo.current)||void 0===b?void 0:b.getData(),underlayRendered:!0}),(Mt||Ct)&&"radial"!==R&&t(ot,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,onBrush:Ct||(()=>{})}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt}),(null==_t?void 0:_t.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===_t.badgePosition?{top:4,left:4}:"bottom-left"===_t.badgePosition?{bottom:4,left:4}:"bottom-right"===_t.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:So?"#dc3545":"#28a745",color:"white"}),children:So?"STALE":"LIVE"}),t(Ft,{active:Yo.current>=0,hoverPoint:bo,margin:Xt,size:Vt,shape:null===(x=Qo.current)||void 0===x?void 0:x.shape,width:null===(w=Qo.current)||void 0===w?void 0:w.w,height:null===(k=Qo.current)||void 0===k?void 0:k.h}),tn]})]})});To.displayName="StreamOrdinalFrame";const Ho={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 Bo(e,t){return"function"==typeof t?t(e):e[t]}function Io(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 Ro(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=Bo(o,i);l=Io(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Bo(o,n);c.push({label:t,value:Io(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=Io(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=Io(o[e[0]],r))}}const d=Object.assign(Object.assign({},Ho),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,o)=>e("div",{style:{marginTop:0===o&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},o))]})}}function Fo(e){if(!0!==e){if("function"==typeof e){const o=e;return e=>{var n;const i=!0===(null==e?void 0:e.__semioticHoverData)||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?null!==(n=e.data)&&void 0!==n?n:{}:e,r=o(i);return null==r?null:t("div",{className:"semiotic-tooltip",style:Ho,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ro(e):Ro())}}function Wo(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function Do(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function $o(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Fo(t)||o}}const zo=h(null);function No(){return d(zo)}function Eo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Go(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[qo,Vo]=Dt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Xo,Yo]=Dt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Qo={positions:new Map};const Ko=new Set;function Zo(){for(const e of Ko)e()}function Uo(e,t){const o=Qo.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}function Jo(e){const t=p(),o=e.clientId||t,{name:n}=e,i=Vo(e=>e.selections.get(n)),s=Vo(e=>e.setClause),a=Vo(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Eo(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:u(()=>{a(n,o)},[a,n,o]),clientId:o}}function en(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const tn=h(!1),on=h(null),nn="undefined"==typeof window?i:c;function rn(e){const t=d(on),o=p(),n=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),i=s([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i.current,n)||(i.current=n);const r=i.current;nn(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),nn(()=>{t&&t.registerCategories(o,r)},[t,o,r])}function sn({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function an(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}function ln(){return Qt(e=>e.theme)}function cn(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function dn(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 un(){var e;const t=ln(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function hn(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=de[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:"#007bff"}function gn(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}n.createContext(void 0);const fn={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 pn(e,t,o){var n,i,r,s,a,l,c;const d=fn[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?d.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?d.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:d.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:d.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||d.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:d.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:d.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:yn(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function yn(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function vn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function mn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function bn(e,t){if(!t)return mn(e);try{const o=t(e);return null==o?mn(e):o}catch(t){return mn(e)}}function xn(e,t){return"function"==typeof t?t(e):e[t]}function wn({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const d=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,u=xn(d,o),h=xn(d,n),g=i?xn(d,i):void 0;return e("div",{className:"semiotic-tooltip",style:Ho,children:[t("div",{style:{fontWeight:"bold"},children:mn(u)}),t("div",{style:{marginTop:4},children:bn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",mn(g)]})]});var f}}function kn({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&t("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 An extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,o=this.state.error;return"function"==typeof e?e(o):void 0!==e?e:t(kn,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var On;const Sn="undefined"!=typeof process&&"production"!==(null===(On=process.env)||void 0===On?void 0:On.NODE_ENV);function jn({componentName:e,width:o,height:n,children:i}){return t(An,{fallback:i=>t(kn,{componentName:e,message:i.message,width:o,height:n}),children:i})}const _n={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Mn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Cn(e,t,o,n){if(!Sn)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Pn(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function Ln(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Pn(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function Tn({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Ln(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Hn(e){const{data:o,rawData:n,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:v=!1,onObservation:m,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,emptyContent:_,width:M,height:C}=e,P=void 0===n,L=r(()=>W(o),[o]),[T,H]=a([]),B=u(e=>{H(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:F,customHoverBehavior:D,customClickBehavior:$,crosshairSourceId:z}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:s,chartType:l,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,o),v=Jo({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Jo({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Yo(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[w,k]=a(null),A=g||o[0],O=r(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,w,A]),S=u(e=>{var o,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o})},Zo())}(y.name||"hover",o,f)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Uo(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];k(null!=o?o+"":null)}else k(null);if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=dn(e),r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,m,y,f,s,l,c,b,h,A]),j=u(e=>{var t,o,n,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(Qo.positions);return t.delete(e),Qo={positions:t},Zo(),!1}Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Zo()}(y.name||"hover",o,f)}if(e&&d){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),d(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const o=dn(e),r=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[d,s,b,l,c,y,f]);return i(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{!function(e,t){const o=Qo.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}(e,f),Uo(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}({selection:g,linkedHover:f,fallbackFields:y,unwrapData:v,onObservation:m,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:I}),N=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(f,z),E=function(e,t,o){const n=No(),i=un();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=pe(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return pe(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=pe(e,t,s);return e=>n[e]||o(e)}return pe(e,t,s)}if(n&&Object.keys(n).length>0){const e=pe([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}(L,s,l),G=r(()=>{if(!s)return[];const e=new Set;for(const t of L){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[L,s]),q=r(()=>P&&T.length>0?T:G,[P,T,G]),V=function(e,t,o){const[n,i]=a(null),[s,l]=a(new Set),c=u(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=u(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,q),X=r(()=>F||(V.legendSelectionHook?V.legendSelectionHook:R),[F,V.legendSelectionHook,R]),Y=function(e){const t=Qt(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}(g),Q=un(),K=No(),Z=r(()=>{if(E)return E;if(!s||0===q.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Q&&Q.length>0?Q:he,t="__streamCat",o=pe(q.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||o(e)||"#999"},[E,s,q,l,Q,K]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(tn),u=null!==d(on),h=void 0!==n?n:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[l,t,e,g]);rn(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=sn({data:e,colorBy:t,colorScale:o,getColor:fe,categories:f});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return p&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:L,colorBy:s,colorScale:Z,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:q}),te=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=ee),c&&"none"!==c&&(e.legendHoverBehavior=V.onLegendHover,e.legendClickBehavior=V.onLegendClick,e.legendHighlightedCategory=V.highlightedCategory,e.legendIsolatedCategories=V.isolatedCategories),P&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=B),e},[U,ee,c,V.onLegendHover,V.onLegendClick,V.highlightedCategory,V.isolatedCategories,P,s,B]),oe=Array.isArray(n)?W(n):n,ne=function(e,o,n){if(!e)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return t("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mn),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}(j,M,C),ie=ne?null:function(e,o,n,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},_n),{width:o,height:n}),children:i||"No data available"}):null}(oe,M,C,_);return{data:L,colorScale:E,allCategories:q,legendState:V,effectiveSelectionHook:X,activeSelectionHook:R,customHoverBehavior:D,customClickBehavior:$,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||ie||null,legendBehaviorProps:te,crosshairProps:N,resolvedSelection:Y}}function Bn({ref:e,frameRef:t,setup:o}){return f(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}const In=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:v=40,roundedTop:m,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,showCategoryTicks:$,categoryFormat:z,dataIdAccessor:N}=e,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=n,ee=r(()=>W(a),[a]),te=Hn({data:ee,rawData:a,colorBy:f,colorScheme:p,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"BarChart",chartId:P,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:E,height:G}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bn({ref:o,frameRef:i,setup:te});if(te.earlyReturn)return te.earlyReturn;Cn("BarChart",ee,"categoryAccessor",d),Cn("BarChart",ee,"valueAccessor",u);const ie=gn(ee,y,u),re=un(),se=r(()=>new Map,[ee]),ae=r(()=>(e,t)=>{const o={};return o.fill=f?fe(e,f,te.colorScale):hn(I,re,p,void 0,se),o},[f,te.colorScale,I,re,p,se]),le=r(()=>{const e=null==O?void 0:O.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},ae(t,o)),e(t,o)||{}):ae,{stroke:R,strokeWidth:F,opacity:D})},[ae,O,R,F,D]),ce=r(()=>an(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),ue=Tn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(kn,{componentName:"BarChart",message:ue,width:E,height:G});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ie}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[E,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),N&&{dataIdAccessor:N}),{baselinePadding:x,enableHover:q,showAxes:n.showAxes,oLabel:U,rLabel:J,rFormat:g}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:$,oSort:y}),oe),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:de})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BarChart",width:E,height:G,children:t(To,Object.assign({ref:i},he))})});In.displayName="BarChart";const Rn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",stackBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,categoryFormat:z}=e,{width:N,height:E,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=n,J=r(()=>W(a),[a]),ee=p||u,te=Hn({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:H,width:N,height:E});if(te.earlyReturn)return te.earlyReturn;const oe=un(),ne=r(()=>new Map,[J]),ie=r(()=>(e,t)=>ee?te.colorScale?{fill:fe(e,ee,te.colorScale)}:{}:{fill:hn(R,oe,y,t,ne)},[ee,te.colorScale,R,oe,y,ne]),re=r(()=>{const e=null==S?void 0:S.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>{const n=ie(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ie,{stroke:F,strokeWidth:D,opacity:$})},[ie,S,F,D,$]),se=r(()=>an(re,te.effectiveSelectionHook,te.resolvedSelection),[re,te.effectiveSelectionHook,te.resolvedSelection]),ae=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),le=Tn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:ce,effectiveMargin:de}=Bn({ref:o,frameRef:i,setup:te}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[N,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:U,rFormat:f}),z&&{oFormat:z}),{showGrid:q}),ce),Wo({title:X,description:Y,summary:Q,accessibleTable:K,className:c,animate:e.animate})),$o({tooltip:k,defaultTooltipContent:ae})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return le?t(kn,{componentName:"StackedBarChart",message:le,width:N,height:E}):t(jn,{componentName:"StackedBarChart",width:N,height:E,children:t(To,Object.assign({ref:i},ue))})});Rn.displayName="StackedBarChart";const Fn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",groupBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,categoryFormat:$}=e,{width:z,height:N,enableHover:E,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=n,U=r(()=>W(a),[a]),J=p||u,ee=Hn({data:U,rawData:a,colorBy:J,colorScheme:y,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:N});if(ee.earlyReturn)return ee.earlyReturn;const te=un(),oe=r(()=>new Map,[U]),ne=O.pieceStyle,ie=r(()=>(e,t)=>{const o=J?ee.colorScale?{fill:fe(e,J,ee.colorScale)}:{}:{fill:hn(I,te,y,t,oe)};if(ne){const n=ne(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,ee.colorScale,I,te,y,oe,ne]),re=r(()=>vn(ie,{stroke:R,strokeWidth:F,opacity:D}),[ie,R,F,D]),se=r(()=>an(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),le=Tn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:ce,effectiveMargin:de}=Bn({ref:o,frameRef:i,setup:ee}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[z,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:E}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Z,rFormat:f}),$&&{oFormat:$}),{showGrid:G}),ce),Wo({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:ae})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return le?t(kn,{componentName:"GroupedBarChart",message:le,width:z,height:N}):t(jn,{componentName:"GroupedBarChart",width:z,height:N,children:t(To,Object.assign({ref:i},ue))})});function Wn({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const i=(a="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=Jo({name:t}),c=o&&n?"xyBrush":o?"xBrush":"yBrush",d=u(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&en(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&en(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,n,a,l]);return{brushInteraction:r(()=>({brush:c,during:d,end:d}),[c,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof n?n:"value")}),c=s(l.brushInteraction);c.current=l.brushInteraction;const d=u(e=>{if(i){c.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||o||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Fn.displayName="GroupedBarChart";const Dn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",subcategoryAccessor:u,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D,rTickValues:$,tickLabelEdgeAlign:z,showCategoryTicks:N,gradientFill:E,trackFill:G,valueExtent:q}=e,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=n,ne=r(()=>W(a),[a]),ie=p||u,re=r(()=>{if(null!=v)return v;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof d?d(e):e[d])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?X:V)-2*o)/(o-1))):1},[v,e.mode,ne,d,g,V,X]),se=Hn({data:ne,rawData:a,colorBy:ie,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:ie?["string"==typeof ie?ie:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"SwimlaneChart",chartId:C,showLegend:K,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:V,height:X}),ae=Wn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(se.earlyReturn)return se.earlyReturn;const le=un(),ce=r(()=>new Map,[ne]),de=A.pieceStyle,ue=r(()=>(e,t)=>{const o=ie?se.colorScale?{fill:fe(e,ie,se.colorScale)}:{}:{fill:hn(B,le,y,t,ce)};if(de){const n=de(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ie,se.colorScale,B,le,y,ce,de]),he=r(()=>vn(ue,{stroke:I,strokeWidth:R,opacity:F}),[ue,I,R,F]),ge=r(()=>an(he,se.effectiveSelectionHook,se.resolvedSelection),[he,se.effectiveSelectionHook,se.resolvedSelection]),pe=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ye=Tn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ve,effectiveMargin:me}=Bn({ref:o,frameRef:i,setup:se}),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({chartType:"swimlane"},null!=a&&{data:ne}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ge,size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:re,enableHover:Y}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===N?void 0:te,rLabel:oe,rFormat:f}),$&&{rTickValues:$}),null!=z&&{tickLabelEdgeAlign:z}),D&&{oFormat:D}),void 0!==N&&{showCategoryTicks:N}),{showGrid:Q}),ve),Wo({title:Z,description:U,summary:J,accessibleTable:ee,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:pe})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E}),null!=G&&{trackFill:G}),q&&{rExtent:q}),ae.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ye?t(kn,{componentName:"SwimlaneChart",message:ye,width:V,height:X}):t(jn,{componentName:"SwimlaneChart",width:V,height:X,children:t(To,Object.assign({ref:i},be))})});function $n(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Dn.displayName="SwimlaneChart";const zn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:v=[3,8],pointRadius:m=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:A,brush:O,onBrush:S,linkedBrush:j,frameProps:_={},selection:M,linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,chartId:H,loading:B,emptyContent:I,legendInteraction:R,legendPosition:F,color:D,stroke:$,strokeWidth:z,opacity:N,showCategoryTicks:E,categoryFormat:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,oe=r(()=>W(a),[a]),ne=Hn({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:F,selection:M,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:H,showLegend:Q,userMargin:l,marginDefaults:n.marginDefaults,loading:B,emptyContent:I,width:q,height:V}),ie=Wn({brushProp:O,onBrushProp:S,linkedBrush:j,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=r(()=>{if(!y)return;const e=oe.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[oe,y]),se=un(),ae=r(()=>new Map,[oe]),le=_.pieceStyle,ce=r(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=f?fe(e,f,ne.colorScale):hn(D,se,p,void 0,ae),o.r=y?function(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,y,v,re):m,le){const n=le(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,ne.colorScale,y,v,re,m,b,D,se,p,ae,le]),de=r(()=>vn(ce,{stroke:$,strokeWidth:z,opacity:N}),[ce,$,z,N]),ue=r(()=>an(de,ne.effectiveSelectionHook,ne.resolvedSelection),[de,ne.effectiveSelectionHook,ne.resolvedSelection]),he=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),ge=Tn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ge)return t(kn,{componentName:"SwarmPlot",message:ge,width:q,height:V});const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:g}),G&&{oFormat:G}),{showGrid:Y,showCategoryTicks:E}),ne.legendBehaviorProps),Wo({title:K,description:Z,summary:U,accessibleTable:J,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:he})),Do({linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"SwarmPlot",width:q,height:V,children:t(To,Object.assign({ref:i},pe))})});function Nn(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Ho,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}zn.displayName="SwarmPlot";const En=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:v=20,tooltip:m,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,showCategoryTicks:R,categoryFormat:F}=e,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=n,K=r(()=>W(a),[a]),Z=Hn({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"BoxPlot",chartId:_,showLegend:E,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;const U=un(),J=r(()=>new Map,[K]),ee=r(()=>e=>{const t=f?fe(e,f,Z.colorScale):hn(T,U,p,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[f,Z.colorScale,T,U,p,J]),te=r(()=>vn(ee,{stroke:H,strokeWidth:B,opacity:I}),[ee,H,B,I]),oe=r(()=>an(te,Z.effectiveSelectionHook,Z.resolvedSelection),[te,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=r(()=>Nn(),[]),ie=Tn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return t(kn,{componentName:"BoxPlot",message:ie,width:D,height:$});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:oe,showOutliers:y,size:[D,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Y,rLabel:Q,rFormat:g}),F&&{oFormat:F}),{showGrid:N,showCategoryTicks:R}),Z.legendBehaviorProps),Wo({title:G,description:q,summary:V,accessibleTable:X,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ne})),Do({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BoxPlot",width:D,height:$,children:t(To,Object.assign({ref:i},re))})});En.displayName="BoxPlot";const Gn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,showCategoryTicks:z,categoryFormat:N}=o,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=i,ee=r(()=>W(l),[l]),te=Hn({data:ee,rawData:l,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:H,width:E,height:G}),oe=Wn({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h});if(te.earlyReturn)return te.earlyReturn;const ne=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of ee){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[ee,h]),ie=un(),re=r(()=>new Map,[ee]),se=r(()=>e=>{const t=y?fe(e,y,te.colorScale):hn(R,ie,v,void 0,re);return{fill:t,stroke:t,fillOpacity:.8}},[y,te.colorScale,R,ie,v,re]),ae=r(()=>vn(se,{stroke:F,strokeWidth:D,opacity:$}),[se,F,D,$]),le=r(()=>an(ae,te.effectiveSelectionHook,te.resolvedSelection),[ae,te.effectiveSelectionHook,te.resolvedSelection]),ce=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return e("div",{className:"semiotic-tooltip",style:Ho,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),de=Tn({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(de)return t(kn,{componentName:"Histogram",message:de,width:E,height:G});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:le,bins:g,normalize:f}),w?{rExtent:w}:ne&&{rExtent:ne}),{size:[E,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:m,enableHover:q}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:p}),N&&{oFormat:N}),{showGrid:V,showCategoryTicks:z}),te.legendBehaviorProps),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:d,animate:o.animate})),$o({tooltip:b,defaultTooltipContent:ce})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"Histogram",width:E,height:G,children:t(To,Object.assign({ref:a},ue))})});Gn.displayName="Histogram";const qn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,showCategoryTicks:z,categoryFormat:N}=e,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=n,ee=r(()=>W(a),[a]),te=Hn({data:ee,rawData:a,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:H,width:E,height:G}),oe=Wn({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=un(),ie=r(()=>new Map,[ee]),re=r(()=>e=>{const t=y?fe(e,y,te.colorScale):hn(R,ne,v,void 0,ie);return{fill:t,stroke:t,fillOpacity:.6}},[y,te.colorScale,R,ne,v,ie]),se=r(()=>vn(re,{stroke:F,strokeWidth:D,opacity:$}),[re,F,D,$]),ae=r(()=>an(se,te.effectiveSelectionHook,te.resolvedSelection),[se,te.effectiveSelectionHook,te.resolvedSelection]),le=r(()=>Nn({valueAccessor:u}),[u]),ce=Tn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ce)return t(kn,{componentName:"ViolinPlot",message:ce,width:E,height:G});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ae,bins:g,showIQR:f,size:[E,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:m,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:J,rFormat:p}),N&&{oFormat:N}),{showGrid:V,showCategoryTicks:z}),te.legendBehaviorProps),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:le})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"ViolinPlot",width:E,height:G,children:t(To,Object.assign({ref:i},de))})});qn.displayName="ViolinPlot";const Vn=g(function(e,o){var n;const i=pn(e.mode,{width:e.width,height:e.height,showGrid:null===(n=e.showGrid)||void 0===n||n,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);$n(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:v="auto",dotRadius:m=5,categoryPadding:b=10,tooltip:x,annotations:w,valueExtent:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z=r(()=>W(l),[l]),U=Hn({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"DotPlot",chartId:C,showLegend:G,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:$,height:z});if(U.earlyReturn)return U.earlyReturn;const J=gn(Z,v,h),ee=un(),te=r(()=>new Map,[Z]),oe=A.pieceStyle,ne=r(()=>(e,t)=>{const o={r:m,fillOpacity:.8};if(o.fill=p?fe(e,p,U.colorScale):hn(B,ee,y,void 0,te),oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,U.colorScale,m,B,ee,y,te,oe]),ie=r(()=>vn(ne,{stroke:I,strokeWidth:R,opacity:F}),[ne,I,R,F]),re=r(()=>an(ie,U.effectiveSelectionHook,U.resolvedSelection),[ie,U.effectiveSelectionHook,U.resolvedSelection]),se=r(()=>wn({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),ae=Tn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ae)return t(kn,{componentName:"DotPlot",message:ae,width:$,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:J}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:f}),D&&{oFormat:D}),{showGrid:E,oSort:v}),U.legendBehaviorProps),Wo({title:q,description:V,summary:X,accessibleTable:Y,className:d,animate:e.animate})),$o({tooltip:x,defaultTooltipContent:se})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),w&&w.length>0&&{annotations:w}),k&&{rExtent:k}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"DotPlot",width:$,height:z,children:t(To,Object.assign({ref:a},le))})});Vn.displayName="DotPlot";const Xn=g(function(e,o){var n,i;const a=pn(e.mode,{width:null!==(n=e.width)&&void 0!==n?n:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=a,G=r(()=>W(c),[c]),q=f||h,V=Hn({data:G,rawData:c,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:D,userMargin:d,marginDefaults:a.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=un(),Y=r(()=>new Map,[G]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,X,p,t,Y)},[q,V.colorScale,L,X,p,Y]),K=r(()=>{const e=null==x?void 0:x.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},Q(t,o)),e(t,o)||{}):Q,{stroke:T,strokeWidth:H,opacity:B})},[Q,x,T,H,B]),Z=r(()=>an(K,V.effectiveSelectionHook,V.resolvedSelection),[K,V.effectiveSelectionHook,V.resolvedSelection]),U=r(()=>wn({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),J=Tn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Bn({ref:o,frameRef:l,setup:V}),oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:G}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),Wo({title:$,description:z,summary:N,accessibleTable:E,className:u,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:U})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(kn,{componentName:"PieChart",message:J,width:I,height:R}):t(jn,{componentName:"PieChart",width:I,height:R,children:t(To,Object.assign({ref:l},oe))})});Xn.displayName="PieChart";const Yn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=n,G=r(()=>W(a),[a]),q=f||d,V=Hn({data:G,rawData:a,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:D,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(I,R)),Y=un(),Q=r(()=>new Map,[G]),K=x.pieceStyle,Z=r(()=>(e,t)=>{let o;if(o=q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,Y,p,t,Q)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[q,V.colorScale,L,Y,p,Q,K]),U=r(()=>vn(Z,{stroke:T,strokeWidth:H,opacity:B}),[Z,T,H,B]),J=r(()=>an(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),te=Tn({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bn({ref:o,frameRef:i,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:G}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),oe),Wo({title:$,description:z,summary:N,accessibleTable:E,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ee})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(kn,{componentName:"DonutChart",message:te,width:I,height:R}):t(jn,{componentName:"DonutChart",width:I,height:R,children:t(To,Object.assign({ref:i},ie))})});Yn.displayName="DonutChart";const Qn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=s(null),l="context"===o.mode,{compactMode:c}=i,{value:d,min:u=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:k=240,fillZones:A=!0,tooltip:O,annotations:S,frameProps:j={},className:_,stroke:M,strokeWidth:C,opacity:P}=o,{width:L,height:T,title:H,description:B,summary:I,accessibleTable:R}=i,F=Math.max(u,Math.min(h,d)),W=h-u||1,D=(F-u)/W,{gaugeData:$,pieceStyle:z,gaugeAnnotations:N}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(u,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=u;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/W;if(A){const n=(i-u)/W,a=Math.max(0,Math.min(D,(r.value-u)/W)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>u&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[d,u,h,g,f,p,D,W,w,A]),E=r(()=>vn(z,{stroke:M,strokeWidth:C,opacity:P}),[z,M,C,P]),G=k*Math.PI/180,q=180+(360-k)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+q*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+G),Math.sin(X+G)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>G+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),K=Math.max(...Y.map(e=>e[0])),Z=Math.min(...Y.map(e=>e[1])),U=Math.max(...Y.map(e=>e[1])),J=(Z+U)/2,ee=(Q+K)/2,te=Math.max(4,Math.min((L-2*V)/(K-Q),(T-2*V)/(U-Z))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(F,u,h):b;const o=x?x(F):Math.round(F)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[b,F,u,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(F):Math.round(F)+""}:null,[l,b,F,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+q*Math.PI/180+D*G,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,D,q,G,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const e=-Math.PI/2+q*Math.PI/180+(o.value-u)/W*G,r=oe-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,u,W,q,G,oe,te]),de=r(()=>{const e=[...N,...S||[]];return le&&e.push(le),ae&&e.push(ae),e},[N,S,le,ae]),ue=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return e("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:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(F):"Remaining"})]})},[F]);if(0===$.length)return t(kn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:$,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:oe,startAngle:q,sweepAngle:k,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Fo(O)||ue,svgAnnotationRules:ce},de.length>0&&{annotations:de}),H&&{title:H}),B&&{description:B}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=o.animate&&{animate:o.animate}),j);return t(jn,{componentName:"GaugeChart",width:L,height:T,children:t(To,Object.assign({ref:a},he))})});Qn.displayName="GaugeChart";const Kn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,chartId:M,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:H,stroke:B,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=n,Z=r(()=>W(a),[a]),U=Hn({data:Z,rawData:a,colorBy:y,colorScheme:v,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:j,hoverHighlight:_,chartType:"RidgelinePlot",chartId:M,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:C,emptyContent:P,width:$,height:z});if(U.earlyReturn)return U.earlyReturn;const J=un(),ee=r(()=>new Map,[Z]),te=r(()=>e=>{const t=y?fe(e,y,U.colorScale):hn(H,J,v,void 0,ee);return{fill:t,stroke:t,fillOpacity:.5}},[y,U.colorScale,H,J,v,ee]),oe=r(()=>vn(te,{stroke:B,strokeWidth:I,opacity:R}),[te,B,I,R]),ne=r(()=>an(oe,U.effectiveSelectionHook,U.resolvedSelection),[oe,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>Nn(),[]),re=Tn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(re)return t(kn,{componentName:"RidgelinePlot",message:re,width:$,height:z});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ne,bins:g,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:K,rFormat:p}),D&&{oFormat:D}),{showGrid:E,showCategoryTicks:F,oSort:!1,amplitude:f}),U.legendBehaviorProps),Wo({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:ie})),Do({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"RidgelinePlot",width:$,height:z,children:t(To,Object.assign({ref:i},se))})});Kn.displayName="RidgelinePlot";const Zn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,stepAccessor:u="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:v=.3,showLabels:m=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,categoryFormat:R}=o,F="vertical"===y,{width:D,height:$,enableHover:z,showLegend:N,title:E,description:G,summary:q,accessibleTable:V}=i,X=F?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},Y=r(()=>W(l),[l]),Q=f||g,K=!Q,Z=Hn({data:Y,rawData:l,colorBy:Q,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:_,showLegend:N,userMargin:c,marginDefaults:X,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;Cn("FunnelChart",Y,"stepAccessor",u),Cn("FunnelChart",Y,"valueAccessor",h);const U=un(),J=r(()=>new Map,[Y]),ee=r(()=>{if(K)return T||((null==U?void 0:U[0])?U[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,T,U,p]),te=w.pieceStyle,oe=r(()=>(e,t)=>{const o={};if(o.fill=ee||(Q?fe(e,Q,Z.colorScale):hn(T,U,p,t,J)),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ee,Q,Z.colorScale,T,U,p,J,te]),ne=r(()=>vn(oe,{stroke:H,strokeWidth:B,opacity:I}),[oe,H,B,I]),ie=r(()=>an(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,d=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",u=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Ho,children:[d&&t("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&t("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),se=Tn({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(se)return t(kn,{componentName:"FunnelChart",message:se,width:D,height:$});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:F?"bar-funnel":"funnel"},null!=l&&{data:Y}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:ie,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:F,showCategoryTicks:F}),R&&{oFormat:R}),{showGrid:F}),!F&&{connectorOpacity:v}),{showLabels:m}),Z.legendBehaviorProps),E&&{title:E}),G&&{description:G}),q&&{summary:q}),void 0!==V&&{accessibleTable:V}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?re:Fo(b)||re}),(A||O||S||j)&&{customHoverBehavior:Z.customHoverBehavior}),(O||S||A)&&{customClickBehavior:Z.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"FunnelChart",width:D,height:$,children:t(To,Object.assign({ref:a},ae))})});Zn.displayName="FunnelChart";const Un={RdBu:ne,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},Jn="__likert_neutral_neg",ei="__likert_neutral_pos";function ti(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function oi(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function ni(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Jn,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:ei,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function ii(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Jn?r=o:o.__likertLevel===ei?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const ri=g(function(e,o){const i=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),l=s(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:p,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,valueFormat:T,loading:H,emptyContent:B,legendInteraction:I,legendPosition:R,categoryFormat:F,stroke:W,strokeWidth:D,opacity:$}=e,{width:z,height:N,enableHover:E,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,U="horizontal"===b,J=void 0===c,ee=!y,te=function(){var e;const t=ln();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=m.length?x:function(e,t){if(0>=e)return[];if(t){const o=Un[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(m.length,te),[x,m.length,te]),ne=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],oe[t]||"#888");return e},[m,oe]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>ti(o,"question"),[o]),g=r(()=>d?ti(n,"score"):null,[d,n]),f=r(()=>d?null:ti(i,"level"),[d,i]),p=r(()=>d?null:ti(a,"count"),[d,a]),y=e||[],v=s([]),m=r(()=>{if(0===y.length)return[];let e=oi(y,t,h,g,f,p);return l&&(e=ni(e,t),e=ii(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var o;let n=oi(e,t,h,g,f,p);l&&(n=ni(n,t),n=ii(n,t)),null===(o=c.current)||void 0===o||o.replace(n)},[t,h,g,f,p,l,c]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:v,isDiverging:U,frameRef:l}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=No(),f=un(),p=u(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=u(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=u(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(l.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=u(e=>t=>{y([t]),e(t)},[y]),b=u(e=>t=>{y(t),e(t)},[y]),x=u(()=>{l.current=new Set,c.current=[],h(e=>e+1)},[]);rn(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return sn({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,n,o,g,f,d]),k=r(()=>{if(w)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[w,i]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:J,colorBy:ae,colorScheme:oe,showLegend:q,legendPosition:R}),ce=u(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),de=u(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);f(o,()=>({push:ce,pushMany:de,remove:e=>{var t,o;return null!==(o=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=l.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;se.current=[],le.resetCategories(),null===(e=l.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ce,de,le.resetCategories,se]);const ue=Hn({data:ie,rawData:c,colorBy:ae,colorScheme:oe,legendInteraction:I,legendPosition:R,selection:j,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:d,marginDefaults:i.marginDefaults,loading:H,emptyContent:B,width:z,height:N});if(ue.earlyReturn)return ue.earlyReturn;const ge=r(()=>{const e=m.length;return e%2!=0&&ne.get(m[Math.floor(e/2)])||"#888"},[m,ne]),ye=S.pieceStyle,ve=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Jn||r===ei)s={fill:ge};else{const e=i||r;s=e&&ne.has(e)?{fill:ne.get(e)}:{fill:"#888"}}if(ye){const o=ye(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[ne,ge,ye]),me=r(()=>vn(ve,{stroke:W,strokeWidth:D,opacity:$}),[ve,W,D,$]),be=r(()=>an(me,ue.effectiveSelectionHook,ue.resolvedSelection),[me,ue.effectiveSelectionHook,ue.resolvedSelection]),xe=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),we=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Jn||o===ei?xe:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Jn||o===ei?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:Ho},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[xe]),ke=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!v)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return ee?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),Tn({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,p,y,v,m,ee]),Ae=r(()=>[{styleFn:e=>({fill:ne.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,ne]),Oe=r(()=>!1!==q?Object.assign(Object.assign({},ue.legendBehaviorProps),{legend:{legendGroups:Ae},legendPosition:R||ue.legendPosition||"bottom"}):ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,R,q,Ae]),Se=r(()=>{const e=Object.assign({},ue.margin);if(J&&!1!==q){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(le.streamingMarginAdjust)for(const[t,o]of Object.entries(le.streamingMarginAdjust))o>e[t]&&(e[t]=o);return U&&100>e.left&&(e.left=100),e},[ue.margin,le.streamingMarginAdjust,U,J,q,R]),je=r(()=>T||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,T]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:ie}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:be,size:[z,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se,barPadding:w,enableHover:E}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z||(U?void 0:"Percentage"),rFormat:je}),F&&{oFormat:F}),{showGrid:G}),Oe),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),h&&{className:h}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===k?()=>null:!0===k?we:Fo(k)||we}),(_||M||C||P)&&{customHoverBehavior:ue.customHoverBehavior}),(M||C||_)&&{customClickBehavior:ue.customClickBehavior}),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ke?t(kn,{componentName:"LikertChart",message:ke,width:z,height:N}):t(jn,{componentName:"LikertChart",width:z,height:N,children:t(To,Object.assign({ref:l},_e))})});ri.displayName="LikertChart";const si=g(function(e,o){const{data:n,layout:i,layoutConfig:a,categoryAccessor:l="category",valueAccessor:c="value",oExtent:d,rExtent:u,projection:h="vertical",margin:g,className:f,colorScheme:p,showAxes:y=!1,annotations:v,onObservation:m,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,emptyContent:O,frameProps:S={}}=e,{frameRef:j,resolved:_,safeData:M,setup:C,earlyReturn:P}=function(e){var t;const o=function(e){const t=s(null);return $n(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:i}=o,a=Hn({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:p,selection:x,linkedHover:w,onObservation:m,onClick:b,chartId:k,loading:A,emptyContent:O,margin:g,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode});if(P)return P;const{width:L,height:T,enableHover:H,showGrid:B,title:I,description:R,summary:F,accessibleTable:W}=_,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:C.margin,enableHover:H,showAxes:y,showGrid:B,annotations:v}),Wo({title:I,description:R,summary:F,accessibleTable:W,className:f,animate:e.animate})),Do({linkedHover:w,onObservation:m,onClick:b,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),S);return t(jn,{componentName:"OrdinalCustomChart",width:L,height:T,children:t(To,Object.assign({ref:j},D))})});si.displayName="OrdinalCustomChart";export{In as BarChart,En as BoxPlot,Yn as DonutChart,Vn as DotPlot,Zn as FunnelChart,Qn as GaugeChart,Fn as GroupedBarChart,Gn as Histogram,ri as LikertChart,si as OrdinalCustomChart,Xn as PieChart,Kn as RidgelinePlot,Rn as StackedBarChart,To as StreamOrdinalFrame,zn as SwarmPlot,Dn as SwimlaneChart,qn as ViolinPlot,wo as createHatchPattern};